Skip to content

Commit

Permalink
更新v1.3.0-beta24-01-25
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 66d0e5e
Author: Sun <[email protected]>
Date:   Thu Jan 25 13:20:34 2024 +0800

    更新1.3.0-beta24-01-25

commit 52a81e5
Author: Sun <[email protected]>
Date:   Thu Jan 25 13:13:08 2024 +0800

    Squashed commit of the following:

    commit 908d87357c4e22868eff85f377bb8cd22f3785d7
    Author: Sun <[email protected]>
    Date:   Thu Jan 25 13:12:14 2024 +0800

        增加前端版本号

    commit 8ed2b636476c7a14ae4e1761f7712949b7ce60fc
    Author: Sun <[email protected]>
    Date:   Thu Jan 25 12:29:49 2024 +0800

        增加自动获取前端版本号的git tag

commit ba7d70f
Author: Sun <[email protected]>
Date:   Thu Jan 25 10:58:15 2024 +0800

    优化代码

commit 104543b
Author: Sun <[email protected]>
Date:   Wed Jan 24 21:28:31 2024 +0800

    增加系统状态组件的部分样式

commit 70c87c9
Author: Sun <[email protected]>
Date:   Wed Jan 24 20:55:05 2024 +0800

    时间组件和搜索栏组件增加样式类型

commit 6bab5a2
Author: Sun <[email protected]>
Date:   Wed Jan 24 20:41:33 2024 +0800

    将项目列表增加样式并优化减少dom嵌套

commit 99d18df
Author: Sun <[email protected]>
Date:   Wed Jan 24 20:11:07 2024 +0800

    增加系统状态、logo等类名并简化部分组件dom

commit bf1cc0c
Author: Sun <[email protected]>
Date:   Wed Jan 24 17:17:41 2024 +0800

    更新关于页面

commit fceacf5
Author: Sun <[email protected]>
Date:   Wed Jan 24 14:54:37 2024 +0800

    增加隐藏网络模式切换开关

commit e0dcc49
Author: Sun <[email protected]>
Date:   Wed Jan 24 13:55:28 2024 +0800

    优化部分错误码

commit 863cdf0
Author: Sun <[email protected]>
Date:   Wed Jan 24 12:54:55 2024 +0800

    声明暴露端口

commit 5b25ef9
Author: Sun <[email protected]>
Date:   Wed Jan 24 12:38:48 2024 +0800

    修改命令行所有的输出内容为英文
  • Loading branch information
hslr-s committed Jan 25, 2024
1 parent d11e7b2 commit 956e645
Show file tree
Hide file tree
Showing 37 changed files with 280 additions and 228 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ COPY --from=server_image /build/sun-panel /app/sun-panel
# 中国国内源
# RUN sed -i "[email protected]@mirrors.aliyun.com@g" /etc/apk/repositories

EXPOSE 3002

RUN apk add --no-cache bash ca-certificates su-exec tzdata \
&& chmod +x ./sun-panel \
&& ./sun-panel -config
Expand Down
28 changes: 28 additions & 0 deletions add-frontend-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require('fs')
// const { execSync } = require('child_process')
const moment = require('moment')

// git 最新标签
// const latestTag = execSync('git describe --tags --abbrev=0').toString().trim()
const packDate = moment().format('YYYYMMDD-HH')

// 要追加的内容
const contentToAppend = `\nVITE_APP_VERSION=${packDate}`
// 读取文件原始内容
const envFilePath = '.env'
let envContent = fs.readFileSync(envFilePath, 'utf-8')

const versionRegex = /^VITE_APP_VERSION=.*$/m
if (versionRegex.test(envContent)) {
// 使用正则表达式查找并替换 VITE_APP_VERSION=* 这一行
envContent = envContent.replace(versionRegex, contentToAppend)
}
else {
// 追加内容
envContent = envContent + contentToAppend
}

// 将新内容写回 .env 文件
fs.writeFileSync(envFilePath, envContent)

console.log('update to .env file.', contentToAppend)
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"name": "sun-panel",
"version": "2.10.9",
"version": "0.0.0",
"private": false,
"description": "ChatGPT Web",
"author": "ChenZhaoYu <chenzhaoyu1994@gmail.com>",
"description": "Sun-Panel Web",
"author": "BraisedHunter <95302870@qq.com>",
"keywords": [
"Sun-Panel",
"chatgpt",
"chatbot",
"vue"
],
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"build": "run-p add-version type-check build-only",
"add-version": "node ./add-frontend-version.js",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit",
Expand Down
5 changes: 4 additions & 1 deletion service/api/api_v1/common/apiReturn/ErrorCode.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package apiReturn

var ErrorCodeMap = map[int]string{
// -1:操作失败
// -1:操作失败(前端会自动弹窗)
// 100: "operation failed",

1000: "Not logged in yet", // 还未登录
1003: "Incorrect username or password", // 用户名或密码错误
1004: "Account disabled or not activated", // 账号已停用或未激活
1005: "No current permission for operation", // 当前无权限操作
1006: "Account does not exist", // 账号不存在
1007: "Old password error", // 旧密码不正确

// 数据类
1200: "Database error", // 数据库错误
Expand Down
3 changes: 2 additions & 1 deletion service/api/api_v1/panel/itemIcon.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ func (a *ItemIcon) Edit(c *gin.Context) {
}

if req.ItemIconGroupId == 0 {
apiReturn.Error(c, "Group is mandatory")
// apiReturn.Error(c, "Group is mandatory")
apiReturn.ErrorParamFomat(c, "Group is mandatory")
return
}

Expand Down
2 changes: 1 addition & 1 deletion service/api/api_v1/system/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (a *UserApi) UpdatePasssword(c *gin.Context) {
} else {
if v.Password != cmn.PasswordEncryption(params.OldPassword) {
// 旧密码不正确
apiReturn.Error(c, global.Lang.Get("user.api_old_pass_error"))
apiReturn.ErrorByCode(c, 1007)
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion service/assets/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9|1.3.0-beta24-01-17-19
9|1.3.0-beta24-01-25
22 changes: 11 additions & 11 deletions service/initialize/A_ENTER.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func InitApp() error {

// 日志
if logger, err := runlog.InitRunlog(global.RUNCODE, "running.log"); err != nil {
log.Panicln("日志初始化错误", err)
log.Panicln("Log initialization error", err)
panic(err)
} else {
global.Logger = logger
Expand All @@ -47,7 +47,7 @@ func InitApp() error {
// 配置初始化
{
if config, err := config.ConfigInit(); err != nil {
global.Logger.Errorln("配置初始化错误", err)
global.Logger.Errorln("Configuration initialization error", err)
return err
} else {
global.Config = config
Expand All @@ -74,7 +74,7 @@ func InitApp() error {
})

if err != nil {
log.Panicln("Redis初始化错误", err)
log.Panicln("Redis initialization error", err)
panic(err)
// return err
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func DatabaseConnect() {
}

if db, err := database.DbInit(dbClientInfo); err != nil {
log.Panicln("数据库初始化错误", err)
log.Panicln("Database initialization error", err)
panic(err)
} else {
global.Db = db
Expand All @@ -133,17 +133,17 @@ func CommandRun() {
pwd bool
)

flag.BoolVar(&cfg, "config", false, "生成配置文件")
flag.BoolVar(&pwd, "password-reset", false, "重置第一个用户的密码")
flag.BoolVar(&cfg, "config", false, "Generate configuration file")
flag.BoolVar(&pwd, "password-reset", false, "Reset the password of the first user")

flag.Parse()

if cfg {
// 生成配置文件
fmt.Println("正在生成配置文件")
fmt.Println("Generating configuration file")
cmn.AssetsTakeFileToPath("conf.example.ini", "conf/conf.example.ini")
cmn.AssetsTakeFileToPath("conf.example.ini", "conf/conf.ini")
fmt.Println("配置文件已经创建 conf/conf.ini ", "请按照自己的需求修改")
fmt.Println("The configuration file has been created conf/conf.ini ", "Please modify according to your own needs")
os.Exit(0) // 务必退出
} else if pwd {
// 重置密码
Expand Down Expand Up @@ -171,9 +171,9 @@ func CommandRun() {
os.Exit(0) // 务必退出
}

fmt.Println("密码已经重置成功,以下是账号信息")
fmt.Println("用户名 ", userInfo.Username)
fmt.Println("密码 ", newPassword)
fmt.Println("The password has been successfully reset. Here is the account information")
fmt.Println("Username ", userInfo.Username)
fmt.Println("Password ", newPassword)
os.Exit(0) // 务必退出
} else {
return
Expand Down
Binary file added src/assets/about_image/bilibili.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/about_image/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/about_image/qq_group_qr2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/about_image/youtube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 45 additions & 24 deletions src/components/apps/About/index.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<script setup lang="ts">
import { NDivider, NGradientText } from 'naive-ui'
import { NDivider, NGradientText, NTag } from 'naive-ui'
import { onMounted, ref } from 'vue'
import { get } from '@/api/system/about'
import { useAppStore } from '@/store'
import srcSvglogo from '@/assets/logo.svg'
import srcGitee from '@/assets/about_image/gitee.png'
import srcGithub from '@/assets/about_image/github.png'
import srcDocker from '@/assets/about_image/docker.png'
import srcQQGroupQR from '@/assets/about_image/qq_group_qr.jpg'
import srcBilibili from '@/assets/about_image/bilibili.png'
import srcYoutube from '@/assets/about_image/youtube.png'
import srcQQGroupQR from '@/assets/about_image/qq_group_qr2.png'
import { RoundCardModal } from '@/components/common'
interface Version {
versionName: string
versionCode: number
}
const appStore = useAppStore()
const versionName = ref('')
const qqGroupQRShow = ref(false)
const frontVersion = import.meta.env.VITE_APP_VERSION || 'unknown'
onMounted(() => {
get<Version>().then((res) => {
Expand All @@ -26,43 +31,44 @@ onMounted(() => {
</script>

<template>
<div class="pt-10">
<div>
<div class="flex flex-col items-center justify-center">
<img :src="srcSvglogo" width="100" height="100" alt="">
<div class="text-3xl font-semibold">
{{ $t('common.appName') }}
</div>
<div class="text-xl">
<NGradientText type="info">
<a href="https://github.com/hslr-s/sun-panel/releases" class="font-semibold" :title="$t('apps.about.viewUpdateLog')" target="_blank">v{{ versionName }}</a>
</NGradientText>
</div>
<div class="pt-5">
<div class="flex flex-col items-center justify-center">
<img :src="srcSvglogo" width="100" height="100" alt="">
<div class="text-3xl font-semibold">
{{ $t('common.appName') }}
</div>
<div class="text-xl">
<NGradientText type="info">
<a href="https://github.com/hslr-s/sun-panel/releases" class="font-semibold" :title="$t('apps.about.viewUpdateLog')" target="_blank">v{{ versionName }}</a>
</NGradientText>
</div>
<div class="mt-2">
<a href="https://github.com/hslr-s/sun-panel/releases" target="_blank" class="link">{{ $t('apps.about.checkUpdate') }}</a>
</div>
</div>
<NDivider> • </NDivider>

<NDivider style="margin:10px 0">
</NDivider>
<div class="flex flex-col items-center justify-center text-base">
<div>
<a href="https://github.com/hslr-s/sun-panel/releases" target="_blank" class="link">{{ $t('apps.about.checkUpdate') }}</a>
{{ $t('apps.about.author') }}<a href="https://github.com/hslr-s" target="_blank" class="link">红烧猎人</a> | <a href="https://github.com/hslr-s/sun-panel/blob/master/doc/donate.md" target="_blank" class="text-red-600 hover:text-red-900">{{ $t('apps.about.donate') }}</a>
</div>

<div>
{{ $t('apps.about.issue') }}<a href="https://github.com/hslr-s/sun-panel/issues" target="_blank" class="link">Github Issues</a>
</div>

<div>
{{ $t('apps.about.QQGroup') }}<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=_I9WIoJn1roIdoaAqelSj9qClLKlXIa1&authKey=GfsQP2GagHnus0jMc7U8Sm6VhWjtsipXUzCHbFwQsGyHMgmYWx6ZbAP%2Bhut%2B4D6N&noverify=0&group_code=276594668" target="_blank" class="link">{{ $t("apps.about.addQQGroupUrl") }}</a>
{{ $t('apps.about.discussions') }}<a href="https://github.com/hslr-s/sun-panel/discussions" target="_blank" class="link">Github Discussions</a>
</div>
<div>
{{ $t('apps.about.QQGroup') }}<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=K6UII6aEPZUeDRIPOEpOSJZH-Vmr_RPu&authKey=jEXhnVekLbDDx5UkQzKtd3bRmhZggkGBxmvW4NT5LLIAFP7toMmqABwvkANGHbLb&noverify=0&group_code=831615449" target="_blank" class="link">{{ $t("apps.about.addQQGroupUrl") }}</a>
|
<span class="link cursor-pointer" @click="qqGroupQRShow = !qqGroupQRShow">
{{ $t('apps.about.QR') }}
</span>
</div>

<div>
{{ $t('apps.about.author') }}<a href="https://github.com/hslr-s" target="_blank" class="link">红烧猎人</a> | <a href="https://github.com/hslr-s/sun-panel/blob/master/doc/donate.md" target="_blank" class="text-red-600 hover:text-red-900">{{ $t('apps.about.donate') }}</a>
</div>

<div class="flex mt-[10px]">
<div class="flex mt-[10px] flex-wrap justify-center">
<div class="flex items-center mx-[10px]">
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcGithub" alt="">
<a href="https://github.com/hslr-s/sun-panel" target="_blank" class="link">Github</a>
Expand All @@ -75,6 +81,21 @@ onMounted(() => {
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcDocker" alt="">
<a href="https://hub.docker.com/r/hslr/sun-panel" target="_blank" class="link">Docker</a>
</div>
<div class="flex items-center mx-[10px]">
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcBilibili" alt="">
<!-- <a href="https://space.bilibili.com/27407696/channel/collectiondetail?sid=2023810" target="_blank" class="link">Bilibili</a> -->
<a href="https://space.bilibili.com/27407696/channel/collectiondetail?sid=2023810" target="_blank" class="link">Bilibili</a>
</div>
<div v-if="appStore.language !== 'zh-CN'" class="flex items-center mx-[10px]">
<img class="w-[20px] h-[20px] mr-[5px]" :src="srcYoutube" alt="">
<a href="https://www.youtube.com/channel/UCKwbFmKU25R602z6P2fgPYg" target="_blank" class="link">YouTube</a>
</div>
</div>

<div class="mt-5">
<NTag :bordered="false" size="small">
{{ $t("apps.about.frontVersionText") }}: FV-{{ frontVersion }}
</NTag>
</div>

<RoundCardModal v-model:show="qqGroupQRShow" title="交流群二维码" style="width: 300px;">
Expand Down
7 changes: 7 additions & 0 deletions src/components/apps/Style/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ function resetPanelConfig() {
</div>

<NGrid cols="2">
<NGridItem span="12 400:12">
<div class="flex items-center mt-[5px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.netModeChangeButtonShow') }}</span>
<NSwitch v-model:value="panelState.panelConfig.netModeChangeButtonShow" />
</div>
</NGridItem>

<NGridItem span="12 400:12">
<div class="flex items-center mt-[10px]">
<span class="mr-[10px]">{{ $t('apps.baseSettings.maxWidth') }}</span>
Expand Down
8 changes: 0 additions & 8 deletions src/components/apps/UserInfo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,6 @@ function handleUpdatePassword(e: MouseEvent) {
updatePasswordModalState.value.show = false
ms.success(t('common.success'))
}
else if (code === 0) {
// 旧密码错误
}
else {
// 其他错误
ms.error(`${t('common.failed')}:${msg}`)
}
}).finally(() => {
updatePasswordModalState.value.loading = false
}).catch(() => {
Expand Down
9 changes: 5 additions & 4 deletions src/components/common/ItemCard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const propClass = ref(props.class)
</script>

<template>
<div class="w-full">
<div class="item-card w-full">
<!-- 详情图标 -->
<div
v-if="cardTypeStyle === PanelPanelConfigStyleEnum.info"
class="w-full rounded-2xl transition-all duration-200 flex"
class="item-card-info w-full rounded-2xl transition-all duration-200 flex"
:class="propClass"
:style="{ backgroundColor: backgroundColor ?? defaultBackground }"
>
Expand All @@ -32,9 +32,10 @@ const propClass = ref(props.class)
<!-- 极简图标(APP) -->
<div
v-if="cardTypeStyle === PanelPanelConfigStyleEnum.icon"
class="item-card-small"
>
<div
class="overflow-hidden rounded-2xl sunpanel w-[70px] h-[70px] mx-auto transition-all duration-200"
class="item-card-small-icon overflow-hidden rounded-2xl sunpanel w-[70px] h-[70px] mx-auto transition-all duration-200"
:class="propClass"
:style="{ backgroundColor: backgroundColor ?? defaultBackground }"
>
Expand All @@ -43,7 +44,7 @@ const propClass = ref(props.class)

<div
v-if="!iconTextIconHideTitle"
class="text-center app-icon-text-shadow cursor-pointer mt-[2px]"
class="item-card-small-title text-center app-icon-text-shadow cursor-pointer mt-[2px]"
:style="{ color: iconTextColor }"
>
{{ iconText }}
Expand Down
22 changes: 11 additions & 11 deletions src/components/common/ItemIcon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ const iconExt = computed(() => {
</script>

<template>
<div :style="defaultStyle">
<div class="item-icon" :style="defaultStyle">
<slot>
<div v-if="itemIcon">
<div v-if="itemIcon?.itemType === 1">
<template v-if="itemIcon">
<template v-if="itemIcon?.itemType === 1">
<NAvatar :size="props.size" :style="{ backgroundColor: (forceBackground ?? itemIcon?.backgroundColor) || defaultBackground }">
{{ itemIcon.text }}
</NAvatar>
</div>
</template>

<div v-else-if="itemIcon?.itemType === 2">
<template v-else-if="itemIcon?.itemType === 2">
<div v-if="iconExt === 'svg'" :style="{ backgroundColor: (forceBackground ?? itemIcon?.backgroundColor) || defaultBackground, ...defaultStyle }" class="flex justify-center items-center">
<img :src="itemIcon?.src" class="w-[35px] h-[35px]">
</div>
<NImage v-else :style="{ backgroundColor: (forceBackground ?? itemIcon?.backgroundColor) || defaultBackground, ...defaultStyle }" :src="itemIcon?.src" preview-disabled />
</div>
</template>

<div v-else-if="itemIcon?.itemType === 3">
<template v-else-if="itemIcon?.itemType === 3">
<NAvatar :size="props.size" :style="{ backgroundColor: (forceBackground ?? itemIcon?.backgroundColor) || defaultBackground }">
<SvgIconOnline style="font-size: 35px;" :icon="itemIcon.text" />
</NAvatar>
</div>
</div>
</template>
</template>

<div v-else>
<template v-else>
<NAvatar :size="props.size" />
</div>
</template>
</slot>
</div>
</template>
Loading

0 comments on commit 956e645

Please sign in to comment.