This commit is contained in:
spirit 2019-12-21 21:18:32 +08:00
parent 6b8e7b0ede
commit 3e34024bd9
3 changed files with 12 additions and 10 deletions

View File

@ -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)">';
}

View File

@ -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'){

View File

@ -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)