🔀 merge: main into develop
This commit is contained in:
commit
830c18c9e4
81
CHANGELOG.md
81
CHANGELOG.md
@ -19,6 +19,87 @@ This document records all notable changes to ShadCN Admin.
|
||||
---
|
||||
|
||||
|
||||
## [1.3.6](https://github.com/perfect-panel/frontend/compare/v1.3.5...v1.3.6) (2025-12-30)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Update server and web version update descriptions to remove version prefix for clarity ([cbd6e29](https://github.com/perfect-panel/frontend/commit/cbd6e29deda1c7a913fae4edb169e0a0a43a3dd9))
|
||||
|
||||
## [1.3.5](https://github.com/perfect-panel/frontend/compare/v1.3.4...v1.3.5) (2025-12-30)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Update getUserSubscribe function to accept short and token parameters for improved URL generation ([39ebd09](https://github.com/perfect-panel/frontend/commit/39ebd09f0989b37308c1c803d8e380f967ab0db5))
|
||||
|
||||
## [1.3.4](https://github.com/perfect-panel/frontend/compare/v1.3.3...v1.3.4) (2025-12-29)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Only update internalValue in MonacoEditor if propValue has changed ([fe14002](https://github.com/perfect-panel/frontend/commit/fe1400235967f2ad0c1ffbc05d9e15bab370c664))
|
||||
* Set modal prop to false for DropdownMenu in multiple components for improved user experience ([0253b62](https://github.com/perfect-panel/frontend/commit/0253b62b6365476591121b6f18dcb3f3261cb4ff))
|
||||
* Update HTMLEditor onChange event and set DropdownMenu modal to false for better user experience ([ba65588](https://github.com/perfect-panel/frontend/commit/ba65588fdfcfba146cd76bfe7d14e053291f5926))
|
||||
* Update SendCode parameters to use form.watch for email and telephone fields ([51a98af](https://github.com/perfect-panel/frontend/commit/51a98afcae2c8b83c7176898ad8ac2c8b11ad3d9))
|
||||
|
||||
## [1.3.3](https://github.com/perfect-panel/frontend/compare/v1.3.2...v1.3.3) (2025-12-29)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Update user_subscribe_id reference in RowMoreActions to use row.id for correct token reset and status toggle ([2156a7f](https://github.com/perfect-panel/frontend/commit/2156a7f1df52970b5ab0816dd1da5dc7cefc1dae))
|
||||
|
||||
## [1.3.2](https://github.com/perfect-panel/frontend/compare/v1.3.1...v1.3.2) (2025-12-29)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Refactor update dialog logic in SystemVersionCard for better clarity and handling of update states ([0690deb](https://github.com/perfect-panel/frontend/commit/0690debf6c1bab7472468c742f9b15639f904c20))
|
||||
* Update default inventory value in SubscribeForm to -1 for better handling of inventory state ([2f50c6d](https://github.com/perfect-panel/frontend/commit/2f50c6df3345e26bc92f5730bc8b891d0515a367))
|
||||
|
||||
## [1.3.1](https://github.com/perfect-panel/frontend/compare/v1.3.0...v1.3.1) (2025-12-29)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* : Update localization files and improve display logic for inventory handling ([83d821a](https://github.com/perfect-panel/frontend/commit/83d821a2dc24d97838af43ab610b65ff0d0d0d15))
|
||||
* Update quantity handling in Purchase and Renewal components based on showOriginalPrice prop ([a274607](https://github.com/perfect-panel/frontend/commit/a2746073a636706b0e214eca84055735417680f3))
|
||||
* Update SubscribeTable to display inventory using Display component for better clarity ([cc52e36](https://github.com/perfect-panel/frontend/commit/cc52e3614d9b6723f4ce8ab6385d626f0fcc54d7))
|
||||
|
||||
## [1.3.0](https://github.com/perfect-panel/frontend/compare/v1.2.4...v1.3.0) (2025-12-29)
|
||||
|
||||
### ✨ Features / 新功能
|
||||
|
||||
* Add original price display option and enhance inventory messages in subscription components ([543a7b9](https://github.com/perfect-panel/frontend/commit/543a7b9eb9b2cd278a70f668b0a0e0e9e261fe57))
|
||||
* Added localized support for user subscription and deletion status, and optimized the subscription form and user interface. ([9f95cec](https://github.com/perfect-panel/frontend/commit/9f95cec876c9ac8bf00a6ca12a5c40243c7171af))
|
||||
* Added reset and pause subscription functionality, and updated the status display. ([bc451ee](https://github.com/perfect-panel/frontend/commit/bc451eea16b51f1ab81b6cacf65201886866e1cc))
|
||||
* Added the option to restore subscription, and updated the relevant description and confirmation information. ([5f5c339](https://github.com/perfect-panel/frontend/commit/5f5c33987e54533c5348223b3cebe31aef91aa25))
|
||||
* Enhance DatePicker component with clear button and improved value handling ([b27b928](https://github.com/perfect-panel/frontend/commit/b27b9287be0eb26fe5d5189b618a32db340c506c))
|
||||
* Refactor SubscriptionForm layout for improved readability and maintainability ([f432ba0](https://github.com/perfect-panel/frontend/commit/f432ba06f9d3a86ec00bfd316d1c020ddf779de6))
|
||||
* Update API proxy target to use environment variable for improved configurability ([8d514df](https://github.com/perfect-panel/frontend/commit/8d514dfd8f0a8fb9acc97a288addd1b1cbc882b8))
|
||||
* Update queryKey structure in Purchase and Renewal components for improved order creation ([9559e00](https://github.com/perfect-panel/frontend/commit/9559e003b7821303f7d0ac7f4da5fae4bf1ccad4))
|
||||
* Update Vite configuration to load environment variables for improved API proxy setup ([d36a2c9](https://github.com/perfect-panel/frontend/commit/d36a2c902b7943441282278009c5e5210d30c746))
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Replace tag removal icon with a button for better accessibility and event handling ([3751f64](https://github.com/perfect-panel/frontend/commit/3751f64f73cd70eaddd44cb650dd38949f0ca069))
|
||||
* Uncomment navigation to dashboard for authenticated users ([4d15b2b](https://github.com/perfect-panel/frontend/commit/4d15b2b6fc8f0d178c7c749aa9e1d9826bb706f8))
|
||||
|
||||
### 📚 Documentation / 文档更新
|
||||
|
||||
* Update default administrator account information and security recommendations in installation guides ([7279275](https://github.com/perfect-panel/frontend/commit/7279275532ad0b73994ffe5cf2e4c2f8dabc280b))
|
||||
|
||||
## [1.2.4](https://github.com/perfect-panel/frontend/compare/v1.2.3...v1.2.4) (2025-12-28)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
* Add onSuccess callback to Unsubscribe component and conditionally render Renewal component ([7b5367a](https://github.com/perfect-panel/frontend/commit/7b5367a9a99ac8ae608a765b79a66c1f7380dcd8))
|
||||
* Remove the system log dialog component from the system version card ([71cb827](https://github.com/perfect-panel/frontend/commit/71cb827918ee3250f0c9d06d46d876ce6799b8ac))
|
||||
* Update invite link format in auth forms and sidebar to include hash fragment for routing. ([7a8c010](https://github.com/perfect-panel/frontend/commit/7a8c0102958a859c9e7476810d5c9b822f882692))
|
||||
|
||||
### 📚 Documentation / 文档更新
|
||||
|
||||
* Add one-click installation script for PPanel with Docker support ([912c5c4](https://github.com/perfect-panel/frontend/commit/912c5c4cb63eeb0ecbc33bef6b31bd50d83d6491))
|
||||
|
||||
### 🔧 Chores / 其他变更
|
||||
|
||||
* **release:** Release 1.2.4-dev.1 / 发布版本 1.2.4-dev.1 [skip ci] ([62d45bb](https://github.com/perfect-panel/frontend/commit/62d45bbac17fab9656c1cce029a379ce8bb757d6))
|
||||
|
||||
## [1.2.4-dev.1](https://github.com/perfect-panel/frontend/compare/v1.2.3...v1.2.4-dev.1) (2025-12-22)
|
||||
|
||||
### 🐛 Bug Fixes / 问题修复
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
"60003": "An existing subscription is detected. Please cancel it before proceeding.",
|
||||
"60004": "Unable to delete at the moment as the subscription has active users.",
|
||||
"60005": "Single subscription mode has exceeded user limit",
|
||||
"60006": "User quota limit has been reached, unable to continue.",
|
||||
"60007": "Insufficient inventory, please try again later or contact the administrator.",
|
||||
"70001": "Incorrect verification code, please re-enter.",
|
||||
"80001": "Task was not successfully queued, please try again later.",
|
||||
"90001": "Please disable DEBUG mode and try again.",
|
||||
@ -61,5 +63,5 @@
|
||||
"system": "System",
|
||||
"toggle": "Toggle theme"
|
||||
},
|
||||
"unlimited": "unlimited"
|
||||
"unlimited": "Unlimited"
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
"discountPercent": "Discount Percentage",
|
||||
"Hour": "Hour",
|
||||
"inventory": "Subscription Limit",
|
||||
"unlimitedInventory": "Unlimited (enter -1)",
|
||||
"language": "Language",
|
||||
"languageDescription": "Leave empty for default without language restriction",
|
||||
"languagePlaceholder": "Language identifier for the subscription, e.g., en-US, zh-CN",
|
||||
@ -56,6 +57,8 @@
|
||||
"resetOn1st": "Reset on the 1st",
|
||||
"selectResetCycle": "Please select a reset cycle",
|
||||
"selectUnitTime": "Please select a unit of time",
|
||||
"showOriginalPrice": "Show Original Price",
|
||||
"showOriginalPriceDescription": "When enabled, the subscription card will display both the original price and the discounted price to help users understand the discount amount",
|
||||
"speedLimit": "Speed Limit ",
|
||||
"traffic": "Traffic",
|
||||
"unitPrice": "Unit Price",
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
"systemServices": "System Services",
|
||||
"update": "Update",
|
||||
"updateFailed": "Update failed",
|
||||
"updateServerDescription": "Are you sure you want to update the server version from V{{current}} to V{{latest}}?",
|
||||
"updateServerDescription": "Are you sure you want to update the server version from {{current}} to {{latest}}?",
|
||||
"updateSuccess": "Update completed successfully",
|
||||
"updateWebDescription": "Are you sure you want to update the web version from V{{current}} to V{{latest}}?",
|
||||
"updateWebDescription": "Are you sure you want to update the web version from {{current}} to {{latest}}?",
|
||||
"userUpdateSuccess": "User updated successfully",
|
||||
"webVersion": "Web Version"
|
||||
}
|
||||
|
||||
@ -25,9 +25,11 @@
|
||||
"createSuccess": "Created successfully",
|
||||
"createUser": "Create User",
|
||||
"delete": "Delete",
|
||||
"deleted": "Deleted",
|
||||
"deleteDescription": "This action cannot be undone.",
|
||||
"deleteSubscriptionDescription": "This action cannot be undone.",
|
||||
"deleteSuccess": "Deleted successfully",
|
||||
"isDeleted": "Status",
|
||||
"deviceLimit": "Device Limit",
|
||||
"download": "Download",
|
||||
"downloadTraffic": "Download Traffic",
|
||||
@ -51,6 +53,7 @@
|
||||
"loginStatus": "Login Status",
|
||||
"manager": "Administrator",
|
||||
"more": "More",
|
||||
"normal": "Normal",
|
||||
"notifySettingsTitle": "Notify Settings",
|
||||
"offline": "Offline",
|
||||
"online": "Online",
|
||||
@ -80,6 +83,25 @@
|
||||
"toggleSubscriptionStatus": "Toggle Status",
|
||||
"toggleSubscriptionStatusDescription": "This will toggle the subscription status.",
|
||||
"resetTime": "Reset Time",
|
||||
"resetToken": "Reset Subscription Address",
|
||||
"resetTokenDescription": "This will reset the subscription address and regenerate a new token.",
|
||||
"resetTokenSuccess": "Subscription address reset successfully",
|
||||
"confirmResetToken": "Confirm Reset Subscription Address",
|
||||
"stopSubscribe": "Stop Subscription",
|
||||
"stopSubscribeDescription": "This will stop the subscription temporarily. User will not be able to use it.",
|
||||
"stopSubscribeSuccess": "Subscription stopped successfully",
|
||||
"confirmStopSubscribe": "Confirm Stop Subscription",
|
||||
"resumeSubscribe": "Resume Subscription",
|
||||
"resumeSubscribeDescription": "This will resume the subscription and allow the user to use it.",
|
||||
"resumeSubscribeSuccess": "Subscription resumed successfully",
|
||||
"confirmResumeSubscribe": "Confirm Resume Subscription",
|
||||
"status": "Status",
|
||||
"statusPending": "Pending",
|
||||
"statusActive": "Active",
|
||||
"statusFinished": "Finished",
|
||||
"statusExpired": "Expired",
|
||||
"statusDeducted": "Deducted",
|
||||
"statusStopped": "Stopped",
|
||||
"save": "Save",
|
||||
"speedLimit": "Speed Limit",
|
||||
"startTime": "startTime",
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
"60003": "检测到现有订阅,请先取消后再继续。",
|
||||
"60004": "由于订阅有活跃用户,暂时无法删除。",
|
||||
"60005": "单一订阅模式已超过用户限制",
|
||||
"60006": "用户配额已达到限制,无法继续操作。",
|
||||
"60007": "库存不足,请稍后再试或联系管理员。",
|
||||
"70001": "验证码不正确,请重新输入。",
|
||||
"80001": "任务未成功加入队列,请稍后再试。",
|
||||
"90001": "请禁用 DEBUG 模式后再试。",
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
"discountPercent": "折扣百分比",
|
||||
"Hour": "小时",
|
||||
"inventory": "订阅库存",
|
||||
"unlimitedInventory": "无限制(输入 -1)",
|
||||
"language": "语言",
|
||||
"languageDescription": "留空为默认无语言限制",
|
||||
"languagePlaceholder": "订阅的语言标识符,例如 en-US、zh-CN",
|
||||
@ -56,6 +57,8 @@
|
||||
"resetOn1st": "每月1日重置",
|
||||
"selectResetCycle": "请选择重置周期",
|
||||
"selectUnitTime": "请选择时间单位",
|
||||
"showOriginalPrice": "显示原价",
|
||||
"showOriginalPriceDescription": "开启后,在订阅卡片上将会显示原价和折后价,帮助用户了解优惠幅度",
|
||||
"speedLimit": "速度限制",
|
||||
"traffic": "流量",
|
||||
"unitPrice": "单价",
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
"systemServices": "系统服务",
|
||||
"update": "更新",
|
||||
"updateFailed": "更新失败",
|
||||
"updateServerDescription": "确定要将服务器版本从 V{{current}} 更新到 V{{latest}} 吗?",
|
||||
"updateServerDescription": "确定要将服务器版本从 {{current}} 更新到 {{latest}} 吗?",
|
||||
"updateSuccess": "更新成功",
|
||||
"updateWebDescription": "确定要将前端版本从 V{{current}} 更新到 V{{latest}} 吗?",
|
||||
"updateWebDescription": "确定要将前端版本从 {{current}} 更新到 {{latest}} 吗?",
|
||||
"userUpdateSuccess": "用户端更新成功",
|
||||
"webVersion": "前端版本"
|
||||
}
|
||||
|
||||
@ -25,9 +25,11 @@
|
||||
"createSuccess": "创建成功",
|
||||
"createUser": "创建用户",
|
||||
"delete": "删除",
|
||||
"deleted": "已删除",
|
||||
"deleteDescription": "此操作无法撤销。",
|
||||
"deleteSubscriptionDescription": "此操作无法撤销。",
|
||||
"deleteSuccess": "删除成功",
|
||||
"isDeleted": "状态",
|
||||
"deviceLimit": "IP限制",
|
||||
"download": "下载",
|
||||
"downloadTraffic": "下载流量",
|
||||
@ -51,6 +53,7 @@
|
||||
"loginStatus": "登录状态",
|
||||
"manager": "管理员",
|
||||
"more": "更多",
|
||||
"normal": "正常",
|
||||
"notifySettingsTitle": "通知设置",
|
||||
"offline": "离线",
|
||||
"online": "在线",
|
||||
@ -80,6 +83,25 @@
|
||||
"toggleSubscriptionStatus": "切换状态",
|
||||
"toggleSubscriptionStatusDescription": "将切换该订阅的启用/停用状态。",
|
||||
"resetTime": "重置时间",
|
||||
"resetToken": "重置订阅地址",
|
||||
"resetTokenDescription": "这将重置订阅地址并重新生成新的令牌。",
|
||||
"resetTokenSuccess": "订阅地址重置成功",
|
||||
"confirmResetToken": "确认重置订阅地址",
|
||||
"stopSubscribe": "暂停订阅",
|
||||
"stopSubscribeDescription": "这将暂时停止订阅。用户将无法使用。",
|
||||
"stopSubscribeSuccess": "订阅已暂停",
|
||||
"confirmStopSubscribe": "确认暂停订阅",
|
||||
"resumeSubscribe": "恢复订阅",
|
||||
"resumeSubscribeDescription": "这将恢复订阅,允许用户继续使用。",
|
||||
"resumeSubscribeSuccess": "订阅已恢复",
|
||||
"confirmResumeSubscribe": "确认恢复订阅",
|
||||
"status": "状态",
|
||||
"statusPending": "待处理",
|
||||
"statusActive": "活跃",
|
||||
"statusFinished": "已完成",
|
||||
"statusExpired": "已过期",
|
||||
"statusDeducted": "已扣除",
|
||||
"statusStopped": "已停止",
|
||||
"save": "保存",
|
||||
"speedLimit": "速度限制",
|
||||
"startTime": "开始时间",
|
||||
|
||||
@ -28,7 +28,7 @@ export function Display<T extends number | undefined | null>({
|
||||
if (
|
||||
["traffic", "trafficSpeed", "number"].includes(type) &&
|
||||
unlimited &&
|
||||
!value
|
||||
(value === 0 || value === null || value === undefined)
|
||||
) {
|
||||
return t("unlimited");
|
||||
}
|
||||
@ -42,7 +42,7 @@ export function Display<T extends number | undefined | null>({
|
||||
}
|
||||
|
||||
if (type === "number") {
|
||||
return value ? value.toString() : "0";
|
||||
return value !== null && value !== undefined ? value.toString() : "0";
|
||||
}
|
||||
|
||||
return "0";
|
||||
|
||||
@ -538,7 +538,7 @@ export default function EmailSettingsForm() {
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<HTMLEditor
|
||||
onBlur={field.onChange}
|
||||
onChange={field.onChange}
|
||||
placeholder={t(
|
||||
"email.inputPlaceholder",
|
||||
"Please enter"
|
||||
@ -642,7 +642,7 @@ export default function EmailSettingsForm() {
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<HTMLEditor
|
||||
onBlur={field.onChange}
|
||||
onChange={field.onChange}
|
||||
placeholder={t(
|
||||
"email.inputPlaceholder",
|
||||
"Please enter"
|
||||
@ -713,7 +713,7 @@ export default function EmailSettingsForm() {
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<HTMLEditor
|
||||
onBlur={field.onChange}
|
||||
onChange={field.onChange}
|
||||
placeholder={t(
|
||||
"email.inputPlaceholder",
|
||||
"Please enter"
|
||||
@ -795,7 +795,7 @@ export default function EmailSettingsForm() {
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<HTMLEditor
|
||||
onBlur={field.onChange}
|
||||
onChange={field.onChange}
|
||||
placeholder={t(
|
||||
"email.inputPlaceholder",
|
||||
"Please enter"
|
||||
|
||||
@ -179,7 +179,7 @@ export default function RegisterForm({
|
||||
/>
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
email: form.watch("email"),
|
||||
type: 1,
|
||||
}}
|
||||
type="email"
|
||||
|
||||
@ -98,7 +98,7 @@ export default function ResetForm({
|
||||
/>
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
email: form.watch("email"),
|
||||
type: 2,
|
||||
}}
|
||||
type="email"
|
||||
|
||||
@ -15,7 +15,7 @@ export default function Auth() {
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
// navigate({ to: "/dashboard" });
|
||||
navigate({ to: "/dashboard" });
|
||||
}
|
||||
}, [navigate, user]);
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ export default function SystemVersionCard() {
|
||||
queryFn: async () => {
|
||||
const { data } = await basicCheckServiceVersion(
|
||||
{
|
||||
service_name: "admin",
|
||||
service_name: "admin-web-with-api",
|
||||
secret: moduleConfig!.secret,
|
||||
},
|
||||
{ skipErrorHandler: true }
|
||||
@ -105,13 +105,13 @@ export default function SystemVersionCard() {
|
||||
setIsUpdatingWeb(true);
|
||||
try {
|
||||
await basicUpdateService({
|
||||
service_name: "admin",
|
||||
service_name: "admin-web-with-api",
|
||||
secret: moduleConfig.secret,
|
||||
});
|
||||
toast.success(t("adminUpdateSuccess", "Admin updated successfully"));
|
||||
|
||||
await basicUpdateService({
|
||||
service_name: "user",
|
||||
service_name: "user-web-with-api",
|
||||
secret: moduleConfig.secret,
|
||||
});
|
||||
toast.success(t("userUpdateSuccess", "User updated successfully"));
|
||||
@ -188,17 +188,18 @@ export default function SystemVersionCard() {
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<Badge>V{packageJson.version}</Badge>
|
||||
{hasWebNewVersion && webVersionInfo && (
|
||||
<AlertDialog onOpenChange={setOpenUpdateWeb} open={openUpdateWeb}>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
className="h-6 px-2 text-xs"
|
||||
disabled={isUpdatingWeb}
|
||||
disabled={!hasWebNewVersion || isUpdatingWeb}
|
||||
size="sm"
|
||||
variant="outline"
|
||||
>
|
||||
<Icon className="mr-1 h-3 w-3" icon="mdi:download" />
|
||||
{t("update", "Update")} V{webVersionInfo.latest_version}
|
||||
{hasWebNewVersion && webVersionInfo
|
||||
? `${t("update", "Update")} ${webVersionInfo.latest_version}`
|
||||
: t("update", "Update")}
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
@ -207,33 +208,32 @@ export default function SystemVersionCard() {
|
||||
{t("confirmUpdate", "Confirm Update")}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{t(
|
||||
{webVersionInfo
|
||||
? t(
|
||||
"updateWebDescription",
|
||||
"Are you sure you want to update the web version from V{{current}} to V{{latest}}?",
|
||||
"Are you sure you want to update the web version from {{current}} to {{latest}}?",
|
||||
{
|
||||
current: packageJson.version,
|
||||
current: webVersionInfo.current_version,
|
||||
latest: webVersionInfo.latest_version,
|
||||
}
|
||||
)
|
||||
: t(
|
||||
"updateDescription",
|
||||
"Are you sure you want to update?"
|
||||
)}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>
|
||||
{t("cancel", "Cancel")}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogCancel>{t("cancel", "Cancel")}</AlertDialogCancel>
|
||||
<Button disabled={isUpdatingWeb} onClick={handleUpdateWeb}>
|
||||
{isUpdatingWeb && (
|
||||
<Icon
|
||||
className="mr-2 animate-spin"
|
||||
icon="mdi:loading"
|
||||
/>
|
||||
<Icon className="mr-2 animate-spin" icon="mdi:loading" />
|
||||
)}
|
||||
{t("confirmUpdate", "Confirm Update")}
|
||||
</Button>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -251,7 +251,6 @@ export default function SystemVersionCard() {
|
||||
serverVersionInfo?.current_version ||
|
||||
"1.0.0"}
|
||||
</Badge>
|
||||
{hasServerNewVersion && serverVersionInfo && moduleConfig && (
|
||||
<AlertDialog
|
||||
onOpenChange={setOpenUpdateServer}
|
||||
open={openUpdateServer}
|
||||
@ -259,12 +258,14 @@ export default function SystemVersionCard() {
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button
|
||||
className="h-6 px-2 text-xs"
|
||||
disabled={isUpdatingServer}
|
||||
disabled={!hasServerNewVersion || isUpdatingServer}
|
||||
size="sm"
|
||||
variant="outline"
|
||||
>
|
||||
<Icon className="mr-1 h-3 w-3" icon="mdi:download" />
|
||||
{t("update", "Update")} V{serverVersionInfo.latest_version}
|
||||
{hasServerNewVersion && serverVersionInfo
|
||||
? `${t("update", "Update")} ${serverVersionInfo.latest_version}`
|
||||
: t("update", "Update")}
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
@ -273,40 +274,40 @@ export default function SystemVersionCard() {
|
||||
{t("confirmUpdate", "Confirm Update")}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{t(
|
||||
{serverVersionInfo && moduleConfig
|
||||
? t(
|
||||
"updateServerDescription",
|
||||
"Are you sure you want to update the server version from V{{current}} to V{{latest}}?",
|
||||
"Are you sure you want to update the server version from {{current}} to {{latest}}?",
|
||||
{
|
||||
current:
|
||||
moduleConfig.service_version ||
|
||||
serverVersionInfo.current_version,
|
||||
latest: serverVersionInfo.latest_version,
|
||||
}
|
||||
)
|
||||
: t(
|
||||
"updateDescription",
|
||||
"Are you sure you want to update?"
|
||||
)}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>
|
||||
{t("cancel", "Cancel")}
|
||||
</AlertDialogCancel>
|
||||
<AlertDialogCancel>{t("cancel", "Cancel")}</AlertDialogCancel>
|
||||
<Button
|
||||
disabled={isUpdatingServer}
|
||||
disabled={isUpdatingServer || !moduleConfig}
|
||||
onClick={() =>
|
||||
moduleConfig &&
|
||||
updateServerMutation.mutate(moduleConfig.service_name)
|
||||
}
|
||||
>
|
||||
{isUpdatingServer && (
|
||||
<Icon
|
||||
className="mr-2 animate-spin"
|
||||
icon="mdi:loading"
|
||||
/>
|
||||
<Icon className="mr-2 animate-spin" icon="mdi:loading" />
|
||||
)}
|
||||
{t("confirmUpdate", "Confirm Update")}
|
||||
</Button>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
@ -63,7 +63,7 @@ interface SubscribeFormProps<T> {
|
||||
}
|
||||
|
||||
const defaultValues = {
|
||||
inventory: 0,
|
||||
inventory: -1,
|
||||
speed_limit: 0,
|
||||
device_limit: 0,
|
||||
traffic: 0,
|
||||
@ -278,7 +278,7 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
{trigger}
|
||||
</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent className="w-[800px] max-w-full gap-0 md:max-w-screen-md">
|
||||
<SheetContent className="w-[800px] max-w-full gap-0 md:max-w-3xl">
|
||||
<SheetHeader>
|
||||
<SheetTitle>{title}</SheetTitle>
|
||||
</SheetHeader>
|
||||
@ -446,11 +446,10 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
<FormLabel>{t("form.inventory")}</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
min={0}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
placeholder={t("form.noLimit")}
|
||||
placeholder={t("form.unlimitedInventory")}
|
||||
step={1}
|
||||
type="number"
|
||||
value={field.value}
|
||||
@ -901,6 +900,33 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="show_original_price"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-0.5">
|
||||
<FormLabel>
|
||||
{t("form.showOriginalPrice")}
|
||||
</FormLabel>
|
||||
<FormDescription>
|
||||
{t("form.showOriginalPriceDescription")}
|
||||
</FormDescription>
|
||||
</div>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={!!field.value}
|
||||
onCheckedChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
</div>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
|
||||
@ -208,15 +208,14 @@ export default function SubscribeTable() {
|
||||
{
|
||||
accessorKey: "inventory",
|
||||
header: t("inventory"),
|
||||
cell: ({ row }) => (
|
||||
<Display
|
||||
type="number"
|
||||
unlimited
|
||||
value={
|
||||
row.getValue("inventory") === -1 ? 0 : row.getValue("inventory")
|
||||
}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }) => {
|
||||
const inventory = row.getValue("inventory") as number;
|
||||
return inventory === -1 ? (
|
||||
<Display type="number" unlimited value={0} />
|
||||
) : (
|
||||
<Display type="number" unlimited value={inventory} />
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "quota",
|
||||
|
||||
@ -98,7 +98,7 @@ function DynamicField({
|
||||
field.generate ? (
|
||||
field.generate.functions &&
|
||||
field.generate.functions.length > 0 ? (
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button size="sm" type="button" variant="ghost">
|
||||
<Icon className="h-4 w-4" icon="mdi:key" />
|
||||
|
||||
@ -92,7 +92,7 @@ export default function User() {
|
||||
<Button variant="destructive">{t("delete", "Delete")}</Button>
|
||||
}
|
||||
/>,
|
||||
<DropdownMenu key="more">
|
||||
<DropdownMenu key="more" modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline">{t("more", "More")}</Button>
|
||||
</DropdownMenuTrigger>
|
||||
@ -176,6 +176,18 @@ export default function User() {
|
||||
accessorKey: "id",
|
||||
header: "ID",
|
||||
},
|
||||
{
|
||||
accessorKey: "deleted_at",
|
||||
header: t("isDeleted", "Deleted"),
|
||||
cell: ({ row }) => {
|
||||
const deletedAt = row.getValue("deleted_at") as number | undefined;
|
||||
return deletedAt ? (
|
||||
<Badge variant="destructive">{t("deleted", "Deleted")}</Badge>
|
||||
) : (
|
||||
<Badge variant="outline">{t("normal", "Normal")}</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "auth_methods",
|
||||
header: t("userName", "Username"),
|
||||
@ -371,16 +383,13 @@ function SubscriptionSheet({ userId }: { userId: number }) {
|
||||
<SheetTrigger asChild>
|
||||
<Button variant="secondary">{t("subscription", "Subscription")}</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent
|
||||
className="w-[1000px] max-w-full md:max-w-screen-xl"
|
||||
side="right"
|
||||
>
|
||||
<SheetContent className="w-[1000px] max-w-full md:max-w-7xl" side="right">
|
||||
<SheetHeader>
|
||||
<SheetTitle>
|
||||
{t("subscriptionList", "Subscription List")} · ID: {userId}
|
||||
</SheetTitle>
|
||||
</SheetHeader>
|
||||
<div className="mt-2">
|
||||
<div className="mt-2 px-4">
|
||||
<UserSubscription userId={userId} />
|
||||
</div>
|
||||
</SheetContent>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import { Badge } from "@workspace/ui/components/badge";
|
||||
import { Button } from "@workspace/ui/components/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
@ -16,7 +17,6 @@ import {
|
||||
deleteUserSubscribe,
|
||||
getUserSubscribe,
|
||||
resetUserSubscribeToken,
|
||||
resetUserSubscribeTraffic,
|
||||
toggleUserSubscribeStatus,
|
||||
updateUserSubscribe,
|
||||
} from "@workspace/ui/services/admin/user";
|
||||
@ -33,7 +33,6 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
const { t } = useTranslation("user");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const ref = useRef<ProTableActions>(null);
|
||||
const { getUserSubscribe: getUserSubscribeUrls } = useGlobalStore();
|
||||
|
||||
return (
|
||||
<ProTable<API.UserSubscribe, Record<string, unknown>>
|
||||
@ -59,100 +58,14 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
title={t("editSubscription", "Edit Subscription")}
|
||||
trigger={t("edit", "Edit")}
|
||||
/>,
|
||||
<Button
|
||||
key="copy"
|
||||
onClick={async () => {
|
||||
await navigator.clipboard.writeText(
|
||||
getUserSubscribeUrls(row.token)[0] || ""
|
||||
);
|
||||
toast.success(t("copySuccess", "Copied successfully"));
|
||||
}}
|
||||
variant="secondary"
|
||||
>
|
||||
{t("copySubscription", "Copy Subscription")}
|
||||
</Button>,
|
||||
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={t(
|
||||
"resetSubscriptionTokenDescription",
|
||||
"This will reset the subscription token. Old links will become invalid."
|
||||
)}
|
||||
key="reset-token"
|
||||
onConfirm={async () => {
|
||||
await resetUserSubscribeToken({ user_subscribe_id: row.id });
|
||||
toast.success(t("resetSuccess", "Reset successfully"));
|
||||
ref.current?.refresh();
|
||||
}}
|
||||
title={t("resetSubscriptionToken", "Reset Token")}
|
||||
trigger={
|
||||
<Button variant="outline">
|
||||
{t("resetToken", "Reset Token")}
|
||||
</Button>
|
||||
}
|
||||
<RowMoreActions
|
||||
key="more"
|
||||
refresh={() => ref.current?.refresh()}
|
||||
row={row}
|
||||
token={row.token}
|
||||
userId={userId}
|
||||
/>
|
||||
/>,
|
||||
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={t(
|
||||
"resetSubscriptionTrafficDescription",
|
||||
"This will reset the subscription traffic counters."
|
||||
)}
|
||||
key="reset-traffic"
|
||||
onConfirm={async () => {
|
||||
await resetUserSubscribeTraffic({ user_subscribe_id: row.id });
|
||||
toast.success(t("resetSuccess", "Reset successfully"));
|
||||
ref.current?.refresh();
|
||||
}}
|
||||
title={t("resetSubscriptionTraffic", "Reset Traffic")}
|
||||
trigger={
|
||||
<Button variant="outline">
|
||||
{t("resetTraffic", "Reset Traffic")}
|
||||
</Button>
|
||||
}
|
||||
/>,
|
||||
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={t(
|
||||
"toggleSubscriptionStatusDescription",
|
||||
"This will toggle the subscription status."
|
||||
)}
|
||||
key="toggle-status"
|
||||
onConfirm={async () => {
|
||||
await toggleUserSubscribeStatus({ user_subscribe_id: row.id });
|
||||
toast.success(t("updateSuccess", "Updated successfully"));
|
||||
ref.current?.refresh();
|
||||
}}
|
||||
title={t("toggleSubscriptionStatus", "Toggle Status")}
|
||||
trigger={
|
||||
<Button variant="outline">
|
||||
{t("toggleStatus", "Toggle Status")}
|
||||
</Button>
|
||||
}
|
||||
/>,
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={t(
|
||||
"deleteSubscriptionDescription",
|
||||
"This action cannot be undone."
|
||||
)}
|
||||
key="delete"
|
||||
onConfirm={async () => {
|
||||
await deleteUserSubscribe({ user_subscribe_id: row.id });
|
||||
toast.success(t("deleteSuccess", "Deleted successfully"));
|
||||
ref.current?.refresh();
|
||||
}}
|
||||
title={t("confirmDelete", "Confirm Delete")}
|
||||
trigger={
|
||||
<Button variant="destructive">{t("delete", "Delete")}</Button>
|
||||
}
|
||||
/>,
|
||||
<RowMoreActions key="more" subId={row.id} userId={userId} />,
|
||||
],
|
||||
}}
|
||||
columns={[
|
||||
@ -165,6 +78,51 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
header: t("subscriptionName", "Subscription Name"),
|
||||
cell: ({ row }) => row.original.subscribe.name,
|
||||
},
|
||||
{
|
||||
accessorKey: "status",
|
||||
header: t("status", "Status"),
|
||||
cell: ({ row }) => {
|
||||
const status = row.getValue("status") as number;
|
||||
const expireTime = row.original.expire_time;
|
||||
|
||||
// 如果过期时间为0,说明是永久订阅,应该显示为激活状态
|
||||
const displayStatus = status === 3 && expireTime === 0 ? 1 : status;
|
||||
|
||||
const statusMap: Record<
|
||||
number,
|
||||
{
|
||||
label: string;
|
||||
variant: "default" | "secondary" | "destructive" | "outline";
|
||||
}
|
||||
> = {
|
||||
0: { label: t("statusPending", "Pending"), variant: "outline" },
|
||||
1: { label: t("statusActive", "Active"), variant: "default" },
|
||||
2: {
|
||||
label: t("statusFinished", "Finished"),
|
||||
variant: "secondary",
|
||||
},
|
||||
3: {
|
||||
label: t("statusExpired", "Expired"),
|
||||
variant: "destructive",
|
||||
},
|
||||
4: {
|
||||
label: t("statusDeducted", "Deducted"),
|
||||
variant: "secondary",
|
||||
},
|
||||
5: {
|
||||
label: t("statusStopped", "Stopped"),
|
||||
variant: "destructive",
|
||||
},
|
||||
};
|
||||
const statusInfo = statusMap[displayStatus] || {
|
||||
label: "Unknown",
|
||||
variant: "outline",
|
||||
};
|
||||
return (
|
||||
<Badge variant={statusInfo.variant}>{statusInfo.label}</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "upload",
|
||||
header: t("upload", "Upload"),
|
||||
@ -216,10 +174,12 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
{
|
||||
accessorKey: "expire_time",
|
||||
header: t("expireTime", "Expire Time"),
|
||||
cell: ({ row }) =>
|
||||
row.getValue("expire_time")
|
||||
? formatDate(row.getValue("expire_time"))
|
||||
: t("permanent", "Permanent"),
|
||||
cell: ({ row }) => {
|
||||
const expireTime = row.getValue("expire_time") as number;
|
||||
return expireTime && expireTime !== 0
|
||||
? formatDate(expireTime)
|
||||
: t("permanent", "Permanent");
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "created_at",
|
||||
@ -263,19 +223,72 @@ export default function UserSubscription({ userId }: { userId: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function RowMoreActions({ userId, subId }: { userId: number; subId: number }) {
|
||||
function RowMoreActions({
|
||||
userId,
|
||||
row,
|
||||
token,
|
||||
refresh,
|
||||
}: {
|
||||
userId: number;
|
||||
row: API.UserSubscribe;
|
||||
token: string;
|
||||
refresh: () => void;
|
||||
}) {
|
||||
const triggerRef = useRef<HTMLButtonElement>(null);
|
||||
const resetTokenRef = useRef<HTMLButtonElement>(null);
|
||||
const toggleStatusRef = useRef<HTMLButtonElement>(null);
|
||||
const deleteRef = useRef<HTMLButtonElement>(null);
|
||||
const { t } = useTranslation("user");
|
||||
const { getUserSubscribe: getUserSubscribeUrls } = useGlobalStore();
|
||||
|
||||
return (
|
||||
<div className="inline-flex">
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline">{t("more", "More")}</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem
|
||||
onSelect={async (e) => {
|
||||
e.preventDefault();
|
||||
await navigator.clipboard.writeText(
|
||||
getUserSubscribeUrls(row.short, token)[0] || ""
|
||||
);
|
||||
toast.success(t("copySuccess", "Copied successfully"));
|
||||
}}
|
||||
>
|
||||
{t("copySubscription", "Copy Subscription")}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onSelect={(e) => {
|
||||
e.preventDefault();
|
||||
resetTokenRef.current?.click();
|
||||
}}
|
||||
>
|
||||
{t("resetToken", "Reset Subscription Address")}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onSelect={(e) => {
|
||||
e.preventDefault();
|
||||
toggleStatusRef.current?.click();
|
||||
}}
|
||||
>
|
||||
{row.status === 5
|
||||
? t("resumeSubscribe", "Resume Subscription")
|
||||
: t("stopSubscribe", "Stop Subscription")}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
className="text-destructive"
|
||||
onSelect={(e) => {
|
||||
e.preventDefault();
|
||||
deleteRef.current?.click();
|
||||
}}
|
||||
>
|
||||
{t("delete", "Delete")}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<Link
|
||||
search={{ user_id: userId, user_subscribe_id: subId }}
|
||||
search={{ user_id: userId, user_subscribe_id: row.id }}
|
||||
to="/dashboard/log/subscribe"
|
||||
>
|
||||
{t("subscriptionLogs", "Subscription Logs")}
|
||||
@ -283,7 +296,7 @@ function RowMoreActions({ userId, subId }: { userId: number; subId: number }) {
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<Link
|
||||
search={{ user_id: userId, user_subscribe_id: subId }}
|
||||
search={{ user_id: userId, user_subscribe_id: row.id }}
|
||||
to="/dashboard/log/reset-subscribe"
|
||||
>
|
||||
{t("resetLogs", "Reset Logs")}
|
||||
@ -291,7 +304,7 @@ function RowMoreActions({ userId, subId }: { userId: number; subId: number }) {
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<Link
|
||||
search={{ user_id: userId, user_subscribe_id: subId }}
|
||||
search={{ user_id: userId, user_subscribe_id: row.id }}
|
||||
to="/dashboard/log/subscribe-traffic"
|
||||
>
|
||||
{t("trafficStats", "Traffic Stats")}
|
||||
@ -299,7 +312,7 @@ function RowMoreActions({ userId, subId }: { userId: number; subId: number }) {
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<Link
|
||||
search={{ user_id: userId, subscribe_id: subId }}
|
||||
search={{ user_id: userId, subscribe_id: row.id }}
|
||||
to="/dashboard/log/traffic-details"
|
||||
>
|
||||
{t("trafficDetails", "Traffic Details")}
|
||||
@ -316,8 +329,78 @@ function RowMoreActions({ userId, subId }: { userId: number; subId: number }) {
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
{/* Hidden triggers for confirm dialogs */}
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={t(
|
||||
"resetTokenDescription",
|
||||
"This will reset the subscription address and regenerate a new token."
|
||||
)}
|
||||
onConfirm={async () => {
|
||||
await resetUserSubscribeToken({
|
||||
user_subscribe_id: row.id,
|
||||
});
|
||||
toast.success(
|
||||
t("resetTokenSuccess", "Subscription address reset successfully")
|
||||
);
|
||||
refresh();
|
||||
}}
|
||||
title={t("confirmResetToken", "Confirm Reset Subscription Address")}
|
||||
trigger={<Button className="hidden" ref={resetTokenRef} />}
|
||||
/>
|
||||
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={
|
||||
row.status === 5
|
||||
? t(
|
||||
"resumeSubscribeDescription",
|
||||
"This will resume the subscription and allow the user to use it."
|
||||
)
|
||||
: t(
|
||||
"stopSubscribeDescription",
|
||||
"This will stop the subscription temporarily. User will not be able to use it."
|
||||
)
|
||||
}
|
||||
onConfirm={async () => {
|
||||
await toggleUserSubscribeStatus({
|
||||
user_subscribe_id: row.id,
|
||||
});
|
||||
toast.success(
|
||||
row.status === 5
|
||||
? t("resumeSubscribeSuccess", "Subscription resumed successfully")
|
||||
: t("stopSubscribeSuccess", "Subscription stopped successfully")
|
||||
);
|
||||
refresh();
|
||||
}}
|
||||
title={
|
||||
row.status === 5
|
||||
? t("confirmResumeSubscribe", "Confirm Resume Subscription")
|
||||
: t("confirmStopSubscribe", "Confirm Stop Subscription")
|
||||
}
|
||||
trigger={<Button className="hidden" ref={toggleStatusRef} />}
|
||||
/>
|
||||
|
||||
<ConfirmButton
|
||||
cancelText={t("cancel", "Cancel")}
|
||||
confirmText={t("confirm", "Confirm")}
|
||||
description={t(
|
||||
"deleteSubscriptionDescription",
|
||||
"This action cannot be undone."
|
||||
)}
|
||||
onConfirm={async () => {
|
||||
await deleteUserSubscribe({ user_subscribe_id: row.id });
|
||||
toast.success(t("deleteSuccess", "Deleted successfully"));
|
||||
refresh();
|
||||
}}
|
||||
title={t("confirmDelete", "Confirm Delete")}
|
||||
trigger={<Button className="hidden" ref={deleteRef} />}
|
||||
/>
|
||||
|
||||
<SubscriptionDetail
|
||||
subscriptionId={subId}
|
||||
subscriptionId={row.id}
|
||||
trigger={<Button className="hidden" ref={triggerRef} />}
|
||||
userId={userId}
|
||||
/>
|
||||
|
||||
@ -95,7 +95,8 @@ export function SubscriptionForm({
|
||||
<SheetHeader>
|
||||
<SheetTitle>{title}</SheetTitle>
|
||||
</SheetHeader>
|
||||
<ScrollArea className="h-[calc(100dvh-48px-36px-36px-env(safe-area-inset-top))]">
|
||||
<ScrollArea className="h-[calc(100dvh-48px-36px-36px-env(safe-area-inset-top))] px-4">
|
||||
<div className="pr-4">
|
||||
<Form {...form}>
|
||||
<form
|
||||
className="mt-4 space-y-4"
|
||||
@ -129,7 +130,9 @@ export function SubscriptionForm({
|
||||
name="traffic"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("trafficLimit", "Traffic Limit")}</FormLabel>
|
||||
<FormLabel>
|
||||
{t("trafficLimit", "Traffic Limit")}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<EnhancedInput
|
||||
placeholder={t("unlimited", "Unlimited")}
|
||||
@ -218,14 +221,14 @@ export function SubscriptionForm({
|
||||
<FormControl>
|
||||
<DatePicker
|
||||
onChange={(value: number | null | undefined) => {
|
||||
if (value === field.value) {
|
||||
form.setValue(field.name, 0);
|
||||
} else {
|
||||
form.setValue(field.name, value!);
|
||||
}
|
||||
form.setValue(field.name, value || 0);
|
||||
}}
|
||||
placeholder={t("permanent", "Permanent")}
|
||||
value={field.value ?? undefined}
|
||||
value={
|
||||
field.value && field.value > 0
|
||||
? field.value
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
@ -234,6 +237,7 @@ export function SubscriptionForm({
|
||||
/>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
<SheetFooter className="flex-row justify-end gap-2 pt-3">
|
||||
<Button
|
||||
|
||||
@ -8,7 +8,7 @@ export interface GlobalStore {
|
||||
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
||||
setUser: (user?: API.User) => void;
|
||||
getUserInfo: () => Promise<void>;
|
||||
getUserSubscribe: (uuid: string, type?: string) => string[];
|
||||
getUserSubscribe: (short: string, token: string, type?: string) => string[];
|
||||
getAppSubLink: (url: string, schema?: string) => string;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
||||
console.error("Failed to refresh user:", error);
|
||||
}
|
||||
},
|
||||
getUserSubscribe: (uuid: string, type?: string) => {
|
||||
getUserSubscribe: (short: string, token: string, type?: string) => {
|
||||
const { pan_domain, subscribe_domain, subscribe_path } =
|
||||
get().common.subscribe || {};
|
||||
const domains = subscribe_domain
|
||||
@ -129,12 +129,13 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
||||
|
||||
return domains.map((domain) => {
|
||||
if (pan_domain) {
|
||||
if (type) return `https://${uuid}.${type}.${domain}`;
|
||||
return `https://${uuid}.${domain}`;
|
||||
if (type)
|
||||
return `https://${short}.${type}.${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||
return `https://${short}.${domain}${subscribe_path}?token=${token}`;
|
||||
}
|
||||
if (type)
|
||||
return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`;
|
||||
return `https://${domain}${subscribe_path}?token=${uuid}`;
|
||||
return `https://${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||
return `https://${domain}${subscribe_path}?token=${token}`;
|
||||
});
|
||||
},
|
||||
getAppSubLink: (url: string, schema?: string) => {
|
||||
|
||||
@ -4,7 +4,7 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
import { devtools } from "@tanstack/devtools-vite";
|
||||
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
||||
import viteReact from "@vitejs/plugin-react";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
import { defineConfig, loadEnv, type Plugin } from "vite";
|
||||
|
||||
// Plugin to generate version.lock file after build
|
||||
function versionLockPlugin(): Plugin {
|
||||
@ -24,7 +24,10 @@ function versionLockPlugin(): Plugin {
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), "");
|
||||
|
||||
return {
|
||||
base: "./",
|
||||
plugins: [
|
||||
devtools({ eventBusConfig: { port: 42_070 } }),
|
||||
@ -44,14 +47,14 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "https://api.ppanel.dev",
|
||||
target: env.VITE_API_BASE_URL || "https://api.ppanel.dev",
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
assetsDir: "static",
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
"60003": "An existing subscription is detected. Please cancel it before proceeding.",
|
||||
"60004": "Unable to delete at the moment as the subscription has active users.",
|
||||
"60005": "Single subscription mode has exceeded user limit",
|
||||
"60006": "User quota limit has been reached, unable to continue.",
|
||||
"60007": "Insufficient inventory, please try again later or contact the administrator.",
|
||||
"70001": "Incorrect verification code, please re-enter.",
|
||||
"80001": "Task was not successfully queued, please try again later.",
|
||||
"90001": "Please disable DEBUG mode and try again.",
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
"duration": "Duration",
|
||||
"fee": "Fee",
|
||||
"gift": "gift Deduction",
|
||||
"originalPrice": "Original Price (Monthly)",
|
||||
"price": "Price",
|
||||
"productDiscount": "Product Discount",
|
||||
"total": "Total"
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
"60003": "检测到现有订阅,请先取消后再继续。",
|
||||
"60004": "由于订阅有活跃用户,暂时无法删除。",
|
||||
"60005": "单一订阅模式已超过用户限制",
|
||||
"60006": "用户配额已达到限制,无法继续操作。",
|
||||
"60007": "库存不足,请稍后再试或联系管理员。",
|
||||
"70001": "验证码不正确,请重新输入。",
|
||||
"80001": "任务未成功加入队列,请稍后再试。",
|
||||
"90001": "请禁用 DEBUG 模式后再试。",
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
"duration": "套餐时长",
|
||||
"fee": "手续费",
|
||||
"gift": "赠金抵扣",
|
||||
"originalPrice": "原价(按月)",
|
||||
"price": "价格",
|
||||
"productDiscount": "商品折扣",
|
||||
"total": "总价"
|
||||
|
||||
@ -33,7 +33,7 @@ export function UserNav() {
|
||||
|
||||
if (user) {
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<div className="flex cursor-pointer items-center gap-2 rounded-full border bg-background px-2 py-1.5 transition-colors duration-200 hover:bg-accent">
|
||||
<Avatar className="h-6 w-6">
|
||||
|
||||
@ -173,7 +173,7 @@ export default function RegisterForm({
|
||||
/>
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
email: form.watch("email"),
|
||||
type: 1,
|
||||
}}
|
||||
type="email"
|
||||
|
||||
@ -98,7 +98,7 @@ export default function ResetForm({
|
||||
/>
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
email: form.watch("email"),
|
||||
type: 2,
|
||||
}}
|
||||
type="email"
|
||||
|
||||
@ -127,7 +127,10 @@ export default function LoginForm({
|
||||
{mode === "code" && (
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
telephone: form.watch("telephone"),
|
||||
telephone_area_code: form.watch(
|
||||
"telephone_area_code"
|
||||
),
|
||||
type: 2,
|
||||
}}
|
||||
type="phone"
|
||||
|
||||
@ -182,7 +182,10 @@ export default function RegisterForm({
|
||||
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
telephone: form.watch("telephone"),
|
||||
telephone_area_code: form.watch(
|
||||
"telephone_area_code"
|
||||
),
|
||||
type: 1,
|
||||
}}
|
||||
type="phone"
|
||||
|
||||
@ -124,7 +124,8 @@ export default function ResetForm({
|
||||
/>
|
||||
<SendCode
|
||||
params={{
|
||||
...form.getValues(),
|
||||
telephone: form.watch("telephone"),
|
||||
telephone_area_code: form.watch("telephone_area_code"),
|
||||
type: 2,
|
||||
}}
|
||||
type="phone"
|
||||
|
||||
@ -142,19 +142,44 @@ export function Content({ subscriptionData }: ProductShowcaseProps) {
|
||||
</CardContent>
|
||||
<Separator />
|
||||
<CardFooter className="relative flex flex-col gap-4 p-4">
|
||||
{(() => {
|
||||
const hasDiscount = item.discount && item.discount.length > 0;
|
||||
const shouldShowOriginal = item.show_original_price !== false;
|
||||
|
||||
const displayPrice =
|
||||
shouldShowOriginal || !hasDiscount
|
||||
? item.unit_price
|
||||
: Math.round(
|
||||
item.unit_price *
|
||||
(item.discount?.[0]?.quantity ?? 1) *
|
||||
((item.discount?.[0]?.discount ?? 100) / 100)
|
||||
);
|
||||
|
||||
const displayQuantity =
|
||||
shouldShowOriginal || !hasDiscount
|
||||
? 1
|
||||
: (item.discount?.[0]?.quantity ?? 1);
|
||||
|
||||
const unitTime =
|
||||
unitTimeMap[item.unit_time!] ||
|
||||
t(item.unit_time || "Month", item.unit_time || "Month");
|
||||
|
||||
return (
|
||||
<motion.h2
|
||||
animate={{ opacity: 1 }}
|
||||
className="pb-4 font-semibold text-2xl sm:text-3xl"
|
||||
initial={{ opacity: 0 }}
|
||||
transition={{ duration: 0.5, delay: 0.2 }}
|
||||
>
|
||||
<Display type="currency" value={item.unit_price} />
|
||||
<Display type="currency" value={displayPrice} />
|
||||
<span className="font-medium text-base">
|
||||
/
|
||||
{unitTimeMap[item.unit_time!] ||
|
||||
t(item.unit_time || "Month", item.unit_time || "Month")}
|
||||
{displayQuantity === 1
|
||||
? `/${unitTime}`
|
||||
: `/${displayQuantity} ${unitTime}`}
|
||||
</span>
|
||||
</motion.h2>
|
||||
);
|
||||
})()}
|
||||
<motion.div>
|
||||
<Button
|
||||
asChild
|
||||
|
||||
@ -282,6 +282,7 @@ export default function Content({
|
||||
...order,
|
||||
quantity: params.quantity,
|
||||
unit_price: subscription?.unit_price,
|
||||
show_original_price: subscription?.show_original_price,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
|
||||
@ -178,6 +178,7 @@ export default function Order() {
|
||||
order={{
|
||||
...data,
|
||||
unit_price: data?.subscribe?.unit_price,
|
||||
show_original_price: data?.subscribe?.show_original_price,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
|
||||
@ -10,6 +10,7 @@ interface SubscribeBillingProps {
|
||||
unit_price: number;
|
||||
unit_time: string;
|
||||
subscribe_discount: number;
|
||||
show_original_price?: boolean;
|
||||
}
|
||||
>;
|
||||
}
|
||||
@ -33,7 +34,19 @@ export function SubscribeBilling({ order }: Readonly<SubscribeBillingProps>) {
|
||||
{t(order?.unit_time || "Month", order?.unit_time || "Month")}
|
||||
</span>
|
||||
</li>
|
||||
)}
|
||||
)}{" "}
|
||||
{order?.show_original_price !== false &&
|
||||
order?.type &&
|
||||
[1, 2].includes(order?.type) && (
|
||||
<li>
|
||||
<span className="text-muted-foreground">
|
||||
{t("billing.originalPrice", "Original Price (Monthly)")}
|
||||
</span>
|
||||
<span>
|
||||
<Display type="currency" value={order?.unit_price} />
|
||||
</span>
|
||||
</li>
|
||||
)}{" "}
|
||||
<li>
|
||||
<span className="text-muted-foreground">
|
||||
{t("billing.price", "Price")}
|
||||
|
||||
@ -15,6 +15,7 @@ interface DurationSelectorProps {
|
||||
unitTime?: string;
|
||||
discounts?: Array<{ quantity: number; discount: number }>;
|
||||
onChange: (value: number) => void;
|
||||
showOriginalPrice?: boolean;
|
||||
}
|
||||
|
||||
const DurationSelector: React.FC<DurationSelectorProps> = ({
|
||||
@ -22,6 +23,7 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
|
||||
unitTime = "Month",
|
||||
discounts = [],
|
||||
onChange,
|
||||
showOriginalPrice = true,
|
||||
}) => {
|
||||
const { t } = useTranslation("subscribe");
|
||||
const handleChange = useCallback(
|
||||
@ -61,7 +63,7 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
|
||||
onValueChange={handleChange}
|
||||
value={String(quantity)}
|
||||
>
|
||||
{unitTime !== "Minute" && (
|
||||
{showOriginalPrice && unitTime !== "Minute" && (
|
||||
<DurationOption label={`1 / ${t(unitTime)}`} value="1" />
|
||||
)}
|
||||
{discounts?.map((item) => (
|
||||
@ -78,7 +80,7 @@ const DurationSelector: React.FC<DurationSelectorProps> = ({
|
||||
</span>
|
||||
{discountPercentage > 0 ? (
|
||||
<Badge className="h-6 text-sm" variant="destructive">
|
||||
-{discountPercentage}% {t("discount", "Discount")}
|
||||
-{discountPercentage.toFixed(2)}% {t("discount", "Discount")}
|
||||
</Badge>
|
||||
) : (
|
||||
<span className="h-6 text-muted-foreground text-sm">--</span>
|
||||
|
||||
@ -122,14 +122,39 @@ export default function Subscribe() {
|
||||
</CardContent>
|
||||
<Separator />
|
||||
<CardFooter className="flex flex-col gap-2">
|
||||
{(() => {
|
||||
const hasDiscount = item.discount && item.discount.length > 0;
|
||||
const shouldShowOriginal = item.show_original_price !== false;
|
||||
|
||||
const displayPrice =
|
||||
shouldShowOriginal || !hasDiscount
|
||||
? item.unit_price
|
||||
: Math.round(
|
||||
item.unit_price *
|
||||
(item.discount?.[0]?.quantity ?? 1) *
|
||||
((item.discount?.[0]?.discount ?? 100) / 100)
|
||||
);
|
||||
|
||||
const displayQuantity =
|
||||
shouldShowOriginal || !hasDiscount
|
||||
? 1
|
||||
: (item.discount?.[0]?.quantity ?? 1);
|
||||
|
||||
const unitTime =
|
||||
unitTimeMap[item.unit_time!] ||
|
||||
t(item.unit_time || "Month", item.unit_time || "Month");
|
||||
|
||||
return (
|
||||
<h2 className="pb-8 font-semibold text-2xl sm:text-3xl">
|
||||
<Display type="currency" value={item.unit_price} />
|
||||
<Display type="currency" value={displayPrice} />
|
||||
<span className="font-medium text-base">
|
||||
/
|
||||
{unitTimeMap[item.unit_time!] ||
|
||||
t(item.unit_time || "Month", item.unit_time || "Month")}
|
||||
{displayQuantity === 1
|
||||
? `/${unitTime}`
|
||||
: `/${displayQuantity} ${unitTime}`}
|
||||
</span>
|
||||
</h2>
|
||||
);
|
||||
})()}
|
||||
<Button
|
||||
className="absolute bottom-0 w-full rounded-t-none rounded-b-xl"
|
||||
onClick={() => {
|
||||
|
||||
@ -45,7 +45,13 @@ export default function Purchase({
|
||||
|
||||
const { data: order } = useQuery({
|
||||
enabled: !!subscribe?.id,
|
||||
queryKey: ["preCreateOrder", params],
|
||||
queryKey: [
|
||||
"preCreateOrder",
|
||||
subscribe?.id,
|
||||
params.quantity,
|
||||
params.payment,
|
||||
params.coupon,
|
||||
],
|
||||
queryFn: async () => {
|
||||
try {
|
||||
const { data } = await preCreateOrder({
|
||||
@ -68,9 +74,13 @@ export default function Purchase({
|
||||
|
||||
useEffect(() => {
|
||||
if (subscribe) {
|
||||
const defaultQuantity =
|
||||
subscribe.show_original_price === false && subscribe.discount?.[0]
|
||||
? subscribe.discount[0].quantity
|
||||
: 1;
|
||||
setParams((prev) => ({
|
||||
...prev,
|
||||
quantity: 1,
|
||||
quantity: defaultQuantity,
|
||||
subscribe_id: subscribe?.id,
|
||||
}));
|
||||
}
|
||||
@ -127,6 +137,7 @@ export default function Purchase({
|
||||
...order,
|
||||
quantity: params.quantity,
|
||||
unit_price: subscribe?.unit_price,
|
||||
show_original_price: subscribe?.show_original_price,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
@ -139,6 +150,7 @@ export default function Purchase({
|
||||
handleChange("quantity", value);
|
||||
}}
|
||||
quantity={params.quantity as number}
|
||||
showOriginalPrice={subscribe?.show_original_price}
|
||||
unitTime={subscribe?.unit_time}
|
||||
/>
|
||||
<CouponInput
|
||||
|
||||
@ -44,7 +44,13 @@ export default function Renewal({ id, subscribe }: Readonly<RenewalProps>) {
|
||||
|
||||
const { data: order } = useQuery({
|
||||
enabled: !!subscribe.id && open,
|
||||
queryKey: ["preCreateOrder", params],
|
||||
queryKey: [
|
||||
"preCreateOrder",
|
||||
subscribe.id,
|
||||
params.quantity,
|
||||
params.payment,
|
||||
params.coupon,
|
||||
],
|
||||
queryFn: async () => {
|
||||
try {
|
||||
const { data } = await preCreateOrder({
|
||||
@ -66,9 +72,13 @@ export default function Renewal({ id, subscribe }: Readonly<RenewalProps>) {
|
||||
|
||||
useEffect(() => {
|
||||
if (subscribe.id && id) {
|
||||
const defaultQuantity =
|
||||
subscribe.show_original_price === false && subscribe.discount?.[0]
|
||||
? subscribe.discount[0].quantity
|
||||
: 1;
|
||||
setParams((prev) => ({
|
||||
...prev,
|
||||
quantity: 1,
|
||||
quantity: defaultQuantity,
|
||||
subscribe_id: subscribe.id,
|
||||
user_subscribe_id: id,
|
||||
}));
|
||||
@ -126,6 +136,7 @@ export default function Renewal({ id, subscribe }: Readonly<RenewalProps>) {
|
||||
...order,
|
||||
quantity: params.quantity,
|
||||
unit_price: subscribe?.unit_price,
|
||||
show_original_price: subscribe?.show_original_price,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
@ -138,6 +149,7 @@ export default function Renewal({ id, subscribe }: Readonly<RenewalProps>) {
|
||||
handleChange("quantity", value);
|
||||
}}
|
||||
quantity={params.quantity!}
|
||||
showOriginalPrice={subscribe?.show_original_price}
|
||||
unitTime={subscribe?.unit_time}
|
||||
/>
|
||||
<CouponInput
|
||||
|
||||
@ -218,22 +218,29 @@ export default function Content() {
|
||||
</Tabs>
|
||||
)}
|
||||
</div>
|
||||
{userSubscribe.map((item) => (
|
||||
{userSubscribe.map((item) => {
|
||||
// 如果过期时间为0,说明是永久订阅,不应该显示过期状态
|
||||
const isActuallyExpired =
|
||||
item.status === 3 && item.expire_time !== 0;
|
||||
const shouldShowWatermark =
|
||||
item.status === 2 || item.status === 4 || isActuallyExpired;
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={cn("relative", {
|
||||
"relative opacity-80 grayscale": item.status === 3,
|
||||
"relative opacity-80 grayscale": isActuallyExpired,
|
||||
"relative hidden opacity-60 blur-[0.3px] grayscale":
|
||||
item.status === 4,
|
||||
})}
|
||||
key={item.id}
|
||||
>
|
||||
{item.status >= 2 && (
|
||||
{shouldShowWatermark && (
|
||||
<div
|
||||
className={cn(
|
||||
"pointer-events-none absolute top-0 left-0 z-10 h-full w-full overflow-hidden mix-blend-difference brightness-150 contrast-200 invert-[0.2]",
|
||||
{
|
||||
"text-destructive": item.status === 2,
|
||||
"text-white": item.status === 3 || item.status === 4,
|
||||
"text-white": isActuallyExpired || item.status === 4,
|
||||
}
|
||||
)}
|
||||
>
|
||||
@ -301,7 +308,9 @@ export default function Content() {
|
||||
user_subscribe_id: item.id,
|
||||
});
|
||||
await refetch();
|
||||
toast.success(t("resetSuccess", "Reset Success"));
|
||||
toast.success(
|
||||
t("resetSuccess", "Reset Success")
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("confirm", "Confirm")}
|
||||
@ -385,7 +394,8 @@ export default function Content() {
|
||||
defaultValue="0"
|
||||
type="single"
|
||||
>
|
||||
{getUserSubscribe(item.token, protocol)?.map((url, index) => (
|
||||
{getUserSubscribe(item.short, item.token, protocol)?.map(
|
||||
(url, index) => (
|
||||
<AccordionItem key={url} value={String(index)}>
|
||||
<AccordionTrigger className="hover:no-underline">
|
||||
<div className="flex w-full flex-row items-center justify-between">
|
||||
@ -397,7 +407,9 @@ export default function Content() {
|
||||
<CopyToClipboard
|
||||
onCopy={(_, result) => {
|
||||
if (result) {
|
||||
toast.success(t("copySuccess", "Copy Success"));
|
||||
toast.success(
|
||||
t("copySuccess", "Copy Success")
|
||||
);
|
||||
}
|
||||
}}
|
||||
text={url}
|
||||
@ -406,7 +418,10 @@ export default function Content() {
|
||||
className="mr-4 flex cursor-pointer rounded p-2 text-primary text-sm hover:bg-accent"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Icon className="mr-2 size-5" icon="uil:copy" />
|
||||
<Icon
|
||||
className="mr-2 size-5"
|
||||
icon="uil:copy"
|
||||
/>
|
||||
{t("copy", "Copy")}
|
||||
</span>
|
||||
</CopyToClipboard>
|
||||
@ -544,11 +559,13 @@ export default function Content() {
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
))}
|
||||
)
|
||||
)}
|
||||
</Accordion>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@ -164,6 +164,7 @@ export default function Page() {
|
||||
order={{
|
||||
...data,
|
||||
unit_price: data?.subscribe?.unit_price,
|
||||
show_original_price: data?.subscribe?.show_original_price,
|
||||
}}
|
||||
/>
|
||||
</CardContent>
|
||||
|
||||
@ -147,8 +147,8 @@ function MobileBindDialog({
|
||||
/>
|
||||
<SendCode
|
||||
params={{
|
||||
telephone_area_code: form.getValues().area_code,
|
||||
telephone: form.getValues().mobile,
|
||||
telephone_area_code: form.watch("area_code"),
|
||||
telephone: form.watch("mobile"),
|
||||
type: 1,
|
||||
}}
|
||||
type="phone"
|
||||
|
||||
@ -8,7 +8,7 @@ export interface GlobalStore {
|
||||
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
||||
setUser: (user?: API.User) => void;
|
||||
getUserInfo: () => Promise<void>;
|
||||
getUserSubscribe: (uuid: string, type?: string) => string[];
|
||||
getUserSubscribe: (short: string, token: string, type?: string) => string[];
|
||||
getAppSubLink: (url: string, schema?: string) => string;
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
||||
console.error("Failed to refresh user:", error);
|
||||
}
|
||||
},
|
||||
getUserSubscribe: (uuid: string, type?: string) => {
|
||||
getUserSubscribe: (short: string, token: string, type?: string) => {
|
||||
const { pan_domain, subscribe_domain, subscribe_path } =
|
||||
get().common.subscribe || {};
|
||||
const domains = subscribe_domain
|
||||
@ -129,12 +129,13 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
||||
|
||||
return domains.map((domain) => {
|
||||
if (pan_domain) {
|
||||
if (type) return `https://${uuid}.${type}.${domain}`;
|
||||
return `https://${uuid}.${domain}`;
|
||||
if (type)
|
||||
return `https://${short}.${type}.${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||
return `https://${short}.${domain}${subscribe_path}?token=${token}`;
|
||||
}
|
||||
if (type)
|
||||
return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`;
|
||||
return `https://${domain}${subscribe_path}?token=${uuid}`;
|
||||
return `https://${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||
return `https://${domain}${subscribe_path}?token=${token}`;
|
||||
});
|
||||
},
|
||||
getAppSubLink: (url: string, schema?: string) => {
|
||||
|
||||
@ -4,7 +4,7 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
import { devtools } from "@tanstack/devtools-vite";
|
||||
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
||||
import viteReact from "@vitejs/plugin-react";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
import { defineConfig, loadEnv, type Plugin } from "vite";
|
||||
|
||||
// Plugin to generate version.lock file after build
|
||||
function versionLockPlugin(): Plugin {
|
||||
@ -24,7 +24,10 @@ function versionLockPlugin(): Plugin {
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), "");
|
||||
|
||||
return {
|
||||
base: "./",
|
||||
plugins: [
|
||||
devtools({ eventBusConfig: { port: 42_069 } }),
|
||||
@ -44,7 +47,7 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "https://api.ppanel.dev",
|
||||
target: env.VITE_API_BASE_URL || "https://api.ppanel.dev",
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
@ -53,4 +56,5 @@ export default defineConfig({
|
||||
build: {
|
||||
assetsDir: "static",
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@ -211,8 +211,19 @@ After successful installation, you can access:
|
||||
- **User Panel**: `http://your-server-ip:8080`
|
||||
- **Admin Panel**: `http://your-server-ip:8080/admin/`
|
||||
|
||||
::: warning Default Credentials
|
||||
Please change the default admin password immediately after first login for security.
|
||||
::: warning Administrator Account
|
||||
**Default Administrator Account** (if not configured in config file):
|
||||
- **Email**: `admin@ppanel.dev`
|
||||
- **Password**: `password`
|
||||
|
||||
**One-Click Installation Script** will automatically generate random administrator credentials displayed at the end:
|
||||
- **Email**: `admin-[8 random characters]@ppanel.dev`
|
||||
- **Password**: `[Randomly generated 16-character password]`
|
||||
|
||||
**Security Recommendations**:
|
||||
- When using the one-click script, save the generated credentials securely
|
||||
- Change your password immediately after first login
|
||||
- If using default credentials, **must** change both email and password after first login
|
||||
:::
|
||||
|
||||
### Configure Reverse Proxy (Optional)
|
||||
|
||||
@ -309,6 +309,14 @@ ps aux | grep ppanel
|
||||
- **User Panel**: `http://your-server-ip:8080`
|
||||
- **Admin Panel**: `http://your-server-ip:8080/admin/`
|
||||
|
||||
::: warning Default Credentials
|
||||
**Default Administrator Account**:
|
||||
- **Email**: `admin@ppanel.dev`
|
||||
- **Password**: `password`
|
||||
|
||||
**Security**: Change the default credentials immediately after first login.
|
||||
:::
|
||||
|
||||
### Configure Firewall
|
||||
|
||||
```bash
|
||||
|
||||
@ -223,7 +223,11 @@ After successful installation, you can access:
|
||||
- **Admin Panel**: `http://your-server-ip:8080/admin/`
|
||||
|
||||
::: warning Default Credentials
|
||||
Please change the default admin password immediately after first login for security.
|
||||
**Default Administrator Account** (if not configured):
|
||||
- **Email**: `admin@ppanel.dev`
|
||||
- **Password**: `password`
|
||||
|
||||
**Security**: Change the default credentials immediately after first login.
|
||||
:::
|
||||
|
||||
### Configure Reverse Proxy (Recommended)
|
||||
|
||||
@ -232,6 +232,14 @@ docker volume rm ppanel-data
|
||||
```
|
||||
:::
|
||||
|
||||
::: warning Default Credentials
|
||||
**Default Administrator Account**:
|
||||
- **Email**: `admin@ppanel.dev`
|
||||
- **Password**: `password`
|
||||
|
||||
**Security**: Change the default credentials immediately after first login.
|
||||
:::
|
||||
|
||||
## Upgrading
|
||||
|
||||
Upgrade PPanel directly from the **Admin Dashboard**. On the dashboard homepage, you can check for new versions and upgrade with one click.
|
||||
|
||||
@ -113,6 +113,12 @@ get_user_input() {
|
||||
|
||||
log_info "✓ Redis password generated"
|
||||
|
||||
# Administrator configuration
|
||||
ADMIN_EMAIL="admin-$(generate_secret | cut -c1-8)@ppanel.dev"
|
||||
ADMIN_PASSWORD=$(generate_secret | cut -c1-16)
|
||||
|
||||
log_info "✓ Administrator password generated"
|
||||
|
||||
# Generate JWT secret
|
||||
JWT_SECRET=$(generate_secret)
|
||||
log_info "✓ JWT secret generated"
|
||||
@ -145,6 +151,10 @@ JwtAuth:
|
||||
AccessSecret: $JWT_SECRET
|
||||
AccessExpire: 604800
|
||||
|
||||
Administrator:
|
||||
Email: $ADMIN_EMAIL
|
||||
Password: "$ADMIN_PASSWORD"
|
||||
|
||||
Logger:
|
||||
ServiceName: ApiService
|
||||
Mode: console
|
||||
@ -343,8 +353,10 @@ show_access_info() {
|
||||
else
|
||||
log_warn "Unable to get public IP, please configure manually for public access"
|
||||
fi
|
||||
echo ""
|
||||
log_info "Database Information:"
|
||||
echo "" log_info "Administrator Account:"
|
||||
echo " Email: $ADMIN_EMAIL"
|
||||
echo " Password: $ADMIN_PASSWORD"
|
||||
echo "" log_info "Database Information:"
|
||||
echo " MySQL (Container Network):"
|
||||
echo " Address: mysql:3306"
|
||||
echo " User: $MYSQL_USER"
|
||||
|
||||
@ -113,6 +113,12 @@ get_user_input() {
|
||||
|
||||
log_info "✓ 已生成 Redis 密码"
|
||||
|
||||
# 管理员配置
|
||||
ADMIN_EMAIL="admin-$(generate_secret | cut -c1-8)@ppanel.dev"
|
||||
ADMIN_PASSWORD=$(generate_secret | cut -c1-16)
|
||||
|
||||
log_info "✓ 已生成管理员密码"
|
||||
|
||||
# 生成 JWT 密钥
|
||||
JWT_SECRET=$(generate_secret)
|
||||
log_info "✓ 已生成 JWT 密钥"
|
||||
@ -145,6 +151,10 @@ JwtAuth:
|
||||
AccessSecret: $JWT_SECRET
|
||||
AccessExpire: 604800
|
||||
|
||||
Administrator:
|
||||
Email: $ADMIN_EMAIL
|
||||
Password: "$ADMIN_PASSWORD"
|
||||
|
||||
Logger:
|
||||
ServiceName: ApiService
|
||||
Mode: console
|
||||
@ -346,6 +356,10 @@ show_access_info() {
|
||||
log_warn "未能获取公网IP,如需外网访问请手动配置"
|
||||
fi
|
||||
echo ""
|
||||
log_info "管理员账户:"
|
||||
echo " 邮箱: $ADMIN_EMAIL"
|
||||
echo " 密码: $ADMIN_PASSWORD"
|
||||
echo ""
|
||||
log_info "数据库信息:"
|
||||
echo " MySQL (容器间通信):"
|
||||
echo " 地址: mysql:3306"
|
||||
|
||||
@ -211,8 +211,19 @@ docker compose ps
|
||||
- **用户面板**: `http://your-server-ip:8080`
|
||||
- **管理后台**: `http://your-server-ip:8080/admin`
|
||||
|
||||
::: warning 默认凭据
|
||||
为了安全起见,首次登录后请立即修改默认管理员密码。
|
||||
::: warning 管理员账户
|
||||
**默认管理员账户**(如果配置文件未设置):
|
||||
- **邮箱**: `admin@ppanel.dev`
|
||||
- **密码**: `password`
|
||||
|
||||
**一键安装脚本**会自动生成随机的管理员账户并在安装结束时显示:
|
||||
- **邮箱**: `admin-[8位随机字符]@ppanel.dev`
|
||||
- **密码**: `[随机生成的16位密码]`
|
||||
|
||||
**安全建议**:
|
||||
- 使用一键安装脚本时,请妥善保管脚本生成的凭据
|
||||
- 首次登录后立即修改密码
|
||||
- 如果使用默认账户,**必须**在首次登录后修改邮箱和密码
|
||||
:::
|
||||
|
||||
### 配置反向代理(可选)
|
||||
|
||||
@ -309,6 +309,14 @@ ps aux | grep ppanel
|
||||
- **用户面板**: `http://your-server-ip:8080`
|
||||
- **管理后台**: `http://your-server-ip:8080/admin/`
|
||||
|
||||
::: warning 默认凭据
|
||||
**默认管理员账号**:
|
||||
- **邮箱**: `admin@ppanel.dev`
|
||||
- **密码**: `password`
|
||||
|
||||
**安全提醒**: 首次登录后请立即修改默认凭据。
|
||||
:::
|
||||
|
||||
### 配置防火墙
|
||||
|
||||
```bash
|
||||
|
||||
@ -219,7 +219,11 @@ docker compose logs -f ppanel
|
||||
- **管理后台**: `http://your-server-ip:8080/admin/`
|
||||
|
||||
::: warning 默认凭据
|
||||
为了安全起见,首次登录后请立即修改默认管理员密码。
|
||||
**默认管理员账号**(如果未配置时):
|
||||
- **邮箱**: `admin@ppanel.dev`
|
||||
- **密码**: `password`
|
||||
|
||||
**安全提醒**: 首次登录后请立即修改默认凭据。
|
||||
:::
|
||||
|
||||
### 配置反向代理(推荐)
|
||||
|
||||
@ -232,6 +232,14 @@ docker volume rm ppanel-data
|
||||
```
|
||||
:::
|
||||
|
||||
::: warning 默认凭据
|
||||
**默认管理员账号**:
|
||||
- **邮箱**: `admin@ppanel.dev`
|
||||
- **密码**: `password`
|
||||
|
||||
**安全提醒**: 首次登录后请立即修改默认凭据。
|
||||
:::
|
||||
|
||||
## 升级
|
||||
|
||||
直接从**管理后台**主页升级 PPanel。在仪表盘主页可以检查新版本并一键升级。
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "1.2.4-dev.1",
|
||||
"version": "1.3.6",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/perfect-panel/frontend",
|
||||
"bugs": {
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
} from "@workspace/ui/components/popover";
|
||||
import { cn } from "@workspace/ui/lib/utils";
|
||||
import { intlFormat } from "date-fns";
|
||||
import { CalendarIcon } from "lucide-react";
|
||||
import { CalendarIcon, X } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import type { DayPicker } from "react-day-picker";
|
||||
|
||||
@ -34,6 +34,15 @@ export function DatePicker({
|
||||
}
|
||||
};
|
||||
|
||||
const handleClear = (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setDate(undefined);
|
||||
if (onChange) {
|
||||
onChange(0);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
@ -45,7 +54,19 @@ export function DatePicker({
|
||||
variant="outline"
|
||||
>
|
||||
{value ? intlFormat(value) : <span>{placeholder}</span>}
|
||||
<div className="flex items-center gap-2">
|
||||
{value && (
|
||||
<button
|
||||
className="flex items-center"
|
||||
onClick={handleClear}
|
||||
onMouseDown={handleClear}
|
||||
type="button"
|
||||
>
|
||||
<X className="size-4 opacity-50 hover:opacity-100" />
|
||||
</button>
|
||||
)}
|
||||
<CalendarIcon className="size-4" />
|
||||
</div>
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" className="w-auto p-0">
|
||||
|
||||
@ -60,7 +60,10 @@ export function MonacoEditor({
|
||||
const size = useSize(ref);
|
||||
|
||||
useEffect(() => {
|
||||
// Only update internalValue if propValue has actually changed and is different from current value
|
||||
if (propValue !== internalValue) {
|
||||
setInternalValue(propValue);
|
||||
}
|
||||
}, [propValue]);
|
||||
|
||||
const debouncedOnChange = useRef(
|
||||
|
||||
@ -128,13 +128,18 @@ export function TagInput({
|
||||
variant="outline"
|
||||
>
|
||||
{tag}
|
||||
<X
|
||||
className="size-4 cursor-pointer rounded-sm hover:text-destructive"
|
||||
<button
|
||||
className="ml-1 inline-flex items-center justify-center"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleRemoveTag(index);
|
||||
}}
|
||||
/>
|
||||
onMouseDown={(e) => e.preventDefault()}
|
||||
type="button"
|
||||
>
|
||||
<X className="size-4 cursor-pointer rounded-sm hover:text-destructive" />
|
||||
</button>
|
||||
</Badge>
|
||||
))}
|
||||
<div className="flex min-w-0 flex-1 items-center gap-2">
|
||||
|
||||
@ -135,6 +135,14 @@ function handleError(response: {
|
||||
"components:error.60005",
|
||||
"Single subscription mode has exceeded user limit"
|
||||
),
|
||||
60006: t(
|
||||
"components:error.60006",
|
||||
"User quota limit has been reached, unable to continue."
|
||||
),
|
||||
60007: t(
|
||||
"components:error.60007",
|
||||
"Insufficient inventory, please try again later or contact the administrator."
|
||||
),
|
||||
70001: t(
|
||||
"components:error.70001",
|
||||
"Incorrect verification code, please re-enter."
|
||||
@ -185,7 +193,7 @@ request.interceptors.request.use(
|
||||
request.interceptors.response.use(
|
||||
(response) => {
|
||||
const { code } = response.data;
|
||||
if (code !== 200) {
|
||||
if (code !== 200 && code !== 0) {
|
||||
handleError({
|
||||
data: response.data,
|
||||
config: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user