diff --git a/inc/swicher.php b/inc/swicher.php index 35333650..da937bfb 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'); + //自定义歌单 + $meting_api_def = json_encode($iro_opt, JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE); + if (!empty(iro_opt('custom_music_api'))) { + $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 = ' . $meting_api_def, 'before'); } add_action('wp_head', 'font_end_js_control'); diff --git a/opt/options/theme-options.php b/opt/options/theme-options.php index b068f391..fb47e2fc 100644 --- a/opt/options/theme-options.php +++ b/opt/options/theme-options.php @@ -856,6 +856,14 @@ function iro_validate_optional_url( $value ) { 'default' => 'off' ), + array( + 'id' => 'custom_music_api', + 'type' => 'text', + 'title' => __('Use custom Meting API or playlist','sakurairo_csf'), + 'dependency' => array( 'aplayer_server', '!=', 'off', '', 'true' ), + '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( 'id' => 'aplayer_server_proxy', 'type' => 'text',