mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-25 00:08:13 +08:00
fix
This commit is contained in:
parent
6b8e7b0ede
commit
3e34024bd9
@ -1627,7 +1627,8 @@ function change_avatar($avatar){
|
|||||||
preg_match('/:\"([^\"]*)\"/i',$qqavatar,$matches);
|
preg_match('/:\"([^\"]*)\"/i',$qqavatar,$matches);
|
||||||
return '<img src="'.$matches[1].'" data-src="'.stripslashes($m[1]).'" class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
|
return '<img src="'.$matches[1].'" data-src="'.stripslashes($m[1]).'" class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
|
||||||
}else{
|
}else{
|
||||||
$encrypted = openssl_encrypt($qq_number, 'aes-128-cbc', $sakura_privkey, 0);
|
$iv = SAKURA_VERSION;
|
||||||
|
$encrypted = openssl_encrypt($qq_number, 'aes-128-cbc', $sakura_privkey, 0, $iv);
|
||||||
$encrypted = urlencode(base64_encode($encrypted));
|
$encrypted = urlencode(base64_encode($encrypted));
|
||||||
return '<img src="'.rest_url("sakura/v1/qqinfo/avatar").'?qq='.$encrypted.'"class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
|
return '<img src="'.rest_url("sakura/v1/qqinfo/avatar").'?qq='.$encrypted.'"class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
|
||||||
}
|
}
|
||||||
|
@ -401,8 +401,9 @@ function get_qq_avatar(){
|
|||||||
global $sakura_privkey;
|
global $sakura_privkey;
|
||||||
$encrypted=$_GET["qq"];
|
$encrypted=$_GET["qq"];
|
||||||
if(isset($encrypted)){
|
if(isset($encrypted)){
|
||||||
|
$iv = SAKURA_VERSION;
|
||||||
$encrypted = urldecode(base64_decode($encrypted));
|
$encrypted = urldecode(base64_decode($encrypted));
|
||||||
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0);
|
$qq_number = openssl_decrypt($encrypted, 'aes-128-cbc', $sakura_privkey, 0, $iv);
|
||||||
preg_match('/^\d{3,}$/', $qq_number, $matches);
|
preg_match('/^\d{3,}$/', $qq_number, $matches);
|
||||||
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';
|
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';
|
||||||
if(akina_option('qq_avatar_link')=='type_2'){
|
if(akina_option('qq_avatar_link')=='type_2'){
|
||||||
|
@ -44,10 +44,7 @@ class Single(object):
|
|||||||
def main(self):
|
def main(self):
|
||||||
self.hash()
|
self.hash()
|
||||||
# if os.path.exists(self.jpeg) and os.path.exists(self.webp):
|
# if os.path.exists(self.jpeg) and os.path.exists(self.webp):
|
||||||
try:
|
self.optimize()
|
||||||
self.optimize()
|
|
||||||
except OSError:
|
|
||||||
print("Falied to optimize the picture: " + self.file)
|
|
||||||
self.manifest()
|
self.manifest()
|
||||||
return self.mani
|
return self.mani
|
||||||
|
|
||||||
@ -56,10 +53,13 @@ def gen_manifest_json():
|
|||||||
id = 1
|
id = 1
|
||||||
Manifest = {}
|
Manifest = {}
|
||||||
for f in onlyfiles:
|
for f in onlyfiles:
|
||||||
worker = Single(f, Manifest)
|
try:
|
||||||
Manifest = worker.main()
|
worker = Single(f, Manifest)
|
||||||
print(str(id) + '/' + str(len(onlyfiles)))
|
Manifest = worker.main()
|
||||||
id += 1
|
print(str(id) + '/' + str(len(onlyfiles)))
|
||||||
|
id += 1
|
||||||
|
except OSError:
|
||||||
|
print("Falied to optimize the picture: " + f)
|
||||||
with open('manifest.json', 'w+') as json_file:
|
with open('manifest.json', 'w+') as json_file:
|
||||||
json.dump(Manifest, json_file)
|
json.dump(Manifest, json_file)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user