Skip to content

Commit

Permalink
Merge pull request #961 from nicocatxzc/add-custom-playlist-option
Browse files Browse the repository at this point in the history
Add custom playlist option
  • Loading branch information
mirai-mamori authored Oct 31, 2024
2 parents 95de2a2 + 0b1f0fa commit e18ce6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion inc/swicher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
8 changes: 8 additions & 0 deletions opt/options/theme-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e18ce6b

Please sign in to comment.