Skip to content

Commit

Permalink
🐛 2.0.1,修复一处严重 BUG
Browse files Browse the repository at this point in the history
 - 修复 APlayer.min.js 路径错误
 - 简单粗暴地修复网易云音乐防盗链
  • Loading branch information
metowolf committed Oct 2, 2017
1 parent f120096 commit 210ccaf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
11 changes: 7 additions & 4 deletions Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,19 @@ private function api(){
if(empty($data)){
$rate=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->bitrate;
$cookie=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->cookie;
if($server=='netease')$api->cookie($cookie);
if($server=='netease'&&!empty($cookie))$api->cookie($cookie);
$data=$api->url($id,$rate);
$this->cacheWrite($EID,$data);
}
$data=json_decode($data,true);
$url=$data['url'];

$url=str_replace('http://m8','https://m8',$url);
$url=str_replace('http://m7','https://m8',$url);
$url=str_replace('http://m10','https://m10',$url);
if($server=='netease'){
$url=str_replace('://m8c.','://m8.',$url);
$url=str_replace('http://m8.','https://m8.',$url);
$url=str_replace('http://m7.','https://m8.',$url);
$url=str_replace('http://m10.','https://m10.',$url);
}

if(empty($url))$url='https://api.i-meto.com/Public/music/empty.mp3';
$this->response->redirect($url);
Expand Down
18 changes: 9 additions & 9 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*
* @package APlayer for Typecho | Meting
* @author METO
* @version 2.0.0
* @version 2.0.1
* @dependence 14.10.10-*
* @link https://github.com/MoePlayer/APlayer-Typecho
*
*/

define('METING_VERSION','2.0.0');
define('METING_VERSION','2.0.1');

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

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

# https://github.com/WordPress/WordPress/blob/master/wp-includes/shortcodes.php#L508
Expand Down
4 changes: 2 additions & 2 deletions assets/Meting.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 210ccaf

Please sign in to comment.