Skip to content

Commit 01cbdc9

Browse files
authored
V2.5.0 (#132)
支持多用户 支持SSL证书支持DNS验证 增加mysql测试用例 修复DNS设置时的展示歧义
1 parent 76bc24d commit 01cbdc9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4712
-528
lines changed

.github/workflows/unitTest.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ jobs:
1919
test:
2020
name: Docker tests
2121
runs-on: ubuntu-latest
22+
services:
23+
mysql:
24+
image: mysql
25+
env:
26+
MYSQL_DATABASE: pmail
27+
MYSQL_ROOT_PASSWORD: githubTest
28+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
29+
2230
container:
2331
image: golang
2432
env:
@@ -51,3 +59,13 @@ jobs:
5159

5260
- name: Run Test
5361
run: make test
62+
63+
- uses: actions/upload-artifact@v4
64+
with:
65+
name: dbfile
66+
path: server/config/pmail_temp.db
67+
68+
69+
- name: Run Test Mysql
70+
run: make test_mysql
71+

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ dist
44
output
55
pmail.db
66
server/plugins
7-
config
7+
config
8+
*_KEY
9+
AURORA_SECRET

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,7 @@ package: clean
4949
cp README.md output/
5050

5151
test:
52-
export setup_port=17888 && cd server && go test -v ./...
52+
export setup_port=17888 && cd server && go test -v ./...
53+
54+
test_mysql:
55+
export setup_port=17888 && cd server && go test -args "mysql" -v ./...

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,6 @@ The code is in `server` folder.
146146

147147
[go to wiki](https://github.com/Jinnrry/PMail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
148148

149+
# Thanks
150+
151+
A special thanks to [Jetbrains](http://jetbrains.com/) for donating licenses to the project.

README_CN.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PMail是一个追求极简部署流程、极致资源占用的个人域名邮箱
8383
"domain": "domain.com", // 你的域名
8484
"webDomain": "mail.domain.com", // web域名
8585
"dkimPrivateKeyPath": "config/dkim/dkim.priv", // dkim 私钥地址
86-
"sslType": "0", // ssl证书更新模式,0自动,1手动
86+
"sslType": "0", // ssl证书更新模式,0自动,HTTP模式,1手动、2自动,DNS模式
8787
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl 证书地址
8888
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl 证书地址
8989
"dbDSN": "./config/pmail.db", // 数据库连接DSN
@@ -149,4 +149,6 @@ SMTP端口: 25/465(SSL)
149149

150150
[go to wiki](https://github.com/Jinnrry/PMail/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E)
151151

152+
# 致谢
152153

154+
感谢 [Jetbrains](http://jetbrains.com/) 为本项目免费提供开发工具。

fe/src/components/GroupSettings.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@
1717
</template>
1818

1919
<script setup>
20-
import $http from "../http/http";
21-
import { reactive, ref } from 'vue'
20+
import { reactive, ref, getCurrentInstance } from 'vue'
2221
import lang from '../i18n/i18n';
2322
2423
const data = reactive([])
24+
const app = getCurrentInstance()
25+
const $http = app.appContext.config.globalProperties.$http
2526
2627
$http.get('/api/group').then(res => {
2728
data.push(...res.data)
2829
})
2930
3031
const del = function (node, data) {
3132
if (data.id != -1) {
32-
$http.post("/api/group/del", { "id": data.id }).then(res => {
33+
this.$axios.post("/api/group/del", { "id": data.id }).then(res => {
3334
if (res.errorNo != 0) {
3435
ElMessage({
3536
message: res.errorMsg,
@@ -79,14 +80,14 @@ const addRoot = function () {
7980
8081
const onInputBlur = function (item) {
8182
if (item.label != "") {
82-
$http.post("/api/group/add", { "name": item.label, "parent_id": item.parent_id }).then(res => {
83+
this.$axios.post("/api/group/add", { "name": item.label, "parent_id": item.parent_id }).then(res => {
8384
if (res.errorNo != 0) {
8485
ElMessage({
8586
message: res.errorMsg,
8687
type: 'error',
8788
})
8889
} else {
89-
$http.get('/api/group').then(res => {
90+
this.$axios.get('/api/group').then(res => {
9091
data.splice(0, data.length)
9192
data.push(...res.data)
9293
})

fe/src/components/HomeAside.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88

99
<script setup>
1010
import { useRouter } from 'vue-router'
11-
import $http from "../http/http";
1211
import { reactive, ref } from 'vue'
1312
import useGroupStore from '../stores/group'
1413
import lang from '../i18n/i18n';
14+
import { getCurrentInstance } from 'vue'
15+
const app = getCurrentInstance()
16+
const $http = app.appContext.config.globalProperties.$http
1517
1618
const groupStore = useGroupStore()
1719
const router = useRouter()
1820
1921
2022
const data = ref([])
2123
24+
2225
$http.get('/api/group').then(res => {
2326
data.value = res.data
2427
})

fe/src/components/HomeHeader.vue

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div id="logo">
44
<span style="padding-left: 20px;">PMail</span>
55
</div>
6-
<div id="settings" @click="settings">
6+
<div id="settings" @click="settings" v-if="$isLogin">
77
<el-icon style="font-size: 25px;">
88
<Setting style="color:#FFFFFF" />
99
</el-icon>
@@ -21,6 +21,10 @@
2121
<el-tab-pane :label="lang.rule_setting">
2222
<RuleSettings />
2323
</el-tab-pane>
24+
25+
<el-tab-pane v-if="$userInfos.is_admin" :label="lang.user_management">
26+
<UserManagement />
27+
</el-tab-pane>
2428
</el-tabs>
2529
</el-drawer>
2630

@@ -30,15 +34,39 @@
3034
<script setup>
3135
import { Setting } from '@element-plus/icons-vue';
3236
import { ref } from 'vue'
33-
import { ElMessageBox } from 'element-plus'
37+
import { ElMessage } from 'element-plus'
3438
import SecuritySettings from '@/components/SecuritySettings.vue'
3539
import lang from '../i18n/i18n';
3640
import GroupSettings from './GroupSettings.vue';
3741
import RuleSettings from './RuleSettings.vue';
42+
import UserManagement from './UserManagement.vue';
43+
import { getCurrentInstance } from 'vue'
44+
const app = getCurrentInstance()
45+
const $http = app.appContext.config.globalProperties.$http
46+
const $isLogin = app.appContext.config.globalProperties.$isLogin
47+
const $userInfos = app.appContext.config.globalProperties.$userInfos
3848
3949
const openSettings = ref(false)
4050
const settings = function () {
41-
openSettings.value = true;
51+
if (Object.keys($userInfos.value).length == 0) {
52+
$http.post("/api/user/info", {}).then(res => {
53+
if (res.errorNo == 0) {
54+
$userInfos.value = res.data
55+
openSettings.value = true;
56+
57+
} else {
58+
ElMessage({
59+
type: 'error',
60+
message: res.errorMsg,
61+
})
62+
}
63+
})
64+
}else{
65+
openSettings.value = true;
66+
}
67+
68+
69+
4270
}
4371
4472
</script>

fe/src/components/RuleSettings.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,19 @@
9898

9999
<script setup>
100100
import { ref, reactive } from 'vue';
101-
import $http from "../http/http";
102101
import lang from '../i18n/i18n';
103102
import {
104103
Plus,
105104
Delete,
106105
Edit,
107106
InfoFilled
108107
} from '@element-plus/icons-vue'
108+
109+
110+
import { getCurrentInstance } from 'vue'
111+
const app = getCurrentInstance()
112+
const $http = app.appContext.config.globalProperties.$http
113+
109114
const data = ref([])
110115
const dialogVisible = ref(false)
111116
const READ = 1
@@ -134,10 +139,13 @@ const groupData = reactive({
134139
135140
const reflushGroupInfos = function () {
136141
$http.get('/api/group/list').then(res => {
137-
groupData.list = res.data
138-
for (let i = 0; i < groupData.list.length; i++) {
139-
groupData.list[i].id += ""
142+
if (res.data != null) {
143+
groupData.list = res.data
144+
for (let i = 0; i < groupData.list.length; i++) {
145+
groupData.list[i].id += ""
146+
}
140147
}
148+
141149
})
142150
}
143151

fe/src/components/SecuritySettings.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<template>
22
<el-form :model="ruleForm" :rules="rules" status-icon>
3+
4+
<el-divider content-position="left">{{lang.modify_pwd}}</el-divider>
5+
36
<el-form-item :label="lang.modify_pwd" prop="new_pwd">
47
<el-input type="password" v-model="ruleForm.new_pwd" />
58
</el-form-item>
@@ -13,14 +16,25 @@
1316
{{ lang.submit }}
1417
</el-button>
1518
</el-form-item>
19+
20+
<el-divider content-position="left">{{lang.logout}}</el-divider>
21+
<el-form-item>
22+
<el-button type="primary" @click="logout">
23+
{{ lang.logout }}
24+
</el-button>
25+
</el-form-item>
1626
</el-form>
1727
</template>
1828

1929
<script setup>
2030
import { reactive, ref } from 'vue'
2131
import { ElNotification } from 'element-plus'
22-
import $http from "../http/http";
2332
import lang from '../i18n/i18n';
33+
34+
import { getCurrentInstance } from 'vue'
35+
const app = getCurrentInstance()
36+
const $http = app.appContext.config.globalProperties.$http
37+
2438
const ruleForm = reactive({
2539
new_pwd: "",
2640
new_pwd2: ""
@@ -32,6 +46,12 @@ const rules = reactive({
3246
3347
})
3448
49+
const logout = function(){
50+
$http.post("/api/logout", { }).then(res => {
51+
location.reload();
52+
})
53+
}
54+
3555
const submit = function () {
3656
if (ruleForm.new_pwd == ""){
3757
return

0 commit comments

Comments
 (0)