From ef9c873040a12ccd422beea1ad8b8af12579139c Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:52:59 +0800 Subject: [PATCH 1/7] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当自定义歌单启用时,将meting_api_url替换为自定义链接 --- inc/swicher.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/swicher.php b/inc/swicher.php index 35333650..ca37aaf6 100644 --- a/inc/swicher.php +++ b/inc/swicher.php @@ -134,6 +134,13 @@ function iro_get_the_author_name() $sakura_effect = iro_opt('sakura_falling_effects'); if ($sakura_effect != 'off') $iro_opt['effect'] = array('amount' => $sakura_effect); if (iro_opt('theme_darkmode_auto')) $iro_opt['dm_strategy'] = iro_opt('theme_darkmode_strategy', 'time'); - wp_add_inline_script('app', 'var _iro = ' . json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE), 'before'); + //wp_add_inline_script('app', 'var _iro = ' . json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE), 'before'); + //自定义歌单 + $iro_custom = json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE); + if (iro_opt('aplayer_server') == 'custom') { + $custom_url = iro_opt('custom_server'); // 获取 custom_server 的值 + $iro_custom = preg_replace('/"meting_api_url":"[^"]*"/', '"meting_api_url":"' . $custom_url . '"', $iro_custom); // 替换 meting_api_url 的内容 + } + wp_add_inline_script('app', 'var _iro = ' . $iro_custom, 'before'); } add_action('wp_head', 'font_end_js_control'); From edc3a796813aef324fc318e53085cc10a2696c79 Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:53:37 +0800 Subject: [PATCH 2/7] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加自定义歌单选项 --- opt/options/theme-options.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opt/options/theme-options.php b/opt/options/theme-options.php index 2dc93c6f..40974dfe 100644 --- a/opt/options/theme-options.php +++ b/opt/options/theme-options.php @@ -844,10 +844,19 @@ function iro_validate_optional_url( $value ) { 'netease' => __('Netease Cloud Music','sakurairo_csf'), 'kugou' => __('Kugou Music(may not be available)','sakurairo_csf'), 'tencent' => __('QQ Music(may not be available)','sakurairo_csf'), + 'custom' => __('custom server','sakurairo_csf'), ), 'default' => 'off' ), + array( + 'id' => 'custom_server', + 'type' => 'text', + 'title' => __('Custom_server','sakurairo_csf'), + 'dependency' => array( 'aplayer_server', '==', 'custom', '', 'true' ), + 'desc' => __('Custom Server','sakurairo_csf'), + ), + array( 'id' => 'aplayer_server_proxy', 'type' => 'text', From f4532b8c9581bd2f72b7de81cd35e36839bbb2b7 Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:52:20 +0800 Subject: [PATCH 3/7] Update theme-options.php --- opt/options/theme-options.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opt/options/theme-options.php b/opt/options/theme-options.php index 40974dfe..b12b5626 100644 --- a/opt/options/theme-options.php +++ b/opt/options/theme-options.php @@ -852,9 +852,9 @@ function iro_validate_optional_url( $value ) { array( 'id' => 'custom_server', 'type' => 'text', - 'title' => __('Custom_server','sakurairo_csf'), + 'title' => __('Custom playlist','sakurairo_csf'), 'dependency' => array( 'aplayer_server', '==', 'custom', '', 'true' ), - 'desc' => __('Custom Server','sakurairo_csf'), + 'desc' => __('Use custom playlist or meting-api','sakurairo_csf'), ), array( From e1fc033cfd407c88424e19f06cc892fdb9a948d1 Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Thu, 31 Oct 2024 00:01:18 +0800 Subject: [PATCH 4/7] Update theme-options.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复之前使用自定义api但是服务器指向custom --- opt/options/theme-options.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/opt/options/theme-options.php b/opt/options/theme-options.php index b12b5626..3fbbd2eb 100644 --- a/opt/options/theme-options.php +++ b/opt/options/theme-options.php @@ -844,17 +844,16 @@ function iro_validate_optional_url( $value ) { 'netease' => __('Netease Cloud Music','sakurairo_csf'), 'kugou' => __('Kugou Music(may not be available)','sakurairo_csf'), 'tencent' => __('QQ Music(may not be available)','sakurairo_csf'), - 'custom' => __('custom server','sakurairo_csf'), ), 'default' => 'off' ), array( - 'id' => 'custom_server', + 'id' => 'custom_music_api', 'type' => 'text', - 'title' => __('Custom playlist','sakurairo_csf'), - 'dependency' => array( 'aplayer_server', '==', 'custom', '', 'true' ), - 'desc' => __('Use custom playlist or meting-api','sakurairo_csf'), + 'title' => __('自定义歌单','sakurairo_csf'), + 'dependency' => array( 'aplayer_server', '!=', 'off', '', 'true' ), + 'desc' => __('使用自定义meting-api,也可以指向歌单文件,但只有填了歌单id才生效','sakurairo_csf'), ), array( From 546f2e086cf907d23b0049f4e2448f1386541013 Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Thu, 31 Oct 2024 00:04:21 +0800 Subject: [PATCH 5/7] Update swicher.php --- inc/swicher.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/swicher.php b/inc/swicher.php index ca37aaf6..d7961d7f 100644 --- a/inc/swicher.php +++ b/inc/swicher.php @@ -137,8 +137,8 @@ function iro_get_the_author_name() //wp_add_inline_script('app', 'var _iro = ' . json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE), 'before'); //自定义歌单 $iro_custom = json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE); - if (iro_opt('aplayer_server') == 'custom') { - $custom_url = iro_opt('custom_server'); // 获取 custom_server 的值 + if (!empty(iro_opt('custom_music_api'))) { + $custom_url = iro_opt('custom_music_api'); // 获取 custom_music_api 的值 $iro_custom = preg_replace('/"meting_api_url":"[^"]*"/', '"meting_api_url":"' . $custom_url . '"', $iro_custom); // 替换 meting_api_url 的内容 } wp_add_inline_script('app', 'var _iro = ' . $iro_custom, 'before'); From 8ea7882ba5898608f150abc59a996b62b8bd620f Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Thu, 31 Oct 2024 00:11:12 +0800 Subject: [PATCH 6/7] Update swicher.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改变量名,防止与将来可能的变量名冲突 --- inc/swicher.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/swicher.php b/inc/swicher.php index d7961d7f..da937bfb 100644 --- a/inc/swicher.php +++ b/inc/swicher.php @@ -136,11 +136,11 @@ function iro_get_the_author_name() if (iro_opt('theme_darkmode_auto')) $iro_opt['dm_strategy'] = iro_opt('theme_darkmode_strategy', 'time'); //wp_add_inline_script('app', 'var _iro = ' . json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE), 'before'); //自定义歌单 - $iro_custom = json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE); + $meting_api_def = json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE); if (!empty(iro_opt('custom_music_api'))) { - $custom_url = iro_opt('custom_music_api'); // 获取 custom_music_api 的值 - $iro_custom = preg_replace('/"meting_api_url":"[^"]*"/', '"meting_api_url":"' . $custom_url . '"', $iro_custom); // 替换 meting_api_url 的内容 + $custom_api_url = iro_opt('custom_music_api'); // 获取 custom_server 的值 + $meting_api_def = preg_replace('/"meting_api_url":"[^"]*"/', '"meting_api_url":"' . $custom_api_url . '"', $meting_api_def); // 替换 meting_api_url 的内容 } - wp_add_inline_script('app', 'var _iro = ' . $iro_custom, 'before'); + wp_add_inline_script('app', 'var _iro = ' . $meting_api_def, 'before'); } add_action('wp_head', 'font_end_js_control'); From 0b1f0fa36de4d13f3d6973499aa7dce73c353347 Mon Sep 17 00:00:00 2001 From: nicocatxzc <114812330+nicocatxzc@users.noreply.github.com> Date: Thu, 31 Oct 2024 02:59:22 +0800 Subject: [PATCH 7/7] Update theme-options.php --- opt/options/theme-options.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opt/options/theme-options.php b/opt/options/theme-options.php index 3fbbd2eb..04193fd4 100644 --- a/opt/options/theme-options.php +++ b/opt/options/theme-options.php @@ -851,9 +851,9 @@ function iro_validate_optional_url( $value ) { array( 'id' => 'custom_music_api', 'type' => 'text', - 'title' => __('自定义歌单','sakurairo_csf'), + 'title' => __('Use custom Meting API or playlist','sakurairo_csf'), 'dependency' => array( 'aplayer_server', '!=', 'off', '', 'true' ), - 'desc' => __('使用自定义meting-api,也可以指向歌单文件,但只有填了歌单id才生效','sakurairo_csf'), + 'desc' => __('Enter a custom Meting-api, which can also point to a playlist file. However, the ID will only be effective if the playlist is specified','sakurairo_csf'), ), array(