diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ffa325..b3c55297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # CHANGE LOG +## main branch(v0.6.1) + +- pages github actions && 修复清理邮件天数为 0 不生效 by @tqjason (#355) +- fix: imap proxy server 不支持 密码 by @dreamhunter2333 (#356) +- worker 新增 `ANNOUNCEMENT` 配置, 用于配置公告信息 by @dreamhunter2333 (#357) + ## v0.6.0 ### Breaking Changes diff --git a/frontend/package.json b/frontend/package.json index f38cfb11..e511351c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "cloudflare_temp_email", - "version": "0.6.0", + "version": "0.6.1", "private": true, "type": "module", "scripts": { diff --git a/frontend/src/App.vue b/frontend/src/App.vue index ef8c254c..9edf4184 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -54,7 +54,7 @@ onMounted(async () => { - + diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index fa629734..15cfb965 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -4,7 +4,7 @@ import axios from 'axios' const API_BASE = import.meta.env.VITE_API_BASE || ""; const { loading, auth, jwt, settings, openSettings, - userOpenSettings, userSettings, + userOpenSettings, userSettings, announcement, showAuth, adminAuth, showAdminAuth, userJwt } = useGlobalState(); @@ -56,6 +56,7 @@ const getOpenSettings = async (message) => { const res = await api.fetch("/open_api/settings"); const domainLabels = res["domainLabels"] || []; Object.assign(openSettings.value, { + ...res, title: res["title"] || "", prefix: res["prefix"] || "", minAddressLen: res["minAddressLen"] || 1, @@ -81,6 +82,14 @@ const getOpenSettings = async (message) => { if (openSettings.value.needAuth) { showAuth.value = true; } + if (openSettings.value.announcement && openSettings.value.announcement != announcement.value) { + announcement.value = openSettings.value.announcement; + message.info(announcement.value, { + showIcon: false, + duration: 0, + closable: true + }); + } } catch (error) { message.error(error.message || "error"); } diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 35601271..43e9c555 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -1,13 +1,15 @@ import { ref } from "vue"; -import { createGlobalState, useStorage, useDark, useToggle } from '@vueuse/core' +import { createGlobalState, useStorage, useDark, useToggle, useLocalStorage } from '@vueuse/core' export const useGlobalState = createGlobalState( () => { const isDark = useDark() const toggleDark = useToggle(isDark) const loading = ref(false); + const announcement = useLocalStorage('announcement', ''); const openSettings = ref({ title: '', + announcement: '', prefix: '', needAuth: false, adminContact: '', @@ -83,6 +85,7 @@ export const useGlobalState = createGlobalState( loading, settings, sendMailModel, + announcement, openSettings, showAuth, showAddressCredential, diff --git a/vitepress-docs/docs/en/cli.md b/vitepress-docs/docs/en/cli.md index c6760a70..8c861ffd 100644 --- a/vitepress-docs/docs/en/cli.md +++ b/vitepress-docs/docs/en/cli.md @@ -77,6 +77,7 @@ node_compat = true # TITLE = "Custom Title" # The title of the site PREFIX = "tmp" # The mailbox name prefix to be processed # (min, max) length of the adderss, if not set, the default is (1, 30) +# ANNOUNCEMENT = "Custom Announcement" # MIN_ADDRESS_LEN = 1 # MAX_ADDRESS_LEN = 30 # If you want your site to be private, uncomment below and change your password diff --git a/vitepress-docs/docs/zh/guide/cli/worker.md b/vitepress-docs/docs/zh/guide/cli/worker.md index 357f0469..b3b7b350 100644 --- a/vitepress-docs/docs/zh/guide/cli/worker.md +++ b/vitepress-docs/docs/zh/guide/cli/worker.md @@ -45,6 +45,7 @@ node_compat = true # TITLE = "Custom Title" # 自定义网站标题 PREFIX = "tmp" # 要处理的邮箱名称前缀,不需要后缀可配置为空字符串 # (min, max) adderss的长度,如果不设置,默认为(1, 30) +# ANNOUNCEMENT = "Custom Announcement" # 自定义公告 # MIN_ADDRESS_LEN = 1 # MAX_ADDRESS_LEN = 30 # 如果你想要你的网站私有,取消下面的注释,并修改密码 diff --git a/worker/src/commom_api.ts b/worker/src/commom_api.ts index 488d6648..31585f1a 100644 --- a/worker/src/commom_api.ts +++ b/worker/src/commom_api.ts @@ -1,6 +1,6 @@ import { Hono } from 'hono' -import { getDomains, getPasswords, getBooleanValue, getIntValue, getStringArray, getDefaultDomains } from './utils'; +import { getDomains, getPasswords, getBooleanValue, getIntValue, getStringArray, getDefaultDomains, getStringValue } from './utils'; import { CONSTANTS } from './constants'; import { HonoCustomType } from './types'; import { isS3Enabled } from './mails_api/s3_attachment'; @@ -17,6 +17,7 @@ api.get('/open_api/settings', async (c) => { } return c.json({ "title": c.env.TITLE, + "announcement": getStringValue(c.env.ANNOUNCEMENT), "prefix": c.env.PREFIX, "minAddressLen": getIntValue(c.env.MIN_ADDRESS_LEN, 1), "maxAddressLen": getIntValue(c.env.MAX_ADDRESS_LEN, 30), diff --git a/worker/src/constants.ts b/worker/src/constants.ts index ff1a4a5e..d0a218f5 100644 --- a/worker/src/constants.ts +++ b/worker/src/constants.ts @@ -1,5 +1,5 @@ export const CONSTANTS = { - VERSION: 'v0.6.0', + VERSION: 'v0.6.1', // DB settings ADDRESS_BLOCK_LIST_KEY: 'address_block_list', diff --git a/worker/src/types.d.ts b/worker/src/types.d.ts index 59495e7d..c3dea4d8 100644 --- a/worker/src/types.d.ts +++ b/worker/src/types.d.ts @@ -13,6 +13,7 @@ export type Bindings = { // config TITLE: string | undefined + ANNOUNCEMENT: string | undefined | null PREFIX: string | undefined MIN_ADDRESS_LEN: string | number | undefined MAX_ADDRESS_LEN: string | number | undefined diff --git a/worker/wrangler.toml.template b/worker/wrangler.toml.template index 98f4c968..2334b133 100644 --- a/worker/wrangler.toml.template +++ b/worker/wrangler.toml.template @@ -17,6 +17,7 @@ node_compat = true [vars] # TITLE = "Custom Title" # custom title +# ANNOUNCEMENT = "Custom Announcement" PREFIX = "tmp" # (min, max) length of the adderss, if not set, the default is (1, 30) # MIN_ADDRESS_LEN = 1