|
import gradio as gr |
|
import requests |
|
import logging |
|
import datetime |
|
import threading |
|
import time |
|
from pytz import timezone |
|
from collections import defaultdict |
|
|
|
logging.basicConfig(level=logging.INFO) |
|
|
|
|
|
VALID_USERNAME = "ets2020" |
|
VALID_PASSWORD = "1089" |
|
|
|
|
|
is_logged_in = False |
|
|
|
|
|
def process_logout(): |
|
global is_logged_in |
|
is_logged_in = False |
|
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), None |
|
|
|
|
|
CREDENTIALS = { |
|
"whispersound": ["*****", "*****"], |
|
"happydoggg": ["*****", "*****"], |
|
"magictreee": ["*****", "*****"], |
|
"fastcarr": ["*****", "*****"], |
|
"corpcorp1": ["*****", "*****"], |
|
"rara527": ["*****", "*****"], |
|
"bluskyyy": ["*****", "*****"], |
|
"ssboost": ["*****", "*****"], |
|
"ekdhstldhs": ["*****", "*****"], |
|
} |
|
|
|
|
|
TARGETS = [ |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ", "url": "https://huggingface.co/spaces/whispersound/kmkm_1-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/whispersound/kmkm_2-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/whispersound/kmkm_3-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ", "url": "https://huggingface.co/spaces/whispersound/kmkm_4-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-๋ฐฉ๋ฌธํ๊ธฐ", "url": "https://huggingface.co/spaces/whispersound/kmkm_5-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ", "url": "https://huggingface.co/spaces/whispersound/mmmha_1-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/whispersound/mmmha_2-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/whispersound/mmmha_3-1"}, |
|
{"name": "์ ํ๋ธ-์์ฝ", "url": "https://huggingface.co/spaces/whispersound/ybyb-r-1"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ผ๋ฐ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_1-1"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๊ฑด๊ฐ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_1-2-1"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ฌํ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_2-1"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/whispersound/ybyb_3-1"}, |
|
{"name": "์ด์ปค๋จธ์ค-์นดํผ๋ผ์ดํ
", "url": "https://huggingface.co/spaces/whispersound/LuLu_cp_1_R-1"}, |
|
{"name": "์ด์ปค๋จธ-์์ธํ์ด์ง๊ธฐํ", "url": "https://huggingface.co/spaces/whispersound/plpl_1-1"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/whispersound/kmkm_1-4"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/whispersound/kmkm_3-4"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/whispersound/kmkm_4-4"}, |
|
|
|
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/fastcarr/ldleeer1-1"}, |
|
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/fastcarr/lleryr1-1"}, |
|
{"name": "์ปจํธ๋กค-์ ํ๋ธ", "url": "https://huggingface.co/spaces/fastcarr/kketywe1-1"}, |
|
{"name": "์ปจํธ๋กค-์นดํผ์์ธ", "url": "https://huggingface.co/spaces/fastcarr/euywe1-1"}, |
|
{"name": "๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/fastcarr/vvvpppp_1-1"}, |
|
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ", "url": "https://huggingface.co/spaces/fastcarr/ttpp323-1"}, |
|
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ", "url": "https://huggingface.co/spaces/fastcarr/YT_Ts_R-1"}, |
|
{"name": "๊ธฐ๋ฅ-PDF์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/fastcarr/gaewate1-1"}, |
|
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/fastcarr/ttpp323-4"}, |
|
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ(์ ํด์ฉ)", "url": "https://huggingface.co/spaces/fastcarr/YT_Ts_R-4"}, |
|
|
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_1-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_2-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_3-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_4-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-๋ฐฉ๋ฌธํ๊ธฐ", "url": "https://huggingface.co/spaces/happydoggg/kmkm_5-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ", "url": "https://huggingface.co/spaces/happydoggg/mmmha_1-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/happydoggg/mmmha_2-2"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/happydoggg/mmmha_3-2"}, |
|
{"name": "์ ํ๋ธ-์์ฝ", "url": "https://huggingface.co/spaces/happydoggg/ybyb-r-2"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ผ๋ฐ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_1-2"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๊ฑด๊ฐ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_1-2-2"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ฌํ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_2-2"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/happydoggg/ybyb_3-2"}, |
|
{"name": "์ด์ปค๋จธ์ค-์นดํผ๋ผ์ดํ
", "url": "https://huggingface.co/spaces/happydoggg/LuLu_cp_1_R-2"}, |
|
{"name": "์ด์ปค๋จธ์ค-์์ธํ์ด์ง๊ธฐํ", "url": "https://huggingface.co/spaces/happydoggg/plpl_1-2"}, |
|
|
|
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/corpcorp1/ldleeer1-2"}, |
|
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/corpcorp1/lleryr1-2"}, |
|
{"name": "์ปจํธ๋กค-์ ํ๋ธ", "url": "https://huggingface.co/spaces/corpcorp1/kketywe1-2"}, |
|
{"name": "์ปจํธ๋กค-์นดํผ์์ธ", "url": "https://huggingface.co/spaces/corpcorp1/euywe1-2"}, |
|
{"name": "๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/corpcorp1/vvvpppp_1-2"}, |
|
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ", "url": "https://huggingface.co/spaces/corpcorp1/ttpp323-2"}, |
|
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ", "url": "https://huggingface.co/spaces/corpcorp1/YT_Ts_R-2"}, |
|
{"name": "๊ธฐ๋ฅ-PDF์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/corpcorp1/gaewate1-2"}, |
|
|
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ+์ํ๊ฑด๊ฐ", "url": "https://huggingface.co/spaces/magictreee/kmkm_1-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/magictreee/kmkm_2-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/magictreee/kmkm_3-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-ํต์ฌ๊ธฐ๋ฅ", "url": "https://huggingface.co/spaces/magictreee/kmkm_4-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-๋ฐฉ๋ฌธํ๊ธฐ", "url": "https://huggingface.co/spaces/magictreee/kmkm_5-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ผ๋ฐ", "url": "https://huggingface.co/spaces/magictreee/mmmha_1-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ฌํ", "url": "https://huggingface.co/spaces/magictreee/mmmha_2-3"}, |
|
{"name": "์๋๋ธ๋ก๊ทธ-์ํ๋ฆฌ๋ทฐ", "url": "https://huggingface.co/spaces/magictreee/mmmha_3-3"}, |
|
{"name": "์ ํ๋ธ-์์ฝ", "url": "https://huggingface.co/spaces/magictreee/ybyb-r-3"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ผ๋ฐ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_1-3"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๊ฑด๊ฐ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_1-2-3"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ฌํ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_2-3"}, |
|
{"name": "์ ํ๋ธ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/magictreee/ybyb_3-3"}, |
|
{"name": "์ด์ปค๋จธ์ค-์นดํผ๋ผ์ดํ
", "url": "https://huggingface.co/spaces/magictreee/LuLu_cp_1_R-3"}, |
|
{"name": "์ด์ปค๋จธ์ค-์์ธํ์ด์ง๊ธฐํ", "url": "https://huggingface.co/spaces/magictreee/plpl_1-3"}, |
|
|
|
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/rara527/ldleeer1-3"}, |
|
{"name": "์ปจํธ๋กค-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/rara527/lleryr1-3"}, |
|
{"name": "์ปจํธ๋กค-์ ํ๋ธ", "url": "https://huggingface.co/spaces/rara527/kketywe1-3"}, |
|
{"name": "์ปจํธ๋กค-์นดํผ์์ธ", "url": "https://huggingface.co/spaces/rara527/euywe1-3"}, |
|
{"name": "๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/rara527/vvvpppp_1-3"}, |
|
{"name": "๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ๋กค๋ฌ", "url": "https://huggingface.co/spaces/rara527/ttpp323-3"}, |
|
{"name": "๊ธฐ๋ฅ-์ ํ๋ธ๋๋ณธ์ถ์ถ๊ธฐ", "url": "https://huggingface.co/spaces/rara527/YT_Ts_R-3"}, |
|
{"name": "๊ธฐ๋ฅ-PDF์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/rara527/gaewate1-3"}, |
|
|
|
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-์ํ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง", "url": "https://huggingface.co/spaces/bluskyyy/asvdqw3g234"}, |
|
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/bluskyyy/4234g5hhs"}, |
|
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-์ด๋ฏธ์ง์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/bluskyyy/asdfqwe"}, |
|
{"name": "๋ฉ์ธ๊ธฐ๋ฅ-๋ธ๋ก๊ทธํฌ์คํ
", "url": "https://huggingface.co/spaces/bluskyyy/33f23f3f-3"}, |
|
|
|
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์ ๊ฑฐ", "url": "https://huggingface.co/spaces/ssboost/B_G"}, |
|
{"name": "์ด๋ฏธ์ง-ํ์ง๊ฐ์ ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/Up_G"}, |
|
{"name": "์ด๋ฏธ์ง-ModelSwap", "url": "https://huggingface.co/spaces/ssboost/ModelSwap-1"}, |
|
{"name": "์ด๋ฏธ์ง-ํํฐ", "url": "https://huggingface.co/spaces/ssboost/Image_Filter-1"}, |
|
{"name": "์ด๋ฏธ์ง-๋ณต์", "url": "https://huggingface.co/spaces/ssboost/old_restoration-1"}, |
|
{"name": "์ด๋ฏธ์ง-์ด์ปค๋จธ์คAI์ด๋ฏธ์ง์์ฑ", "url": "https://huggingface.co/spaces/ssboost/6hjw3hs3"}, |
|
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์์ฑ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/g7yhw43gssdf"}, |
|
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์์ฑ๊ธฐ(์์)", "url": "https://huggingface.co/spaces/ssboost/asdfewef"}, |
|
{"name": "์ด๋ฏธ์ง-๋ฐฐ๊ฒฝ์์ฑ๊ธฐ(์ )", "url": "https://huggingface.co/spaces/ssboost/veegsd"}, |
|
{"name": "์ด๋ฏธ์ง-๋ธ๋ก๊ทธ์ด๋ฏธ์ง์", "url": "https://huggingface.co/spaces/ssboost/dfq23d"}, |
|
{"name": "์ด๋ฏธ์ง-์ด๋ฏธ์งํธ์ง", "url": "https://huggingface.co/spaces/ssboost/swq2f"}, |
|
{"name": "์ด์ปค๋จธ์ค-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/ssboost/fe2fsd"}, |
|
{"name": "์ด์ปค๋จธ์ค-๋ค์ด๋ฒ์ผํ์ํ๋ช
๋ถ์", "url": "https://huggingface.co/spaces/ssboost/d34feer"}, |
|
{"name": "์ ์ฉํํด-๊ธ๋ค๋ฌ", "url": "https://huggingface.co/spaces/ssboost/E2T4TWEWEWE"}, |
|
{"name": "์ ์ฉํํด-์
๋ฌ ์๋ ๋ฒ์ญ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/G378DFE4AS"}, |
|
{"name": "์ ์ฉํํด-gif", "url": "https://huggingface.co/spaces/ssboost/gif-1"}, |
|
{"name": "์ ์ฉํํด-์ ์ฌ๋ฐฉ์ง์ด๋ฏธ์ง๋ณํ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/N_I"}, |
|
{"name": "์ ์ฉํํด-๋ธ๋ก๊ทธํํ์๋ถ์", "url": "https://huggingface.co/spaces/ssboost/ge3gsdgas"}, |
|
{"name": "๊ธ์ฐ๊ธฐ-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/ssboost/EWV2DDWEE"}, |
|
{"name": "๊ธ์ฐ๊ธฐ-์๋๋ธ๋ก๊ทธ", "url": "https://huggingface.co/spaces/ssboost/G3YGSDE"}, |
|
{"name": "๊ธ์ฐ๊ธฐ-์ ํ๋ธ", "url": "https://huggingface.co/spaces/ssboost/FVW3GSX3"}, |
|
{"name": "์ด์ปค๋จธ์ค-์ํ๋ช
(๋ฉ์ธํค์๋)", "url": "https://huggingface.co/spaces/ssboost/F23ASFGGD"}, |
|
{"name": "์ด์ปค๋จธ์ค-์ํ๋ช
(์ํ๋ช
๋ถ์)", "url": "https://huggingface.co/spaces/ssboost/F23ASFGGD-2"}, |
|
{"name": "์ด์ปค๋จธ์ค-์์ฑ๋ถ์๊ธฐ(ํ๋ฒ์ )", "url": "https://huggingface.co/spaces/ssboost/3gghdf5"}, |
|
{"name": "์ด์ปค๋จธ์ค-์์ฑ๋ถ์๊ธฐ(๊ฐ๋ตํ)", "url": "https://huggingface.co/spaces/ssboost/geo5g4gfj"}, |
|
{"name": "์ด๋ฏธ์ง-๊ธ์์ง์ฐ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/hkpdejhed"}, |
|
{"name": "์ด๋ฏธ์ง-์ด๋ฏธ์ง๋ฐ๊พธ๊ธฐ", "url": "https://huggingface.co/spaces/ssboost/g94h4jd"}, |
|
|
|
|
|
{"name": "๋ฉ์ธํ์ด์ง-๋ฆฌ๋ทฐ๋ถ์", "url": "https://huggingface.co/spaces/ekdhstldhs/86f86f80yg"}, |
|
{"name": "๋ฉ์ธํ์ด์ง-๋ธ๋ก๊ทธ์์ฑ", "url": "https://huggingface.co/spaces/ekdhstldhs/f23fewde"}, |
|
{"name": "๋ฉ์ธํ์ด์ง-์์ฑ๋ถ์๊ธฐ(ํ๋ฒ์ )", "url": "https://huggingface.co/spaces/ekdhstldhs/f232fwe"}, |
|
{"name": "๋ฉ์ธํ์ด์ง-์์ฑ๋ถ์๊ธฐ(๊ฐ๋ตํ)", "url": "https://huggingface.co/spaces/ekdhstldhs/df2wwewe"}, |
|
{"name": "๋ฉ์ธํ์ด์ง-์ธ๋ค์ผ๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ", "url": "https://huggingface.co/spaces/ekdhstldhs/fsqwgvdsd"}, |
|
{"name": "๋ฉ์ธํ์ด์ง-์ด๋ฏธ์ง์์ฑ", "url": "https://huggingface.co/spaces/ekdhstldhs/g34ysdv234g"}, |
|
{"name": "๊ธฐํ๊ธฐ๋ฅ-๋ฐฐ๊ฒฝ์ง์ฐ๊ธฐ", "url": "https://huggingface.co/spaces/ekdhstldhs/df2wedds"}, |
|
{"name": "๊ธฐํ๊ธฐ๋ฅ-ํ์ง๊ฐ์ ๊ธฐ", "url": "https://huggingface.co/spaces/ekdhstldhs/fef232fsdes"}, |
|
{"name": "๋ณด์กฐ๊ธฐ๋ฅ-๋ธ๋ก๊ทธ(์ํ๋ฆฌ๋ทฐ)", "url": "https://huggingface.co/spaces/ekdhstldhs/kkie2"}, |
|
{"name": "๋ณด์กฐ๊ธฐ๋ฅ-๋ธ๋ก๊ทธ(ํต์ฌ๊ธฐ๋ฅ)", "url": "https://huggingface.co/spaces/ekdhstldhs/kkie3"} |
|
|
|
] |
|
|
|
KST = timezone('Asia/Seoul') |
|
|
|
|
|
def process_login(username, password): |
|
global is_logged_in |
|
if username == VALID_USERNAME and password == VALID_PASSWORD: |
|
is_logged_in = True |
|
dashboard_html = update_dashboard() |
|
return gr.update(visible=False), gr.update(visible=True), "๋ก๊ทธ์ธ ์ฑ๊ณต! ๋์๋ณด๋๋ก ์ด๋ํฉ๋๋ค.", dashboard_html |
|
else: |
|
return gr.update(visible=True), gr.update(visible=False), "์์ด๋ ๋๋ ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค.", None |
|
|
|
|
|
def check_url_status(url): |
|
try: |
|
response = requests.get(url, timeout=5) |
|
response_text = response.text.lower() |
|
|
|
|
|
if "paused by its owner" in response_text or "this space has been paused" in response_text: |
|
return "Paused" |
|
|
|
|
|
if response.status_code == 200: |
|
|
|
error_keywords = ["runtime error", "no application file", "build error", |
|
"configuration error", "error", "failed"] |
|
for keyword in error_keywords: |
|
if keyword in response_text: |
|
return "์ค๋ฅ" |
|
|
|
|
|
if "paused" in response_text: |
|
return "Paused" |
|
elif "sleeping" in response_text or "asleep" in response_text: |
|
return "Sleeping" |
|
elif "building" in response_text: |
|
return "Building" |
|
elif "restarting" in response_text: |
|
return "Restarting" |
|
elif "starting" in response_text: |
|
return "Starting" |
|
|
|
|
|
return "Running" |
|
|
|
elif response.status_code == 503: |
|
return "Sleeping" |
|
elif response.status_code >= 400: |
|
return "์ค๋ฅ" |
|
|
|
|
|
return "์ํ ๋ถ๋ช
" |
|
|
|
except requests.exceptions.Timeout: |
|
return "ํ์์์" |
|
except requests.exceptions.ConnectionError: |
|
return "์ฐ๊ฒฐ ์ค๋ฅ" |
|
except Exception as e: |
|
logging.error(f"URL ์ฒดํฌ ์ค ์ค๋ฅ ๋ฐ์: {url}, {str(e)}") |
|
return "๊ธฐํ ์ค๋ฅ" |
|
|
|
|
|
def generate_html(targets): |
|
grouped_by_id = defaultdict(lambda: defaultdict(list)) |
|
for target in targets: |
|
user_id = target['url'].split('/')[4] |
|
function = target['name'].split('-')[0] |
|
grouped_by_id[user_id][function].append(target) |
|
|
|
status_html = "<h2>์์ด๋๋ณ ๋ฐ ๊ธฐ๋ฅ๋ณ ๊ตฌ๋ถ</h2>" |
|
|
|
|
|
status_colors = { |
|
"Running": "#4CAF50", |
|
"Sleeping": "#808080", |
|
"Paused": "#FFA500", |
|
"Building": "#2196F3", |
|
"Restarting": "#9C27B0", |
|
"Starting": "#03A9F4", |
|
"์ค๋ฅ": "#FF0000", |
|
"ํ์์์": "#FF0000", |
|
"์ฐ๊ฒฐ ์ค๋ฅ": "#FF0000", |
|
"๊ธฐํ ์ค๋ฅ": "#FF0000", |
|
"์ํ ๋ถ๋ช
": "#000000" |
|
} |
|
|
|
for user_id, functions in grouped_by_id.items(): |
|
email, password = CREDENTIALS.get(user_id, ["N/A", "N/A"]) |
|
status_html += ( |
|
f"<div style='border: 2px solid #4CAF50; padding: 10px; margin: 10px 0; border-radius: 8px;'>" |
|
f"<h3 style='font-size: 1.5em; font-weight: bold;'>์์ด๋๋ช
: {user_id}</h3>" |
|
f"<p><strong>์ด๋ฉ์ผ:</strong> {email}<br><strong>๋น๋ฐ๋ฒํธ:</strong> {password}</p>" |
|
) |
|
for function, items in functions.items(): |
|
status_html += ( |
|
f"<div style='padding: 8px; margin: 5px 0; background-color: #F9F9F9; border-radius: 5px;'>" |
|
f"<strong style='font-size: 1.2em;'>{function}</strong><br>" |
|
) |
|
for item in items: |
|
item_name = item["name"].split('-')[-1] |
|
status = check_url_status(item["url"]) |
|
|
|
|
|
color = status_colors.get(status, "#000000") |
|
|
|
item_html = ( |
|
f'<a href="{item["url"]}" target="_blank" style="color: {color}; ' |
|
f'text-decoration: none; margin: 2px; display: inline-block; ' |
|
f'padding: 5px; border: 1px solid #E0E0E0; border-radius: 3px;">' |
|
f'{item_name} ({status})</a>' |
|
) |
|
status_html += item_html |
|
status_html += "</div>" |
|
status_html += "</div>" |
|
|
|
return status_html |
|
|
|
|
|
def update_dashboard(): |
|
|
|
html_content = generate_html(TARGETS) |
|
|
|
|
|
current_time = datetime.datetime.now(KST).strftime('%Y.%m.%d %H:%M:%S') |
|
|
|
|
|
full_html = f"{html_content}<p style='color: #7A7A7A;'>์
๋ฐ์ดํธ ์๊ฐ: {current_time}</p>" |
|
|
|
return full_html |
|
|
|
|
|
dashboard_html_cache = "" |
|
last_update_time = None |
|
|
|
|
|
def schedule_daily_check(): |
|
global dashboard_html_cache, last_update_time |
|
while True: |
|
now = datetime.datetime.now(KST) |
|
if now.hour == 7 and now.minute == 0: |
|
logging.info("์ผ์ผ ์ํ ์ฒดํฌ ์คํ ์ค...") |
|
|
|
dashboard_html_cache = generate_html(TARGETS) |
|
last_update_time = now |
|
logging.info(f"์ผ์ผ ์ํ ์ฒดํฌ ์๋ฃ: {now.strftime('%Y.%m.%d %H:%M:%S')}") |
|
time.sleep(60) |
|
time.sleep(30) |
|
|
|
|
|
def get_dashboard(): |
|
global dashboard_html_cache, last_update_time |
|
|
|
if dashboard_html_cache == "" or last_update_time is None or \ |
|
(datetime.datetime.now(KST) - last_update_time).seconds > 3600: |
|
return update_dashboard() |
|
|
|
|
|
current_time = datetime.datetime.now(KST).strftime('%Y.%m.%d %H:%M:%S') |
|
return f"{dashboard_html_cache}<p style='color: #7A7A7A;'>์
๋ฐ์ดํธ ์๊ฐ: {current_time} (์บ์๋จ)</p>" |
|
|
|
|
|
def create_app(): |
|
|
|
custom_css = """ |
|
footer {visibility: hidden} |
|
.gradio-container {max-width: 1200px} |
|
.login-container {max-width: 500px; margin: 0 auto; padding: 20px;} |
|
""" |
|
|
|
with gr.Blocks(css=custom_css) as app: |
|
|
|
with gr.Group(visible=True, elem_classes="login-container") as login_page: |
|
gr.Markdown("# ์๋น์ค ๋์๋ณด๋ ๋ก๊ทธ์ธ") |
|
gr.Markdown("ํ๊น
ํ์ด์ค ์๋น์ค ๋์๋ณด๋์ ์ ์ํ๋ ค๋ฉด ๋ก๊ทธ์ธํ์ธ์.") |
|
username_input = gr.Textbox(label="์์ด๋", placeholder="์์ด๋๋ฅผ ์
๋ ฅํ์ธ์") |
|
password_input = gr.Textbox(label="๋น๋ฐ๋ฒํธ", placeholder="๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ์ธ์", type="password") |
|
login_btn = gr.Button("๋ก๊ทธ์ธ", variant="primary", scale=1) |
|
login_message = gr.Textbox(label="์ํ", interactive=False, visible=False) |
|
|
|
|
|
with gr.Group(visible=False) as dashboard_page: |
|
with gr.Row(): |
|
gr.Markdown("# ํ๊น
ํ์ด์ค ์๋น์ค ๋์๋ณด๋") |
|
|
|
with gr.Row(): |
|
refresh_button = gr.Button("์ํ ์๋ก๊ณ ์นจ", variant="primary") |
|
logout_button = gr.Button("๋ก๊ทธ์์", variant="secondary") |
|
|
|
status_html = gr.HTML() |
|
|
|
|
|
login_btn.click( |
|
fn=process_login, |
|
inputs=[username_input, password_input], |
|
outputs=[login_page, dashboard_page, login_message, status_html] |
|
) |
|
|
|
|
|
refresh_button.click( |
|
fn=update_dashboard, |
|
outputs=status_html |
|
) |
|
|
|
|
|
logout_button.click( |
|
fn=process_logout, |
|
outputs=[login_page, dashboard_page, login_message, status_html] |
|
) |
|
|
|
|
|
threading.Thread(target=schedule_daily_check, daemon=True).start() |
|
|
|
return app |
|
|
|
|
|
if __name__ == "__main__": |
|
app = create_app() |
|
app.launch(share=False, server_name="0.0.0.0", server_port=7860) |