mirror of
https://github.com/mashirozx/sakura.git
synced 2024-12-12 09:54:35 +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);
|
||||
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{
|
||||
$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));
|
||||
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;
|
||||
$encrypted=$_GET["qq"];
|
||||
if(isset($encrypted)){
|
||||
$iv = SAKURA_VERSION;
|
||||
$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);
|
||||
$imgurl='https://q2.qlogo.cn/headimg_dl?dst_uin='.$matches[0].'&spec=100';
|
||||
if(akina_option('qq_avatar_link')=='type_2'){
|
||||
|
@ -44,10 +44,7 @@ class Single(object):
|
||||
def main(self):
|
||||
self.hash()
|
||||
# if os.path.exists(self.jpeg) and os.path.exists(self.webp):
|
||||
try:
|
||||
self.optimize()
|
||||
except OSError:
|
||||
print("Falied to optimize the picture: " + self.file)
|
||||
self.optimize()
|
||||
self.manifest()
|
||||
return self.mani
|
||||
|
||||
@ -56,10 +53,13 @@ def gen_manifest_json():
|
||||
id = 1
|
||||
Manifest = {}
|
||||
for f in onlyfiles:
|
||||
worker = Single(f, Manifest)
|
||||
Manifest = worker.main()
|
||||
print(str(id) + '/' + str(len(onlyfiles)))
|
||||
id += 1
|
||||
try:
|
||||
worker = Single(f, Manifest)
|
||||
Manifest = worker.main()
|
||||
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:
|
||||
json.dump(Manifest, json_file)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user