Skip to content

Commit 210ccaf

Browse files
committed
🐛 2.0.1,修复一处严重 BUG
- 修复 APlayer.min.js 路径错误 - 简单粗暴地修复网易云音乐防盗链
1 parent f120096 commit 210ccaf

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

Action.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,19 @@ private function api(){
6464
if(empty($data)){
6565
$rate=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->bitrate;
6666
$cookie=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->cookie;
67-
if($server=='netease')$api->cookie($cookie);
67+
if($server=='netease'&&!empty($cookie))$api->cookie($cookie);
6868
$data=$api->url($id,$rate);
6969
$this->cacheWrite($EID,$data);
7070
}
7171
$data=json_decode($data,true);
7272
$url=$data['url'];
7373

74-
$url=str_replace('http://m8','https://m8',$url);
75-
$url=str_replace('http://m7','https://m8',$url);
76-
$url=str_replace('http://m10','https://m10',$url);
74+
if($server=='netease'){
75+
$url=str_replace('://m8c.','://m8.',$url);
76+
$url=str_replace('http://m8.','https://m8.',$url);
77+
$url=str_replace('http://m7.','https://m8.',$url);
78+
$url=str_replace('http://m10.','https://m10.',$url);
79+
}
7780

7881
if(empty($url))$url='https://api.i-meto.com/Public/music/empty.mp3';
7982
$this->response->redirect($url);

Plugin.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
*
77
* @package APlayer for Typecho | Meting
88
* @author METO
9-
* @version 2.0.0
9+
* @version 2.0.1
1010
* @dependence 14.10.10-*
1111
* @link https://github.com/MoePlayer/APlayer-Typecho
1212
*
1313
*/
1414

15-
define('METING_VERSION','2.0.0');
15+
define('METING_VERSION','2.0.1');
1616

1717
class Meting_Plugin extends Typecho_Widget implements Typecho_Plugin_Interface
1818
{
@@ -139,7 +139,7 @@ public static function header(){
139139
$api=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->api;
140140
$dir=Helper::options()->pluginUrl.'/Meting/assets';
141141
$ver=METING_VERSION;
142-
echo "<script type=\"text/javascript\" src=\"{$dir}/aplayer.min.js?v={$ver}\"></script>\n";
142+
echo "<script type=\"text/javascript\" src=\"{$dir}/APlayer.min.js?v={$ver}\"></script>\n";
143143
echo "<script>var meting_api=\"{$api}\";</script>";
144144
}
145145

@@ -173,11 +173,11 @@ public static function parseMusic($matches,$setting){
173173
foreach($matches as $vo){
174174
$t=self::shortcode_parse_atts(htmlspecialchars_decode($vo));
175175
$player=array(
176-
'theme' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->theme?:'red',
177-
'preload' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->preload?:'auto',
178-
'autoplay' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->autoplay?:'false',
179-
'height' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->height?:'340px',
180-
'mode' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->mode?:'circulation',
176+
'theme' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->theme?:'red',
177+
'preload' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->preload?:'auto',
178+
'autoplay' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->autoplay?:'false',
179+
'listmaxheight' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->height?:'340px',
180+
'mode' => Typecho_Widget::widget('Widget_Options')->plugin('Meting')->mode?:'circulation',
181181
);
182182
if(isset($t['server'])){
183183
if(!in_array($t['server'],array('netease','tencent','xiami','baidu','kugou')))continue;
@@ -205,7 +205,7 @@ public static function addButton(){
205205
$url=Typecho_Common::url('action/metingapi',Helper::options()->index).'?do=parse';
206206
$dir=Helper::options()->pluginUrl.'/Meting/assets/editer.js?v='.METING_VERSION;
207207
echo "<script type=\"text/javascript\">var murl='{$url}';</script>
208-
<script type=\"text/javascript\" src=\"{$dir}\"></script>";
208+
<script type=\"text/javascript\" src=\"{$dir}\"></script>";
209209
}
210210

211211
# https://github.com/WordPress/WordPress/blob/master/wp-includes/shortcodes.php#L508

assets/Meting.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)