Skip to content

Commit

Permalink
V2.5.0 (#132)
Browse files Browse the repository at this point in the history
支持多用户
支持SSL证书支持DNS验证
增加mysql测试用例
修复DNS设置时的展示歧义
  • Loading branch information
Jinnrry authored Jul 2, 2024
1 parent 76bc24d commit 01cbdc9
Show file tree
Hide file tree
Showing 73 changed files with 4,712 additions and 528 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/unitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:
test:
name: Docker tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql
env:
MYSQL_DATABASE: pmail
MYSQL_ROOT_PASSWORD: githubTest
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

container:
image: golang
env:
Expand Down Expand Up @@ -51,3 +59,13 @@ jobs:

- name: Run Test
run: make test

- uses: actions/upload-artifact@v4
with:
name: dbfile
path: server/config/pmail_temp.db


- name: Run Test Mysql
run: make test_mysql

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ dist
output
pmail.db
server/plugins
config
config
*_KEY
AURORA_SECRET
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ package: clean
cp README.md output/

test:
export setup_port=17888 && cd server && go test -v ./...
export setup_port=17888 && cd server && go test -v ./...

test_mysql:
export setup_port=17888 && cd server && go test -args "mysql" -v ./...
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,6 @@ The code is in `server` folder.

[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)

# Thanks

A special thanks to [Jetbrains](http://jetbrains.com/) for donating licenses to the project.
4 changes: 3 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ PMail是一个追求极简部署流程、极致资源占用的个人域名邮箱
"domain": "domain.com", // 你的域名
"webDomain": "mail.domain.com", // web域名
"dkimPrivateKeyPath": "config/dkim/dkim.priv", // dkim 私钥地址
"sslType": "0", // ssl证书更新模式,0自动,1手动
"sslType": "0", // ssl证书更新模式,0自动,HTTP模式,1手动、2自动,DNS模式
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl 证书地址
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl 证书地址
"dbDSN": "./config/pmail.db", // 数据库连接DSN
Expand Down Expand Up @@ -149,4 +149,6 @@ SMTP端口: 25/465(SSL)

[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)

# 致谢

感谢 [Jetbrains](http://jetbrains.com/) 为本项目免费提供开发工具。
11 changes: 6 additions & 5 deletions fe/src/components/GroupSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@
</template>

<script setup>
import $http from "../http/http";
import { reactive, ref } from 'vue'
import { reactive, ref, getCurrentInstance } from 'vue'
import lang from '../i18n/i18n';
const data = reactive([])
const app = getCurrentInstance()
const $http = app.appContext.config.globalProperties.$http
$http.get('/api/group').then(res => {
data.push(...res.data)
})
const del = function (node, data) {
if (data.id != -1) {
$http.post("/api/group/del", { "id": data.id }).then(res => {
this.$axios.post("/api/group/del", { "id": data.id }).then(res => {
if (res.errorNo != 0) {
ElMessage({
message: res.errorMsg,
Expand Down Expand Up @@ -79,14 +80,14 @@ const addRoot = function () {
const onInputBlur = function (item) {
if (item.label != "") {
$http.post("/api/group/add", { "name": item.label, "parent_id": item.parent_id }).then(res => {
this.$axios.post("/api/group/add", { "name": item.label, "parent_id": item.parent_id }).then(res => {
if (res.errorNo != 0) {
ElMessage({
message: res.errorMsg,
type: 'error',
})
} else {
$http.get('/api/group').then(res => {
this.$axios.get('/api/group').then(res => {
data.splice(0, data.length)
data.push(...res.data)
})
Expand Down
5 changes: 4 additions & 1 deletion fe/src/components/HomeAside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@

<script setup>
import { useRouter } from 'vue-router'
import $http from "../http/http";
import { reactive, ref } from 'vue'
import useGroupStore from '../stores/group'
import lang from '../i18n/i18n';
import { getCurrentInstance } from 'vue'
const app = getCurrentInstance()
const $http = app.appContext.config.globalProperties.$http
const groupStore = useGroupStore()
const router = useRouter()
const data = ref([])
$http.get('/api/group').then(res => {
data.value = res.data
})
Expand Down
34 changes: 31 additions & 3 deletions fe/src/components/HomeHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id="logo">
<span style="padding-left: 20px;">PMail</span>
</div>
<div id="settings" @click="settings">
<div id="settings" @click="settings" v-if="$isLogin">
<el-icon style="font-size: 25px;">
<Setting style="color:#FFFFFF" />
</el-icon>
Expand All @@ -21,6 +21,10 @@
<el-tab-pane :label="lang.rule_setting">
<RuleSettings />
</el-tab-pane>

<el-tab-pane v-if="$userInfos.is_admin" :label="lang.user_management">
<UserManagement />
</el-tab-pane>
</el-tabs>
</el-drawer>

Expand All @@ -30,15 +34,39 @@
<script setup>
import { Setting } from '@element-plus/icons-vue';
import { ref } from 'vue'
import { ElMessageBox } from 'element-plus'
import { ElMessage } from 'element-plus'
import SecuritySettings from '@/components/SecuritySettings.vue'
import lang from '../i18n/i18n';
import GroupSettings from './GroupSettings.vue';
import RuleSettings from './RuleSettings.vue';
import UserManagement from './UserManagement.vue';
import { getCurrentInstance } from 'vue'
const app = getCurrentInstance()
const $http = app.appContext.config.globalProperties.$http
const $isLogin = app.appContext.config.globalProperties.$isLogin
const $userInfos = app.appContext.config.globalProperties.$userInfos
const openSettings = ref(false)
const settings = function () {
openSettings.value = true;
if (Object.keys($userInfos.value).length == 0) {
$http.post("/api/user/info", {}).then(res => {
if (res.errorNo == 0) {
$userInfos.value = res.data
openSettings.value = true;
} else {
ElMessage({
type: 'error',
message: res.errorMsg,
})
}
})
}else{
openSettings.value = true;
}
}
</script>
Expand Down
16 changes: 12 additions & 4 deletions fe/src/components/RuleSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,19 @@

<script setup>
import { ref, reactive } from 'vue';
import $http from "../http/http";
import lang from '../i18n/i18n';
import {
Plus,
Delete,
Edit,
InfoFilled
} from '@element-plus/icons-vue'
import { getCurrentInstance } from 'vue'
const app = getCurrentInstance()
const $http = app.appContext.config.globalProperties.$http
const data = ref([])
const dialogVisible = ref(false)
const READ = 1
Expand Down Expand Up @@ -134,10 +139,13 @@ const groupData = reactive({
const reflushGroupInfos = function () {
$http.get('/api/group/list').then(res => {
groupData.list = res.data
for (let i = 0; i < groupData.list.length; i++) {
groupData.list[i].id += ""
if (res.data != null) {
groupData.list = res.data
for (let i = 0; i < groupData.list.length; i++) {
groupData.list[i].id += ""
}
}
})
}
Expand Down
22 changes: 21 additions & 1 deletion fe/src/components/SecuritySettings.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<el-form :model="ruleForm" :rules="rules" status-icon>

<el-divider content-position="left">{{lang.modify_pwd}}</el-divider>

<el-form-item :label="lang.modify_pwd" prop="new_pwd">
<el-input type="password" v-model="ruleForm.new_pwd" />
</el-form-item>
Expand All @@ -13,14 +16,25 @@
{{ lang.submit }}
</el-button>
</el-form-item>

<el-divider content-position="left">{{lang.logout}}</el-divider>
<el-form-item>
<el-button type="primary" @click="logout">
{{ lang.logout }}
</el-button>
</el-form-item>
</el-form>
</template>

<script setup>
import { reactive, ref } from 'vue'
import { ElNotification } from 'element-plus'
import $http from "../http/http";
import lang from '../i18n/i18n';
import { getCurrentInstance } from 'vue'
const app = getCurrentInstance()
const $http = app.appContext.config.globalProperties.$http
const ruleForm = reactive({
new_pwd: "",
new_pwd2: ""
Expand All @@ -32,6 +46,12 @@ const rules = reactive({
})
const logout = function(){
$http.post("/api/logout", { }).then(res => {
location.reload();
})
}
const submit = function () {
if (ruleForm.new_pwd == ""){
return
Expand Down
Loading

0 comments on commit 01cbdc9

Please sign in to comment.