diff --git a/Action.php b/Action.php index 6c9a3c5..7514bc0 100644 --- a/Action.php +++ b/Action.php @@ -81,6 +81,7 @@ class Meting_Action extends Typecho_Widget implements Widget_Interface_Do { } private function js(){ + self::filterReferer(); $PID=$this->request->get('id'); $data=$this->request->get('d'); $data=json_decode(base64_decode($data),1); @@ -136,6 +137,7 @@ var Meting{$PID} = new APlayer({ } private function url(){ + self::filterReferer(); $id=$this->request->get('id'); $site=$this->request->get('site'); $rate=Typecho_Widget::widget('Widget_Options')->plugin('Meting')->bitrate; @@ -152,6 +154,7 @@ var Meting{$PID} = new APlayer({ } private function pic(){ + self::filterReferer(); $id=$this->request->get('id'); $site=$this->request->get('site'); @@ -166,6 +169,7 @@ var Meting{$PID} = new APlayer({ } private function lrc(){ + self::filterReferer(); $id=$this->request->get('id'); $site=$this->request->get('site'); @@ -212,4 +216,7 @@ var Meting{$PID} = new APlayer({ else return false; } + private function filterReferer(){ + if(isset($_SERVER['HTTP_REFERER'])&&strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])===false)die(403); + } } diff --git a/Plugin.php b/Plugin.php index 04be71b..08765c2 100644 --- a/Plugin.php +++ b/Plugin.php @@ -6,13 +6,13 @@ if(!defined('__TYPECHO_ROOT_DIR__'))exit; * * @package Meting * @author METO - * @version 1.0.0 + * @version 1.0.1 * @dependence 13.12.12-* * @link https://github.com/metowolf/Meting * */ - define('METING_VERSION','1.0.0'); + define('METING_VERSION','1.0.1'); class Meting_Plugin extends Typecho_Widget implements Typecho_Plugin_Interface { diff --git a/include/Meting.php b/include/Meting.php index 0bc7af2..2c1b214 100644 --- a/include/Meting.php +++ b/include/Meting.php @@ -2,7 +2,7 @@ /*! * Meting music framework * https://i-meto.com - * Version 1.0.1 + * Version 1.0.2 * * Copyright 2016, METO Sheel * Released under the MIT license @@ -641,7 +641,13 @@ class Meting private function netease_AESECB($API){ $KEY='7246674226682325323F5E6544673A51'; $body=json_encode($API['body']); - $body=openssl_encrypt($body,'aes-128-ecb',hex2bin($KEY)); + if(function_exists('openssl_encrypt')){ + $body=openssl_encrypt($body,'aes-128-ecb',hex2bin($KEY)); + } + else{ + $PAD=16-(strlen($body)%16); + $body=base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128,hex2bin($KEY),$body.str_repeat(chr($PAD),$PAD),MCRYPT_MODE_ECB)); + } $body=strtoupper(bin2hex(base64_decode($body))); $API['body']=array(