From ffb8658fcd56579d06c8587eb64da73d721eb713 Mon Sep 17 00:00:00 2001 From: "cn.yimian.xyz" Date: Tue, 17 May 2022 21:27:18 +0800 Subject: [PATCH] tmp_cdn --- functions.php | 4 ++-- index.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index b13e04b..cb4cd8b 100755 --- a/functions.php +++ b/functions.php @@ -312,7 +312,7 @@ function getImgOneindex($path){ function getImgCDN($path){ if(stripos($path, 'moe') !== false){ preg_match_all('/img_(\S*?)_(\d{2,4})x(\d{2,4})_(\S*?)_(\S*?)_(\S*?).(jpe?g|png|gif|svg)\b/', $path, $arr); - return str_replace('moe','https://cdn.jsdelivr.net/npm/ushio-api-img-moe@5.0.'.intval($arr[1][0]/10).'',$path); + return 'https://proxy.yimian.xyz/get/?url='.base64_encode(str_replace('moe','https://cdn.jsdelivr.net/npm/ushio-api-img-moe@5.0.'.intval($arr[1][0]/10).'',$path)); } return getImg($path); } @@ -322,7 +322,7 @@ function getImgCDNwallpaper($path){ $date = strtotime($arr[1][0].' 00:00:00'); $dateline = strtotime('2021-07-11 00:00:00'); if($date < $dateline) - return str_replace('wallpaper','https://cdn.jsdelivr.net/npm/ushio-api-img-wallpaper@1.1'.date('y.nw', $date).'',$path); + return 'https://proxy.yimian.xyz/get/?url='.base64_encode(str_replace('wallpaper','https://cdn.jsdelivr.net/npm/ushio-api-img-wallpaper@1.1'.date('y.nw', $date).'',$path)); else return getImg($path); } diff --git a/index.php b/index.php index 269a9c3..0011a17 100755 --- a/index.php +++ b/index.php @@ -170,10 +170,12 @@ yimian__log("log_api", array("api" => "img", "timestamp" => date('Y-m-d H:i:s', function returnImg($path){ if($GLOBALS['type'] != 'wallpaper' && $GLOBALS['type'] != 'imgbed' && $GLOBALS['type'] != 'path' /*&& ((!in_array($GLOBALS['__from'], $GLOBALS['whiteList']) && ($GLOBALS['_num'] > 0 || $GLOBALS['_ip'] > 0)) || ($GLOBALS['_ip'] > 0))*/) { - $url = getImgCDN($path); + $url = getImgCDN($path); //$url = getImgOneindex($path); + // $url = getImg($path); }else{ if($GLOBALS['type'] == 'wallpaper') { + //$url = getImg($path); $url = getImgCDNwallpaper($path); }else{ $url = getImg($path);