soiz commited on
Commit
4354e42
·
verified ·
1 Parent(s): 379722b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -13,7 +13,7 @@ def clone_and_setup_repo():
13
  shutil.rmtree(temp_dir)
14
 
15
  print("Cloning the repository...")
16
- result = os.system(f"git clone https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git --recursive {temp_dir}")
17
 
18
  if result != 0:
19
  print("Error: Failed to clone the repository.")
@@ -28,10 +28,10 @@ def clone_and_setup_repo():
28
  os.system("npm start")
29
 
30
  # index.htmlをカレントディレクトリに移動
31
- index_html_path = os.path.join(temp_dir, 'index.html')
32
  if os.path.exists(index_html_path):
33
- if os.path.exists('index.html'):
34
- os.remove('index.html')
35
  shutil.move(index_html_path, '.')
36
 
37
  # 静的ファイルをstaticディレクトリに移動
@@ -51,14 +51,14 @@ app = Flask(__name__)
51
  @app.route('/')
52
  def index():
53
  # index.htmlが存在しない場合は404エラー
54
- if not os.path.exists("index.html"):
55
  print("index 404")
56
  return abort(404, description="index.html not found.")
57
 
58
  # index.htmlの内容を読み込む
59
- with open("index.html", "r") as file:
60
  index_html_content = file.read()
61
- print("index.htmlok")
62
 
63
  return render_template_string(index_html_content)
64
 
 
13
  shutil.rmtree(temp_dir)
14
 
15
  print("Cloning the repository...")
16
+ result = os.system(f"git clone https://github.com/izum00/Holy-Unblocker.git --recursive {temp_dir}")
17
 
18
  if result != 0:
19
  print("Error: Failed to clone the repository.")
 
28
  os.system("npm start")
29
 
30
  # index.htmlをカレントディレクトリに移動
31
+ index_html_path = os.path.join(temp_dir, '/views/index.html')
32
  if os.path.exists(index_html_path):
33
+ if os.path.exists('/views/index.html'):
34
+ os.remove('/views/index.html')
35
  shutil.move(index_html_path, '.')
36
 
37
  # 静的ファイルをstaticディレクトリに移動
 
51
  @app.route('/')
52
  def index():
53
  # index.htmlが存在しない場合は404エラー
54
+ if not os.path.exists("/views/index.html"):
55
  print("index 404")
56
  return abort(404, description="index.html not found.")
57
 
58
  # index.htmlの内容を読み込む
59
+ with open("/views/index.html", "r") as file:
60
  index_html_content = file.read()
61
+ print("/views/index.htmlok")
62
 
63
  return render_template_string(index_html_content)
64