fixbug
This commit is contained in:
parent
6af5beb990
commit
f5255b51ae
|
|
@ -12,7 +12,7 @@ class Kernel extends ConsoleKernel
|
||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule): void
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
$schedule->command('app:mark-timeout-mail')->minutely();
|
$schedule->command('app:mark-timeout-mail')->everyMinute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ function ($attribute, $value, $fail) {
|
||||||
return abort(400, $th->getMessage());
|
return abort(400, $th->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_email_list = Mail::where($where)
|
$email_list = Mail::where($where)
|
||||||
->select([
|
->select([
|
||||||
'id as key',
|
'id as key',
|
||||||
'from',
|
'from',
|
||||||
|
|
@ -100,17 +100,23 @@ function ($attribute, $value, $fail) {
|
||||||
->orderBy('received_at', 'asc')
|
->orderBy('received_at', 'asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$key = ['time' => time()];
|
// $mail_ids = array_column($email_list->toArray(), 'key');
|
||||||
|
|
||||||
foreach ($new_email_list as $value) {
|
foreach ($email_list as $value) {
|
||||||
$value->key = Crypt::encryptString($value->key);
|
$value->hash = hash('sha256', $value->key . $value->to . $value->received_at . $value->created_at);
|
||||||
|
$value->key = Crypt::encryptString($value->key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mail::whereIn('id', $mail_ids)->update([
|
||||||
|
// 'is_read' => 1,
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
$key = ['time' => time()];
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'code' => 1,
|
'code' => 1,
|
||||||
'msg' => '',
|
'msg' => '',
|
||||||
'data' => [
|
'data' => [
|
||||||
'list' => $new_email_list,
|
'list' => $email_list,
|
||||||
'new_key' => Crypt::encryptString(json_encode($key)),
|
'new_key' => Crypt::encryptString(json_encode($key)),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -103,12 +103,12 @@
|
||||||
|
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<input type="text" class="form-control" id="inputText" value="{{$rand_prefix}}"
|
<input type="text" class="form-control" id="prefixInput" value="{{$rand_prefix}}"
|
||||||
placeholder="Enter text">
|
placeholder="Enter text">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text">@</span>
|
<span class="input-group-text">@</span>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" id="selectOption" style="width: auto;">
|
<select class="form-control select2" id="domainList" style="width: auto;">
|
||||||
@foreach($domain_list as $domain)
|
@foreach($domain_list as $domain)
|
||||||
<option value="{{$domain}}">{{$domain}}</option>
|
<option value="{{$domain}}">{{$domain}}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<input type="text" class="form-control alert alert-primary" id="auto-reload"
|
<input type="text" class="form-control alert alert-primary" id="auto-reload"
|
||||||
value="距离下次刷新还有10秒" disabled readonly>
|
value="距离下次刷新还有5秒" disabled readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
@ -162,9 +162,11 @@
|
||||||
</div>
|
</div>
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="https://github.com/996icu/996.ICU/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-Anti%20996-blue.svg" alt="996 license" /></a>
|
<a href="https://github.com/996icu/996.ICU/blob/master/LICENSE"><img
|
||||||
|
src="https://img.shields.io/badge/license-Anti%20996-blue.svg" alt="996 license" /></a>
|
||||||
<span class="text-muted">© 2023 临时邮箱. All rights reserved.</span>
|
<span class="text-muted">© 2023 临时邮箱. All rights reserved.</span>
|
||||||
<a href="https://996.icu"><img src="https://img.shields.io/badge/link-996.icu-red.svg" alt="996.icu" /></a>
|
<a href="https://996.icu"><img src="https://img.shields.io/badge/link-996.icu-red.svg"
|
||||||
|
alt="996.icu" /></a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -202,7 +204,10 @@
|
||||||
let email = "";
|
let email = "";
|
||||||
let key = "{{$key}}";
|
let key = "{{$key}}";
|
||||||
let isRequestPending = false;
|
let isRequestPending = false;
|
||||||
let countdown = 10;
|
let countdown = 5;
|
||||||
|
let savedPrefix = localStorage.getItem('prefix');
|
||||||
|
let savedDomain = localStorage.getItem('domain');
|
||||||
|
|
||||||
|
|
||||||
let csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
let csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||||
|
|
||||||
|
|
@ -243,8 +248,11 @@ function fetchMail() {
|
||||||
$('#default-note').hide();
|
$('#default-note').hide();
|
||||||
}
|
}
|
||||||
$.each(response.data.list, function (k, v) {
|
$.each(response.data.list, function (k, v) {
|
||||||
let temp_html = '<tr><td>' + v.from + '</td><td>' + v.title + '</td><td>' + dateFmt(v.received_at) + '</td><td><button class="btn btn-primary info-btn btn-sm" data-key="' + v.key + '" type="button">查看</button></td></tr>';
|
if ($('#mail-list tr[data-hash="' + v.hash + '"]').length <= 0) {
|
||||||
$('#default-note').parent().append(temp_html);
|
let temp_html = '<tr data-hash="' + v.hash + '"><td>' + v.from + '</td><td>' + v.title + '</td><td>' + dateFmt(v.received_at) + '</td><td><button class="btn btn-primary info-btn btn-sm" data-key="' + v.key + '" type="button">查看</button></td></tr>';
|
||||||
|
$('#mail-list').parent().append(temp_html);
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
// 在这里处理你的响应数据
|
// 在这里处理你的响应数据
|
||||||
},
|
},
|
||||||
|
|
@ -267,61 +275,81 @@ function fetchMail() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
||||||
|
|
||||||
|
if (savedPrefix) {
|
||||||
|
$('#prefixInput').val(savedPrefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedDomain) {
|
||||||
|
if ($('#domainList option[value="' + savedDomain + '"]').length <= 0) {
|
||||||
|
$('#domainList').append('<option value="' + savedDomain + '">' + savedDomain + '</option>');
|
||||||
|
}
|
||||||
|
$('#domainList').val(savedDomain);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#domainList').val('{{$domain_list[0]}}');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.select2').select2({
|
$('.select2').select2({
|
||||||
tags: true
|
tags: true
|
||||||
});
|
});
|
||||||
|
|
||||||
var clipboard = new ClipboardJS('.copy-btn');
|
var clipboard = new ClipboardJS('.copy-btn');
|
||||||
clipboard.on('success', function (e) {
|
clipboard.on('success', function (e) {
|
||||||
console.info('Action:', e.action);
|
// console.info('Action:', e.action);
|
||||||
console.info('Text:', e.text);
|
// console.info('Text:', e.text);
|
||||||
console.info('Trigger:', e.trigger);
|
// console.info('Trigger:', e.trigger);
|
||||||
|
|
||||||
e.clearSelection();
|
e.clearSelection();
|
||||||
});
|
});
|
||||||
|
|
||||||
clipboard.on('error', function (e) {
|
clipboard.on('error', function (e) {
|
||||||
|
alert('复制失败');
|
||||||
console.error('Action:', e.action);
|
console.error('Action:', e.action);
|
||||||
console.error('Trigger:', e.trigger);
|
console.error('Trigger:', e.trigger);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#selectOption').on('change keyup', function () {
|
$('#domainList').on('change keyup', function () {
|
||||||
let domain = $('#selectOption').val();
|
let domain = $('#domainList').val();
|
||||||
if (!isValidDomain(domain)) {
|
if (!isValidDomain(domain)) {
|
||||||
$('#selectOption').addClass('is-invalid');
|
$('#domainList').addClass('is-invalid');
|
||||||
$('#domainInvalidFeedback').remove();
|
$('#domainInvalidFeedback').remove();
|
||||||
$('#selectOption').parent().append('<div id="domainInvalidFeedback" class="invalid-feedback">请输入一个合法的域名</div>');
|
$('#domainList').parent().append('<div id="domainInvalidFeedback" class="invalid-feedback">请输入一个合法的域名</div>');
|
||||||
$('#saveBtn').hide();
|
$('#saveBtn').hide();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$('#selectOption').removeClass('is-invalid');
|
$('#domainList').removeClass('is-invalid');
|
||||||
$('#domainInvalidFeedback').remove();
|
$('#domainInvalidFeedback').remove();
|
||||||
}
|
}
|
||||||
$('#saveBtn').show();
|
$('#saveBtn').show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#inputText').on('change keyup', function () {
|
$('#prefixInput').on('change keyup', function () {
|
||||||
this.value = this.value.toLowerCase().replace(/[^a-z0-9]/g, '');
|
this.value = this.value.toLowerCase().replace(/[^a-z0-9]/g, '');
|
||||||
let textLength = $('#inputText').val().length;
|
let textLength = $('#prefixInput').val().length;
|
||||||
if (textLength < 5 || textLength > 32) {
|
if (textLength < 5 || textLength > 32) {
|
||||||
$('#inputText').addClass('is-invalid');
|
$('#prefixInput').addClass('is-invalid');
|
||||||
$('#perfixInvalidFeedback').remove();
|
$('#perfixInvalidFeedback').remove();
|
||||||
$('#inputText').parent().append('<div id="perfixInvalidFeedback" class="invalid-feedback">长度必须在5到32位之间</div>');
|
$('#prefixInput').parent().append('<div id="perfixInvalidFeedback" class="invalid-feedback">长度必须在5到32位之间</div>');
|
||||||
$('#saveBtn').hide();
|
$('#saveBtn').hide();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (block_prefix.includes($('#inputText').val())) {
|
} else if (block_prefix.includes($('#prefixInput').val())) {
|
||||||
$('#inputText').addClass('is-invalid');
|
$('#prefixInput').addClass('is-invalid');
|
||||||
$('#perfixInvalidFeedback').remove();
|
$('#perfixInvalidFeedback').remove();
|
||||||
$('#inputText').parent().append('<div id="perfixInvalidFeedback" class="invalid-feedback">该前缀不被允许</div>');
|
$('#prefixInput').parent().append('<div id="perfixInvalidFeedback" class="invalid-feedback">该前缀不被允许</div>');
|
||||||
$('#saveBtn').hide();
|
$('#saveBtn').hide();
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#inputText').removeClass('is-invalid');
|
$('#prefixInput').removeClass('is-invalid');
|
||||||
$('#perfixInvalidFeedback').remove();
|
$('#perfixInvalidFeedback').remove();
|
||||||
}
|
}
|
||||||
$('#saveBtn').show();
|
$('#saveBtn').show();
|
||||||
|
|
@ -332,15 +360,20 @@ function fetchMail() {
|
||||||
|
|
||||||
|
|
||||||
$('#saveBtn').click(function () {
|
$('#saveBtn').click(function () {
|
||||||
email = $('#inputText').val() + "@" + $('#selectOption').val();
|
email = $('#prefixInput').val() + "@" + $('#domainList').val();
|
||||||
$('#mailToCopy').val(email);
|
$('#mailToCopy').val(email);
|
||||||
console.log("邮箱:" + email);
|
console.log("邮箱:" + email);
|
||||||
|
localStorage.setItem('prefix', $('#prefixInput').val());
|
||||||
|
localStorage.setItem('domain', $('#domainList').val());
|
||||||
|
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#selectOption').val('{{$domain_list[0]}}');
|
|
||||||
|
|
||||||
$('#saveBtn').click();
|
$('#saveBtn').click();
|
||||||
|
|
||||||
|
fetchMail();
|
||||||
var countdownTimer = setInterval(function () {
|
var countdownTimer = setInterval(function () {
|
||||||
if (isRequestPending) {
|
if (isRequestPending) {
|
||||||
$('#auto-reload').val('刷新中...');
|
$('#auto-reload').val('刷新中...');
|
||||||
|
|
@ -351,7 +384,7 @@ function fetchMail() {
|
||||||
if (countdown <= 0) {
|
if (countdown <= 0) {
|
||||||
fetchMail();
|
fetchMail();
|
||||||
$('#auto-reload').val('刷新中...');
|
$('#auto-reload').val('刷新中...');
|
||||||
countdown = 11; // 重置为 11,因为下一次循环会立即减 1
|
countdown = 6; // 重置为 11,因为下一次循环会立即减 1
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
@ -370,12 +403,12 @@ function fetchMail() {
|
||||||
|
|
||||||
$('#myModal').on('shown.bs.modal', function () {
|
$('#myModal').on('shown.bs.modal', function () {
|
||||||
let iframeHeight = $('#modalIframe').contents().find("html").height();
|
let iframeHeight = $('#modalIframe').contents().find("html").height();
|
||||||
if (iframeHeight <= 600){
|
if (iframeHeight <= 600) {
|
||||||
$('#modalIframe').css('height',600);
|
$('#modalIframe').css('height', 600);
|
||||||
} else if (iframeHeight >= 800){
|
} else if (iframeHeight >= 800) {
|
||||||
$('#modalIframe').css('height',800);
|
$('#modalIframe').css('height', 800);
|
||||||
} else {
|
} else {
|
||||||
$('#modalIframe').css('height',iframeHeight);
|
$('#modalIframe').css('height', iframeHeight);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -418,4 +451,4 @@ function fetchMail() {
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user