feat: add aplyer options

add some music platforms, add netease-cloud-music cookies option
issue #211
pull/214/head
Spirit 2020-04-05 15:57:16 +08:00
parent 689fc6319d
commit 07763879a4
5 changed files with 34 additions and 7 deletions

View File

@ -148,11 +148,11 @@
<div class="show-hide-wrap"><button class="show-hide"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"></path></svg></button></div>
</aside>
<?php endif; ?>
<?php if (akina_option('playlist_id', '')): ?>
<?php if (akina_option('aplayer_server') != 'off'): ?>
<div id="aplayer-float" style="z-index: 100;"
class="aplayer"
data-id="<?php echo akina_option('playlist_id', ''); ?>"
data-server="netease"
data-id="<?php echo akina_option('aplayer_playlistid', ''); ?>"
data-server="<?php echo akina_option('aplayer_server'); ?>"
data-type="playlist"
data-fixed="true"
data-theme="orange">

View File

@ -36,6 +36,10 @@ add_action('rest_api_init', function () {
'methods' => 'POST',
'callback' => 'bgm_bilibili',
));
register_rest_route('sakura/v1', '/meting/aplyer', array(
'methods' => 'GET',
'callback' => 'meting_aplyer',
));
});
/**

View File

@ -67,8 +67,9 @@ mashiro_option.jsdelivr_css_src = "<?php echo get_template_directory_uri() ?>/cd
<?php } else { ?>
mashiro_option.jsdelivr_css_src = "https://cdn.jsdelivr.net/gh/mashirozx/Sakura@<?php echo SAKURA_VERSION; ?>/cdn/css/lib.min.css";
<?php } ?>
<?php if (akina_option('playlist_id', '')): ?>
<?php if (akina_option('aplayer_server') != 'off'): ?>
mashiro_option.float_player_on = true;
mashiro_option.meting_api_url = <?php echo rest_url('sakura/v1/meting/aplyer');?>;
<?php endif; ?>
mashiro_option.cover_api = "<?php echo rest_url('sakura/v1/image/cover'); ?>";

View File

@ -819,7 +819,7 @@ if (mashiro_option.float_player_on) {
}
});
}
var b = 'https://api.i-meto.com/meting/api?server=:server&type=:type&id=:id&r=:r';
var b = mashiro_option.meting_api_url + '?server=:server&type=:type&id=:id&r=:r';
'undefined' != typeof meting_api && (b = meting_api);
for (var f = 0; f < aplayers.length; f++) try {
aplayers[f].destroy()

View File

@ -923,11 +923,33 @@ function optionsframework_options()
$options[] = array(
'name' => __('Footer float music player', 'sakura'), /*页脚悬浮播放器*/
'desc' => __('If you don\'t need the player just leave it blank.Fill in the "song list" ID of Netease Cloud Music, eg: https://music.163.com/#/playlist?id=2288037900 The ID is 2288037900', 'sakura'), /*如果不需要播放器留空即可。填写网易云音乐的「歌单」IDeghttps://music.163.com/#/playlist?id=2288037900的ID是2288037900*/
'id' => 'playlist_id',
'desc' => __('Choose which platform you\'ll use.', 'sakura'),
'id' => 'aplayer_server',
'std' => "netease",
'type' => "radio",
'options' => array(
'netease' => __('Netease Cloud Music (default)', 'sakura'),
'xiami' => __('Xiami Music', 'sakura'),
'kugou' => __('KuGou Music', 'sakura'),
'baidu' => __('Baidu Music', 'sakura'),
'tencent' => __('QQ Music (may fail) ', 'sakura'),
'off' => __('Off', 'sakura'),
));
$options[] = array(
'name' => __('Song list ID', 'sakura'),
'desc' => __('Fill in the "song list" ID, eg: https://music.163.com/#/playlist?id=2288037900 The ID is 2288037900', 'sakura'),
'id' => 'aplayer_playlistid',
'std' => '2288037900',
'type' => 'text');
$options[] = array(
'name' => __('Netease Cloud Music cookie', 'sakura'),
'desc' => __('For Netease Cloud Music, fill in your vip account\'s cookies if you want to play special tracks.', 'sakura'),
'id' => 'aplayer_cookie',
'std' => '',
'type' => 'textarea');
$options[] = array(
'name' => __('Version Control', 'sakura'), /*版本控制*/
'desc' => __('Used to update frontend cookies and browser caches, any string can be used', 'sakura'), /*用于更新前端 cookie 及浏览器缓存,可使用任意字符串*/