Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
spirit1431007 committed Dec 21, 2019
1 parent 6b8e7b0 commit 3e34024
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion functions.php
Expand Up @@ -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)">';
}
Expand Down
3 changes: 2 additions & 1 deletion inc/api.php
Expand Up @@ -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'){
Expand Down
16 changes: 8 additions & 8 deletions manifest/manifest.py
Expand Up @@ -44,10 +44,7 @@ def manifest(self):
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

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

Expand Down

0 comments on commit 3e34024

Please sign in to comment.