From 47918d49a1adec083a75801e6ac438c56b9b99af Mon Sep 17 00:00:00 2001 From: zhouzhongping Date: Tue, 31 Oct 2023 18:04:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A2=98=EF=BC=9A=E9=9A=90=E7=A7=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=8F=8A=E8=83=8C=E6=99=AF=E9=9F=B3=E4=B9=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 首页提示选择是否开启音乐 - 网络请求 timeout=30s --- src/config.py | 2 -- src/tools.py | 6 ++-- static/painting/css/painting.css | 41 ++++++++++++++++++++++++ templates/painting.html | 54 ++++++++++++++++++++++++++++++-- 4 files changed, 95 insertions(+), 8 deletions(-) diff --git a/src/config.py b/src/config.py index 31e078f..b0a3581 100644 --- a/src/config.py +++ b/src/config.py @@ -31,8 +31,6 @@ class Config: logger.error(f"没有权限读取配置文件 {self.path}: {str(e)}") raise - logger.info(f"配置文件 {self.path} 加载成功") - @property def rss_url(self): try: diff --git a/src/tools.py b/src/tools.py index cfd2dee..6ca3053 100644 --- a/src/tools.py +++ b/src/tools.py @@ -13,14 +13,14 @@ def check_website_status(url): :return:True 可以访问,False 不可以。 """ try: - response = requests.get(url, timeout=5) # Set timeout to 5 seconds + response = requests.get(url, timeout=30) # Set timeout to 5 seconds if response.status_code == 200: return True else: logger.error(f"{url} 网站无法访问,状态码:{response.status_code}") return False except requests.Timeout as e: - logger.error(f"{url} 请求超时,错误:{e}") + logger.error(f"{url} 请求超时 30 秒,错误:{e}") return False except requests.ConnectionError as e: logger.error(f"{url} 连接错误,错误:{e}") @@ -57,7 +57,7 @@ def get_domain_life(url): domain_url = f"https://rdap.verisign.com/com/v1/domain/{url}" try: - response = requests.get(domain_url, headers=headers) + response = requests.get(domain_url, headers=headers, timeout=30) response.raise_for_status() # Raises stored HTTPError, if one occurred. registration_date = response.json().get('events')[0].get('eventDate') diff --git a/static/painting/css/painting.css b/static/painting/css/painting.css index fe07883..a7f42f0 100644 --- a/static/painting/css/painting.css +++ b/static/painting/css/painting.css @@ -76,6 +76,47 @@ html { #tab1 { background-image: url('../img/page1.jpg'); + position: relative; +} + +.popup { + position: absolute; + bottom: 0.5rem; + background: #fff; + padding: 1.5rem; + border: 1px solid #d1d1d1; +} + +.popup > .notice > hr { + margin: 1rem 0; +} + +.popup > .selection { + text-align: right; +} + +.selection > button { + border: none; + padding: 0.75rem 1rem; + margin: 0.5rem 0 0 0.5rem; +} + +.allow { + cursor: pointer; +} + +.deny { + background-color: #059862; + cursor: pointer; + color: #fff; + padding: 0.5rem 0; + opacity: 0.8; +} + +.deny:hover, +.deny:focus { + opacity: 1; + cursor: pointer; } #tab2 { diff --git a/templates/painting.html b/templates/painting.html index 0ff659d..d8c709e 100644 --- a/templates/painting.html +++ b/templates/painting.html @@ -13,10 +13,37 @@ {% endif %} - + -
+
+ + +

亲爱的{{ data.blog_name }}

@@ -70,11 +97,14 @@