mirror of
https://github.com/MoePlayer/APlayer-Typecho.git
synced 2025-01-20 20:40:38 +08:00
[1.0.1] 添加防盗链,对无openssl主机兼容
This commit is contained in:
parent
f92d6a7e26
commit
c2a8b00f6c
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*!
|
||||
* Meting music framework
|
||||
* https://i-meto.com
|
||||
* Version 1.0.1
|
||||
* Version 1.0.2
|
||||
*
|
||||
* Copyright 2016, METO Sheel <i@i-meto.com>
|
||||
* 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(
|
||||
|
Loading…
Reference in New Issue
Block a user