diff --git a/functions.php b/functions.php index 94b9956..40dd752 100644 --- a/functions.php +++ b/functions.php @@ -1627,7 +1627,8 @@ function change_avatar($avatar){ preg_match('/:\"([^\"]*)\"/i',$qqavatar,$matches); return '😀'; }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 '😀'; } diff --git a/inc/api.php b/inc/api.php index a316c3f..8144c7a 100644 --- a/inc/api.php +++ b/inc/api.php @@ -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'){ diff --git a/manifest/manifest.py b/manifest/manifest.py index b8f5ecc..2394d06 100644 --- a/manifest/manifest.py +++ b/manifest/manifest.py @@ -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)