From 99c65ce9e897b4fbcc138c5e86e60de24b457739 Mon Sep 17 00:00:00 2001 From: a76yyyy Date: Wed, 22 Feb 2023 13:46:44 +0800 Subject: [PATCH] fix qiandao-today/qiandao#374 --- libs/utils.py | 3 +++ web/static/coffee/har/analysis.coffee | 2 +- web/static/har/analysis.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/utils.py b/libs/utils.py index f13a3d264d1..4c324716e48 100644 --- a/libs/utils.py +++ b/libs/utils.py @@ -17,6 +17,7 @@ import jinja2 from Crypto.Cipher import AES from faker import Faker +from jinja2.filters import do_float, do_int from tornado import gen, httpclient import config @@ -799,6 +800,8 @@ def _aes_decrypt(word:str, key:str, mode='CBC', iv:str=None, input_format='base6 jinja_globals = { # types 'quote_chinese': quote_chinese, + 'int': do_int, + 'float': do_float, 'bool': to_bool, 'utf8': utf8, 'unicode': conver2unicode, diff --git a/web/static/coffee/har/analysis.coffee b/web/static/coffee/har/analysis.coffee index 4c63a1d73f4..ceda7b74369 100644 --- a/web/static/coffee/har/analysis.coffee +++ b/web/static/coffee/har/analysis.coffee @@ -4,7 +4,7 @@ # Created on 2014-08-02 10:07:33 window.jinja_globals = [ - 'quote_chinese', 'bool', 'utf8', 'unicode', 'timestamp', 'date_time', + 'quote_chinese', 'int', 'float', 'bool', 'utf8', 'unicode', 'timestamp', 'date_time', 'is_num', 'add', 'sub', 'multiply', 'divide', 'Faker', 'b64decode', 'b64encode', 'to_uuid', 'md5', 'sha1', 'password_hash', 'hash', 'aes_encrypt', 'aes_decrypt', 'regex_replace', 'regex_escape', diff --git a/web/static/har/analysis.js b/web/static/har/analysis.js index abe1a26ccdc..699a847254c 100644 --- a/web/static/har/analysis.js +++ b/web/static/har/analysis.js @@ -7,7 +7,7 @@ var base, base1, jinja_globals, indexOf = [].indexOf; - window.jinja_globals = ['quote_chinese', 'bool', 'utf8', 'unicode', 'timestamp', 'date_time', 'is_num', 'add', 'sub', 'multiply', 'divide', 'Faker', 'b64decode', 'b64encode', 'to_uuid', 'md5', 'sha1', 'password_hash', 'hash', 'aes_encrypt', 'aes_decrypt', 'regex_replace', 'regex_escape', 'regex_search', 'regex_findall', 'ternary', 'random', 'shuffle', 'mandatory', 'type_debug', 'dict', 'lipsum', 'range']; + window.jinja_globals = ['quote_chinese', 'int', 'float', 'bool', 'utf8', 'unicode', 'timestamp', 'date_time', 'is_num', 'add', 'sub', 'multiply', 'divide', 'Faker', 'b64decode', 'b64encode', 'to_uuid', 'md5', 'sha1', 'password_hash', 'hash', 'aes_encrypt', 'aes_decrypt', 'regex_replace', 'regex_escape', 'regex_search', 'regex_findall', 'ternary', 'random', 'shuffle', 'mandatory', 'type_debug', 'dict', 'lipsum', 'range']; jinja_globals = window.jinja_globals;