diff --git a/VERSION.txt b/VERSION.txt
index 6e6c67d..5e3eb7a 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-20250731021807
\ No newline at end of file
+20250731130730
\ No newline at end of file
diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx
index 237e4ad..790b4f3 100644
--- a/src/app/play/page.tsx
+++ b/src/app/play/page.tsx
@@ -465,12 +465,73 @@ function PlayPageClient() {
if (!currentSourceRef.current || !currentIdRef.current) return;
try {
- await saveSkipConfig(
- currentSourceRef.current,
- currentIdRef.current,
- newConfig
- );
setSkipConfig(newConfig);
+ if (!newConfig.enable && !newConfig.intro_time && !newConfig.outro_time) {
+ await deleteSkipConfig(currentSourceRef.current, currentIdRef.current);
+ artPlayerRef.current.setting.update({
+ name: '跳过片头片尾',
+ html: '跳过片头片尾',
+ switch: skipConfigRef.current.enable,
+ onSwitch: function (item: any) {
+ const newConfig = {
+ ...skipConfigRef.current,
+ enable: !item.switch,
+ };
+ handleSkipConfigChange(newConfig);
+ return !item.switch;
+ },
+ });
+ artPlayerRef.current.setting.update({
+ name: '设置片头',
+ html: '设置片头',
+ icon: '',
+ tooltip:
+ skipConfigRef.current.intro_time === 0
+ ? '设置片头时间'
+ : `${formatTime(skipConfigRef.current.intro_time)}`,
+ onClick: function () {
+ const currentTime = artPlayerRef.current?.currentTime || 0;
+ if (currentTime > 0) {
+ const newConfig = {
+ ...skipConfigRef.current,
+ intro_time: currentTime,
+ };
+ handleSkipConfigChange(newConfig);
+ return `${formatTime(currentTime)}`;
+ }
+ },
+ });
+ artPlayerRef.current.setting.update({
+ name: '设置片尾',
+ html: '设置片尾',
+ icon: '',
+ tooltip:
+ skipConfigRef.current.outro_time >= 0
+ ? '设置片尾时间'
+ : `-${formatTime(-skipConfigRef.current.outro_time)}`,
+ onClick: function () {
+ const outroTime =
+ -(
+ artPlayerRef.current?.duration -
+ artPlayerRef.current?.currentTime
+ ) || 0;
+ if (outroTime < 0) {
+ const newConfig = {
+ ...skipConfigRef.current,
+ outro_time: outroTime,
+ };
+ handleSkipConfigChange(newConfig);
+ return `-${formatTime(-outroTime)}`;
+ }
+ },
+ });
+ } else {
+ await saveSkipConfig(
+ currentSourceRef.current,
+ currentIdRef.current,
+ newConfig
+ );
+ }
console.log('跳过片头片尾配置已保存:', newConfig);
} catch (err) {
console.error('保存跳过片头片尾配置失败:', err);
@@ -1284,8 +1345,9 @@ function PlayPageClient() {
},
},
{
+ name: '跳过片头片尾',
html: '跳过片头片尾',
- switch: skipConfig.enable,
+ switch: skipConfigRef.current.enable,
onSwitch: function (item) {
const newConfig = {
...skipConfigRef.current,
@@ -1296,12 +1358,24 @@ function PlayPageClient() {
},
},
{
+ html: '删除跳过配置',
+ onClick: function () {
+ handleSkipConfigChange({
+ enable: false,
+ intro_time: 0,
+ outro_time: 0,
+ });
+ return '';
+ },
+ },
+ {
+ name: '设置片头',
html: '设置片头',
icon: '',
tooltip:
- skipConfig.intro_time === 0
+ skipConfigRef.current.intro_time === 0
? '设置片头时间'
- : `${formatTime(skipConfig.intro_time)}`,
+ : `${formatTime(skipConfigRef.current.intro_time)}`,
onClick: function () {
const currentTime = artPlayerRef.current?.currentTime || 0;
if (currentTime > 0) {
@@ -1315,12 +1389,13 @@ function PlayPageClient() {
},
},
{
+ name: '设置片尾',
html: '设置片尾',
icon: '',
tooltip:
- skipConfig.outro_time >= 0
+ skipConfigRef.current.outro_time >= 0
? '设置片尾时间'
- : `-${formatTime(-skipConfig.outro_time)}`,
+ : `-${formatTime(-skipConfigRef.current.outro_time)}`,
onClick: function () {
const outroTime =
-(
@@ -1329,7 +1404,7 @@ function PlayPageClient() {
) || 0;
if (outroTime < 0) {
const newConfig = {
- ...skipConfig,
+ ...skipConfigRef.current,
outro_time: outroTime,
};
handleSkipConfigChange(newConfig);
diff --git a/src/lib/version.ts b/src/lib/version.ts
index f73a112..18a23c0 100644
--- a/src/lib/version.ts
+++ b/src/lib/version.ts
@@ -2,7 +2,7 @@
'use client';
-const CURRENT_VERSION = '20250731021807';
+const CURRENT_VERSION = '20250731130730';
// 版本检查结果枚举
export enum UpdateStatus {