mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-04 23:17:34 +08:00
feat: add ANNOUNCEMENT (#357)
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
|
<!-- markdownlint-disable-file MD004 MD024 MD034 MD036 -->
|
||||||
# CHANGE LOG
|
# 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
|
## v0.6.0
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cloudflare_temp_email",
|
"name": "cloudflare_temp_email",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ onMounted(async () => {
|
|||||||
<n-config-provider :locale="localeConfig" :theme="theme">
|
<n-config-provider :locale="localeConfig" :theme="theme">
|
||||||
<n-global-style />
|
<n-global-style />
|
||||||
<n-spin description="loading..." :show="loading">
|
<n-spin description="loading..." :show="loading">
|
||||||
<n-message-provider>
|
<n-message-provider container-style="margin-top: 20px;">
|
||||||
<n-grid x-gap="12" :cols="12">
|
<n-grid x-gap="12" :cols="12">
|
||||||
<n-gi v-if="showSideMargin" span="1"></n-gi>
|
<n-gi v-if="showSideMargin" span="1"></n-gi>
|
||||||
<n-gi :span="!showSideMargin ? 12 : 10">
|
<n-gi :span="!showSideMargin ? 12 : 10">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import axios from 'axios'
|
|||||||
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
const API_BASE = import.meta.env.VITE_API_BASE || "";
|
||||||
const {
|
const {
|
||||||
loading, auth, jwt, settings, openSettings,
|
loading, auth, jwt, settings, openSettings,
|
||||||
userOpenSettings, userSettings,
|
userOpenSettings, userSettings, announcement,
|
||||||
showAuth, adminAuth, showAdminAuth, userJwt
|
showAuth, adminAuth, showAdminAuth, userJwt
|
||||||
} = useGlobalState();
|
} = useGlobalState();
|
||||||
|
|
||||||
@@ -56,6 +56,7 @@ const getOpenSettings = async (message) => {
|
|||||||
const res = await api.fetch("/open_api/settings");
|
const res = await api.fetch("/open_api/settings");
|
||||||
const domainLabels = res["domainLabels"] || [];
|
const domainLabels = res["domainLabels"] || [];
|
||||||
Object.assign(openSettings.value, {
|
Object.assign(openSettings.value, {
|
||||||
|
...res,
|
||||||
title: res["title"] || "",
|
title: res["title"] || "",
|
||||||
prefix: res["prefix"] || "",
|
prefix: res["prefix"] || "",
|
||||||
minAddressLen: res["minAddressLen"] || 1,
|
minAddressLen: res["minAddressLen"] || 1,
|
||||||
@@ -81,6 +82,14 @@ const getOpenSettings = async (message) => {
|
|||||||
if (openSettings.value.needAuth) {
|
if (openSettings.value.needAuth) {
|
||||||
showAuth.value = true;
|
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) {
|
} catch (error) {
|
||||||
message.error(error.message || "error");
|
message.error(error.message || "error");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import { ref } from "vue";
|
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(
|
export const useGlobalState = createGlobalState(
|
||||||
() => {
|
() => {
|
||||||
const isDark = useDark()
|
const isDark = useDark()
|
||||||
const toggleDark = useToggle(isDark)
|
const toggleDark = useToggle(isDark)
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
const announcement = useLocalStorage('announcement', '');
|
||||||
const openSettings = ref({
|
const openSettings = ref({
|
||||||
title: '',
|
title: '',
|
||||||
|
announcement: '',
|
||||||
prefix: '',
|
prefix: '',
|
||||||
needAuth: false,
|
needAuth: false,
|
||||||
adminContact: '',
|
adminContact: '',
|
||||||
@@ -83,6 +85,7 @@ export const useGlobalState = createGlobalState(
|
|||||||
loading,
|
loading,
|
||||||
settings,
|
settings,
|
||||||
sendMailModel,
|
sendMailModel,
|
||||||
|
announcement,
|
||||||
openSettings,
|
openSettings,
|
||||||
showAuth,
|
showAuth,
|
||||||
showAddressCredential,
|
showAddressCredential,
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ node_compat = true
|
|||||||
# TITLE = "Custom Title" # The title of the site
|
# TITLE = "Custom Title" # The title of the site
|
||||||
PREFIX = "tmp" # The mailbox name prefix to be processed
|
PREFIX = "tmp" # The mailbox name prefix to be processed
|
||||||
# (min, max) length of the adderss, if not set, the default is (1, 30)
|
# (min, max) length of the adderss, if not set, the default is (1, 30)
|
||||||
|
# ANNOUNCEMENT = "Custom Announcement"
|
||||||
# MIN_ADDRESS_LEN = 1
|
# MIN_ADDRESS_LEN = 1
|
||||||
# MAX_ADDRESS_LEN = 30
|
# MAX_ADDRESS_LEN = 30
|
||||||
# If you want your site to be private, uncomment below and change your password
|
# If you want your site to be private, uncomment below and change your password
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ node_compat = true
|
|||||||
# TITLE = "Custom Title" # 自定义网站标题
|
# TITLE = "Custom Title" # 自定义网站标题
|
||||||
PREFIX = "tmp" # 要处理的邮箱名称前缀,不需要后缀可配置为空字符串
|
PREFIX = "tmp" # 要处理的邮箱名称前缀,不需要后缀可配置为空字符串
|
||||||
# (min, max) adderss的长度,如果不设置,默认为(1, 30)
|
# (min, max) adderss的长度,如果不设置,默认为(1, 30)
|
||||||
|
# ANNOUNCEMENT = "Custom Announcement" # 自定义公告
|
||||||
# MIN_ADDRESS_LEN = 1
|
# MIN_ADDRESS_LEN = 1
|
||||||
# MAX_ADDRESS_LEN = 30
|
# MAX_ADDRESS_LEN = 30
|
||||||
# 如果你想要你的网站私有,取消下面的注释,并修改密码
|
# 如果你想要你的网站私有,取消下面的注释,并修改密码
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Hono } from 'hono'
|
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 { CONSTANTS } from './constants';
|
||||||
import { HonoCustomType } from './types';
|
import { HonoCustomType } from './types';
|
||||||
import { isS3Enabled } from './mails_api/s3_attachment';
|
import { isS3Enabled } from './mails_api/s3_attachment';
|
||||||
@@ -17,6 +17,7 @@ api.get('/open_api/settings', async (c) => {
|
|||||||
}
|
}
|
||||||
return c.json({
|
return c.json({
|
||||||
"title": c.env.TITLE,
|
"title": c.env.TITLE,
|
||||||
|
"announcement": getStringValue(c.env.ANNOUNCEMENT),
|
||||||
"prefix": c.env.PREFIX,
|
"prefix": c.env.PREFIX,
|
||||||
"minAddressLen": getIntValue(c.env.MIN_ADDRESS_LEN, 1),
|
"minAddressLen": getIntValue(c.env.MIN_ADDRESS_LEN, 1),
|
||||||
"maxAddressLen": getIntValue(c.env.MAX_ADDRESS_LEN, 30),
|
"maxAddressLen": getIntValue(c.env.MAX_ADDRESS_LEN, 30),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const CONSTANTS = {
|
export const CONSTANTS = {
|
||||||
VERSION: 'v0.6.0',
|
VERSION: 'v0.6.1',
|
||||||
|
|
||||||
// DB settings
|
// DB settings
|
||||||
ADDRESS_BLOCK_LIST_KEY: 'address_block_list',
|
ADDRESS_BLOCK_LIST_KEY: 'address_block_list',
|
||||||
|
|||||||
Vendored
+1
@@ -13,6 +13,7 @@ export type Bindings = {
|
|||||||
|
|
||||||
// config
|
// config
|
||||||
TITLE: string | undefined
|
TITLE: string | undefined
|
||||||
|
ANNOUNCEMENT: string | undefined | null
|
||||||
PREFIX: string | undefined
|
PREFIX: string | undefined
|
||||||
MIN_ADDRESS_LEN: string | number | undefined
|
MIN_ADDRESS_LEN: string | number | undefined
|
||||||
MAX_ADDRESS_LEN: string | number | undefined
|
MAX_ADDRESS_LEN: string | number | undefined
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ node_compat = true
|
|||||||
|
|
||||||
[vars]
|
[vars]
|
||||||
# TITLE = "Custom Title" # custom title
|
# TITLE = "Custom Title" # custom title
|
||||||
|
# ANNOUNCEMENT = "Custom Announcement"
|
||||||
PREFIX = "tmp"
|
PREFIX = "tmp"
|
||||||
# (min, max) length of the adderss, if not set, the default is (1, 30)
|
# (min, max) length of the adderss, if not set, the default is (1, 30)
|
||||||
# MIN_ADDRESS_LEN = 1
|
# MIN_ADDRESS_LEN = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user