smtp setting add encryption

This commit is contained in:
xiaomlove
2022-01-28 02:50:30 +08:00
parent 27ba9aec74
commit 8d6d9d8c15
18 changed files with 93 additions and 51 deletions

View File

@@ -5,9 +5,9 @@
"requires": true,
"packages": {
"": {
"name": "admin",
"version": "0.0.0",
"dependencies": {
"@element-plus/icons-vue": "^0.2.6",
"axios": "^0.21.1",
"element-plus": "^1.3.0-beta.5",
"vue": "^3.0.5",

View File

@@ -7,6 +7,7 @@
"serve": "vite preview --mode preview"
},
"dependencies": {
"@element-plus/icons-vue": "^0.2.6",
"axios": "^0.21.1",
"element-plus": "^1.3.0-beta.5",
"vue": "^3.0.5",

View File

@@ -17,15 +17,15 @@
:default-active='state.currentPath'
>
<el-menu-item index="/"><i class="el-icon-odometer" />Dashboard</el-menu-item>
<el-submenu index="2">
<el-sub-menu index="2">
<template #title>
<span>User</span>
</template>
<el-menu-item-group>
<el-menu-item index="/user"><i class="el-icon-user" />User list</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="3">
</el-sub-menu>
<el-sub-menu index="3">
<template #title>
<span>System</span>
</template>
@@ -44,7 +44,7 @@
<el-menu-item-group>
<el-menu-item index="/setting"><i class="el-icon-menu" />Setting</el-menu-item>
</el-menu-item-group>
</el-submenu>
</el-sub-menu>
</el-menu>
</el-aside>
<el-container class="content">
@@ -186,14 +186,14 @@ body {
.el-menu {
border-right: none!important;
}
.el-submenu {
.el-sub-menu {
border-top: 1px solid hsla(0, 0%, 100%, .05);
border-bottom: 1px solid rgba(0, 0, 0, .2);
}
.el-submenu:first-child {
.el-sub-menu:first-child {
border-top: none;
}
.el-submenu [class^="el-icon-"] {
.el-sub-menu [class^="el-icon-"] {
vertical-align: -1px!important;
}
a {

8
admin/src/main.js vendored
View File

@@ -4,4 +4,10 @@ import ElementPlus from 'element-plus'
import router from './router/index'
import 'element-plus/theme-chalk/index.css'
import './styles/common.scss'
createApp(App).use(ElementPlus).use(router).mount('#app')
import * as ElIcons from '@element-plus/icons-vue'
const app = createApp(App)
for (const name in ElIcons) {
app.component(name, ElIcons[name])
}
app.use(ElementPlus).use(router).mount('#app')

View File

@@ -6,7 +6,7 @@
</div>
<div class="right">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">Add</el-button>
<el-button type="primary" size="small" icon="Plus" @click="handleAdd">Add</el-button>
</div>
</div>
</template>

View File

@@ -6,7 +6,7 @@
</div>
<div class="right">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">Add</el-button>
<el-button type="primary" size="small" icon="Plus" @click="handleAdd">Add</el-button>
</div>
</div>
</template>
@@ -33,11 +33,19 @@
<el-table-column
prop="image_large"
label="Large image"
></el-table-column>
>
<template #default="scope">
<el-image :src="scope.row.image_large" style="max-height: 200px" />
</template>
</el-table-column>
<el-table-column
prop="image_small"
label="Small image"
></el-table-column>
>
<template #default="scope">
<el-image :src="scope.row.image_small" style="max-height: 200px" />
</template>
</el-table-column>
<el-table-column
prop="get_type_text"
@@ -56,7 +64,7 @@
<el-table-column
label="Action"
width="100"
width=""
>
<template #default="scope">
<a style="cursor: pointer; margin-right: 10px" @click="handleEdit(scope.row.id)">Edit</a>

View File

@@ -19,10 +19,10 @@
<td></td>
<td colspan="7">
<div class="other-actions">
<el-button type="primary" size="mini" @click="handleGetModComment">Mod comment</el-button>
<el-button type="primary" size="mini" @click="handleResetPassword">Reset password</el-button>
<el-button type="primary" size="mini" @click="handleAssignExam">Assign exam</el-button>
<el-button type="primary" size="mini" @click="handleGrantMedal">Grant medal</el-button>
<el-button type="primary" size="default" @click="handleGetModComment">Mod comment</el-button>
<el-button type="primary" size="default" @click="handleResetPassword">Reset password</el-button>
<el-button type="primary" size="default" @click="handleAssignExam">Assign exam</el-button>
<el-button type="primary" size="default" @click="handleGrantMedal">Grant medal</el-button>
</div>
</td>
</tr>
@@ -179,6 +179,9 @@
prop="image_large"
label="Image"
>
<template #default="scope">
<el-image :src="scope.row.image_large" style="max-height: 200px" />
</template>
</el-table-column>
<el-table-column

View File

@@ -1,8 +1,13 @@
<template>
<el-card>
<template #header>
<div class="header">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">Add</el-button>
<div class="nexus-table-header">
<div class="left">
</div>
<div class="right">
<el-button type="primary" size="small" icon="Plus" @click="handleAdd">Add</el-button>
</div>
</div>
</template>
<el-table

View File

@@ -379,12 +379,5 @@ class TorrentRepository extends BaseRepository
}
public function getStickyStatus($torrent)
{
if (!$torrent instanceof Torrent) {
$torrent = Torrent::query()->findOrFail((int)$torrent, ['id', 'pos_state']);
}
}
}

View File

@@ -22,7 +22,7 @@
]
},
"require": {
"php": "^7.3|^8.0",
"php": "^8.0",
"ext-gd": "*",
"ext-json": "*",
"ext-mbstring": "*",
@@ -35,7 +35,7 @@
"geoip2/geoip2": "~2.0",
"guzzlehttp/guzzle": "~6.0",
"hashids/hashids": "^4.1",
"imdbphp/imdbphp": "^6.4",
"imdbphp/imdbphp": "^7.0",
"laravel-lang/lang": "~7.0",
"laravel/framework": "^8.12",
"laravel/sanctum": "^2.10",

26
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "536588e03f43a227f60cd6666dbb4e3f",
"content-hash": "4893668aed1fe063d932fc9d9e5ea4d5",
"packages": [
{
"name": "asm89/stack-cors",
@@ -1740,22 +1740,30 @@
},
{
"name": "imdbphp/imdbphp",
"version": "v6.5.1",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/tboothman/imdbphp.git",
"reference": "4a88ceeabadf1c7b4924dd321fb89bc642b58bee"
"reference": "8bd3b62344add278959c297a56f0cffd2796e12f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tboothman/imdbphp/zipball/4a88ceeabadf1c7b4924dd321fb89bc642b58bee",
"reference": "4a88ceeabadf1c7b4924dd321fb89bc642b58bee",
"shasum": ""
"url": "https://api.github.com/repos/tboothman/imdbphp/zipball/8bd3b62344add278959c297a56f0cffd2796e12f",
"reference": "8bd3b62344add278959c297a56f0cffd2796e12f",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"php": ">=5.6",
"psr/log": "~1.0",
"psr/simple-cache": "^1.0"
@@ -1779,9 +1787,9 @@
"description": "Library for retrieving film and tv information from IMDb",
"support": {
"issues": "https://github.com/tboothman/imdbphp/issues",
"source": "https://github.com/tboothman/imdbphp/tree/v6.5.1"
"source": "https://github.com/tboothman/imdbphp/tree/v7.2.0"
},
"time": "2021-05-30T00:19:11+00:00"
"time": "2021-07-15T12:15:21+00:00"
},
{
"name": "laravel-lang/lang",
@@ -9439,5 +9447,5 @@
"ext-bcmath": "*"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.2.0"
}

View File

@@ -1421,7 +1421,11 @@ function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation
$setting = get_setting('smtp');
// Create the Transport
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport'], $setting['smtpport'] == 465 ? 'ssl' : null))
$encryption = null;
if (isset($setting['encryption']) && in_array($setting['encryption'], ['ssl', 'tls'])) {
$encryption = $setting['encryption'];
}
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport'], $encryption))
->setUsername($setting['accountname'])
->setPassword($setting['accountpassword'])
;

View File

@@ -557,6 +557,7 @@ $lang_settings = array
'text_setting_for_external_type' => "外部类型设定",
'row_outgoing_mail_address' => "SMTP地址",
'row_outgoing_mail_port' => "SMTP端口",
'row_outgoing_mail_encryption' => "SMTP加密方式",
'text_outgoing_mail_address_note' => "<b>提示:</b> smtp.yourisp.com",
'text_outgoing_mail_port_note' => "<b>提示:</b> 25",
'row_smtp_account_name' => "用户名",

View File

@@ -557,6 +557,7 @@ $lang_settings = array
'text_setting_for_external_type' => "外部類別設定",
'row_outgoing_mail_address' => "SMTP位址",
'row_outgoing_mail_port' => "SMTP通訊埠",
'row_outgoing_mail_encryption' => "SMTP加密方式",
'text_outgoing_mail_address_note' => "<b>輔助說明:</b> smtp.yourisp.com",
'text_outgoing_mail_port_note' => "<b>輔助說明:</b> 25",
'row_smtp_account_name' => "用戶名",

View File

@@ -556,6 +556,7 @@ $lang_settings = array
'text_setting_for_external_type' => "Settings for External type",
'row_outgoing_mail_address' => "Outgoing mail (SMTP) address",
'row_outgoing_mail_port' => "Outgoing mail (SMTP) port",
'row_outgoing_mail_encryption' => "Outgoing mail (SMTP) encryption",
'text_outgoing_mail_address_note' => "<b>hint:</b> smtp.yourisp.com",
'text_outgoing_mail_port_note' => "<b>hint:</b> 25",
'row_smtp_account_name' => "Account Name",

View File

@@ -104,15 +104,19 @@ $trackerReportAuthKey = $torrentRep->getTrackerReportAuthKey($id, $CURUSER['id']
$dict = \Rhilip\Bencode\Bencode::load($fn);
$dict['announce'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey";
if (count($announce_urls) > 1) {
foreach ($announce_urls as $announce_url) {
/** d['announce-list'] = [[ tracker1, tracker2, tracker3 ]] */
$dict['announce-list'][0][] = $ssl_torrent . $announce_url . "?authkey=$trackerReportAuthKey";
/** d['announce-list'] = [ [tracker1], [backup1], [backup2] ] */
//$dict['announce-list'][] = [$ssl_torrent . $announce_url . "?passkey=" . $CURUSER['passkey']];
}
}
/**
* does not support multi-tracker
*
* @see https://github.com/xiaomlove/nexusphp/issues/26
*/
//if (count($announce_urls) > 1) {
// foreach ($announce_urls as $announce_url) {
// /** d['announce-list'] = [[ tracker1, tracker2, tracker3 ]] */
// $dict['announce-list'][0][] = $ssl_torrent . $announce_url . "?authkey=$trackerReportAuthKey";
// /** d['announce-list'] = [ [tracker1], [backup1], [backup2] ] */
// //$dict['announce-list'][] = [$ssl_torrent . $announce_url . "?passkey=" . $CURUSER['passkey']];
// }
//}
//$dict = bdec_file($fn, $max_torrent_size);
//$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?passkey=$CURUSER[passkey]";

View File

@@ -112,14 +112,17 @@ function bonusarray($option = 0){
$results[] = $bonus;
//Buy medal
$medals = \App\Models\Medal::query()->get();
$medals = \App\Models\Medal::query()->where('get_type', \App\Models\Medal::GET_TYPE_EXCHANGE)->get();
foreach ($medals as $medal) {
$results[] = [
'points' => $medal->price,
'art' => 'buy_medal',
'menge' => 0,
'name' => $medal->name,
'description' => sprintf('<span>%s</span><input type="hidden" name="medal_id" value="%s">', $medal->description, $medal->id),
'description' => sprintf(
'<div style="display: flex;align-items: center"><div style="padding: 10px">%s</div><div><img src="%s" style="max-height: 120px"/></div></div><input type="hidden" name="medal_id" value="%s">',
$medal->description, $medal->image_large, $medal->id
),
'medal_id' => $medal->id,
];
}

View File

@@ -166,7 +166,7 @@ elseif ($action == 'savesettings_smtp') // save smtp
if (isset($smtptype) && $smtptype == 'advanced') {
$validConfig = array_merge($validConfig, array('smtp_host','smtp_port','smtp_from'));
} elseif ($smtptype == 'external') {
$validConfig = array_merge($validConfig, array('smtpaddress','smtpport','accountname','accountpassword'));
$validConfig = array_merge($validConfig, array('smtpaddress','smtpport', 'encryption', 'accountname','accountpassword'));
}
GetVar($validConfig);
@@ -306,6 +306,10 @@ elseif ($action == 'smtpsettings') // stmp settings
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_setting_for_external_type']."</b></td></tr>");
tr($lang_settings['row_outgoing_mail_address'], "<input type=text name=smtpaddress style=\"width: 300px\" ".(!empty($SMTP['smtpaddress']) ? "value=\"".$SMTP['smtpaddress']."\"" : "")."> ".$lang_settings['text_outgoing_mail_address_note'], 1);
tr($lang_settings['row_outgoing_mail_port'], "<input type=text name=smtpport style=\"width: 300px\" ".(!empty($SMTP['smtpport']) ? "value=\"".$SMTP['smtpport']."\"" : "")."> ".$lang_settings['text_outgoing_mail_port_note'], 1);
$encryptionRadio = '<label><input type="radio" name="encryption" value="" ' . (empty($SMTP['encryption']) ? " checked" : "") . ' />none</label>';
$encryptionRadio .= '<label><input type="radio" name="encryption" value="tls"' . ($SMTP['encryption'] == "tls" ? " checked" : "") . '/>tls</label>';
$encryptionRadio .= '<label><input type="radio" name="encryption" value="ssl"' . ($SMTP['encryption'] == "ssl" ? " checked" : "") . '/>ssl</label>';
tr($lang_settings['row_outgoing_mail_encryption'], $encryptionRadio, 1);
tr($lang_settings['row_smtp_account_name'], "<input type=text name=accountname style=\"width: 300px\" ".(!empty($SMTP['accountname']) ? "value=\"".$SMTP['accountname']."\"" : "")."> ".$lang_settings['text_smtp_account_name_note'], 1);
tr($lang_settings['row_smtp_account_password'], "<input type=password name=accountpassword style=\"width: 300px\" ".(!empty($SMTP['accountpassword']) ? "value=\"".$SMTP['accountpassword']."\"" : "")."> ".$lang_settings['text_smtp_account_password_note'], 1);
print("</tbody><tbody>");