no message

This commit is contained in:
kuaifan 2022-03-29 14:48:36 +08:00
parent 80a21dbf4a
commit b2f8da500b
6 changed files with 66 additions and 7 deletions

View File

@ -8,6 +8,7 @@ use App\Tasks\DeleteTmpTask;
use App\Tasks\OverdueRemindEmailTask;
use Hhxsv5\LaravelS\Swoole\Task\Task;
use Redirect;
use Request;
/**
@ -38,6 +39,19 @@ class IndexController extends InvokeController
return view('main', ['version' => Base::getVersion()]);
}
/**
* 获取版本号
* @return array
*/
public function version()
{
return [
'version' => Base::getVersion(),
'owner' => 'kuaifan',
'repo' => 'dootask-test',
];
}
/**
* 接口文档
* @return \Illuminate\Http\RedirectResponse
@ -68,6 +82,43 @@ class IndexController extends InvokeController
return "success";
}
/**
* 桌面客户端发布
*/
public function desktop__publish($name = '')
{
$body = Request::input('body');
$genericVersion = Request::header('generic-version');
//
$latestFile = public_path("uploads/desktop/latest");
if (preg_match("/^\d+\.\d+\.\d+$/", $genericVersion)) {
$genericPath = "uploads/desktop/" . $genericVersion . "/";
$res = Base::upload([
"file" => Request::file('file'),
"type" => 'desktop',
"path" => $genericPath,
"fileName" => true
]);
if ($res) {
if ($body) {
file_put_contents(public_path($genericPath . "change.md"), $body);
}
file_put_contents($latestFile, $genericVersion);
}
return $res;
}
if ($name && file_exists($latestFile)) {
$genericVersion = file_get_contents($latestFile);
if (preg_match("/^\d+\.\d+\.\d+$/", $genericVersion)) {
$filePath = public_path("uploads/desktop/{$genericVersion}/{$name}");
if (file_exists($filePath)) {
return response()->download($filePath);
}
}
}
return abort(404);
}
/**
* 提取所有中文
* @return array|string

View File

@ -50,5 +50,8 @@ class VerifyCsrfToken extends Middleware
// 保存汇报
'api/report/store/',
// 发布桌面端
'desktop/publish/',
];
}

View File

@ -2301,6 +2301,9 @@ class Base
case 'md':
$type = ['md'];
break;
case 'desktop':
$type = ['yml', 'yaml', 'dmg', 'blockmap', 'zip', 'exe', 'msi'];
break;
case 'more':
$type = [
'text', 'md', 'markdown',
@ -2343,7 +2346,9 @@ class Base
$fileSize = 0;
}
$scaleName = "";
if ($param['fileName']) {
if ($param['fileName'] === true) {
$fileName = $file->getClientOriginalName();
} elseif ($param['fileName']) {
$fileName = $param['fileName'];
} else {
if ($param['scale'] && is_array($param['scale'])) {

View File

@ -300,9 +300,9 @@ return [
'log_level' => 4,
'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
'document_root' => base_path('public'),
'buffer_output_size' => 200 * 1024 * 1024,
'socket_buffer_size' => 256 * 1024 * 1024,
'package_max_length' => 200 * 1024 * 1024,
'buffer_output_size' => 512 * 1024 * 1024,
'socket_buffer_size' => 512 * 1024 * 1024,
'package_max_length' => 512 * 1024 * 1024,
'reload_async' => true,
'max_wait_time' => 60,
'enable_reuse_port' => true,

View File

@ -25,7 +25,7 @@ server {
root /var/www/public;
client_max_body_size 200M;
client_max_body_size 512M;
autoindex off;
index index.html index.htm index.php;

View File

@ -700,7 +700,7 @@ auto_globals_jit = On
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 200M
post_max_size = 512M
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
@ -852,7 +852,7 @@ file_uploads = On
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 200M
upload_max_filesize = 512M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 100