perf: 新增系统别名设置

This commit is contained in:
kuaifan 2024-11-19 11:19:37 +08:00
parent c952da669c
commit 82a340d576
5 changed files with 19 additions and 9 deletions

View File

@ -41,7 +41,7 @@ class SystemController extends AbstractController
* @apiParam {String} type
* - get: 获取(默认)
* - all: 获取所有(需要管理员权限)
* - save: 保存设置(参数:['reg', 'reg_identity', 'reg_invite', 'temp_account_alias', 'login_code', 'password_policy', 'project_invite', 'chat_information', 'anon_message', 'voice2text', 'translation', 'e2e_message', 'auto_archived', 'archived_day', 'task_visible', 'task_default_time', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', 'user_group_chat_mute', 'image_compress', 'image_save_local', 'start_home']
* - save: 保存设置(参数:['reg', 'reg_identity', 'reg_invite', 'temp_account_alias', 'login_code', 'password_policy', 'project_invite', 'chat_information', 'anon_message', 'voice2text', 'translation', 'e2e_message', 'auto_archived', 'archived_day', 'task_visible', 'task_default_time', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', 'user_group_chat_mute', 'system_alias', 'image_compress', 'image_save_local', 'start_home']
* @apiSuccess {Number} ret 返回状态码1正确、0错误
* @apiSuccess {String} msg 返回信息(错误描述)
@ -78,6 +78,7 @@ class SystemController extends AbstractController
'all_group_autoin',
'user_private_chat_mute',
'user_group_chat_mute',
'system_alias',
'image_compress',
'image_save_local',
'start_home',
@ -102,6 +103,9 @@ class SystemController extends AbstractController
if ($all['translation'] == 'open' && empty(Base::settingFind('aibotSetting', 'openai_key'))) {
return Base::retError('开启翻译功能需要在应用中开启 ChatGPT AI 机器人。');
}
if ($all['system_alias'] == env('APP_NAME')) {
$all['system_alias'] = '';
}
$setting = Base::setting('system', Base::newTrim($all));
} else {
$setting = Base::setting('system');
@ -1154,10 +1158,10 @@ class SystemController extends AbstractController
Factory::mailer()
->setDsn("smtp://{$all['account']}:{$all['password']}@{$all['smtp_server']}:{$all['port']}?verify_peer=0")
->setMessage(EmailMessage::create()
->from(env('APP_NAME', 'Task') . " <{$all['account']}>")
->from(Base::settingFind('system', 'system_alias', 'Task') . " <{$all['account']}>")
->to($to)
->subject('Mail sending test')
->html('<p>收到此电子邮件意味着您的邮箱配置正确。</p><p>Receiving this email means that your mailbox is configured correctly.</p>'))
->html('<p>' . Doo::translate('收到此电子邮件意味着您的邮箱配置正确。') . '</p>'))
->send();
}, function () {
throw new \Exception("收件人地址错误或已被忽略");

View File

@ -17,7 +17,7 @@
<div v-if="formDatum.reg == 'open'" class="form-tip">{{$L('允许开放注册功能')}}</div>
<template v-else-if="formDatum.reg == 'invite'">
<div class="form-tip">{{$L('邀请码:注册时需填写下方邀请码。')}}</div>
<Input v-model="formDatum.reg_invite" style="width:200px;margin-top:6px">
<Input v-model="formDatum.reg_invite" style="width:220px;margin-top:6px">
<span slot="prepend">{{$L('邀请码')}}</span>
</Input>
</template>
@ -210,6 +210,12 @@
<div class="block-setting-box">
<h3>{{ $L('其他设置') }}</h3>
<div class="form-box">
<FormItem :label="$L('系统别名')" prop="system_alias">
<div style="width: 220px;">
<Input v-model="formDatum.system_alias"/>
</div>
<div class="form-tip">{{$L('用于网页默认标题、邮件发送等')}}</div>
</FormItem>
<FormItem :label="$L('图片优化')" prop="image_compress">
<RadioGroup v-model="formDatum.image_compress">
<Radio label="open">{{$L('开启')}}</Radio>
@ -225,7 +231,7 @@
<div class="form-tip">{{$L('是否将消息中的网络图片保存到本地服务器。')}}</div>
</FormItem>
<FormItem :label="$L('文件上传限制')" prop="fileUploadLimit">
<div style="width: 192px;">
<div style="width: 220px;">
<Input type="number" number v-model="formDatum.file_upload_limit" :placeholder="$L('默认不限制')">
<template #append>
<span>MB</span>

View File

@ -9,7 +9,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'WebPage') }} - v{{ $version }}</title>
<title>{{ $system_alias }} - v{{ $version }}</title>
<link rel="shortcut icon" href="{{ asset_main('favicon.ico') }}">
<style>
* {

View File

@ -9,7 +9,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $name }} - {{ config('app.name', 'WebPage') }}</title>
<title>{{ $name }} - {{ $system_alias }}</title>
<link rel="shortcut icon" href="{{ asset_main('favicon.ico') }}">
<style>
* {

View File

@ -9,7 +9,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'WebPage') }}</title>
<title>{{ $system_alias }}</title>
<link rel="shortcut icon" href="{{ asset_main('favicon.ico') }}">
@if($style)
<link rel="stylesheet" type="text/css" href="{{ $style }}">
@ -24,7 +24,7 @@
csrfToken: "{{ csrf_token() }}"
};
window.systemInfo = {
title: "{{config('app.name', 'WebPage')}}",
title: "{{$system_alias}}",
debug: "{{config('app.debug') ? 'yes' : 'no'}}",
version: "{{ $version }}",
origin: window.location.origin + "/",