GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Flow/start.py at main · NeonMC23/Flow

Expand file tree

/

start.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
62 lines (46 loc) · 2.02 KB
/

start.py

Copy path

File metadata and controls

62 lines (46 loc) · 2.02 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import argparse
import threading
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
import os
import time
import webbrowser
from port_manager import get_port
def write_runtime_config(upload_port: int):
config_path = Path(__file__).resolve().parent / "src" / "javascript" / "runtime_config.js"
config_path.parent.mkdir(parents=True, exist_ok=True)
config_path.write_text(
"window.FLOW_API_BASE = 'http://127.0.0.1:%d';\n" % upload_port,
encoding="utf-8",
)
def run_web(port: int):
os.chdir(Path(__file__).resolve().parent)
httpd = ThreadingHTTPServer(("127.0.0.1", port), SimpleHTTPRequestHandler)
print(f"Web server running on http://127.0.0.1:{port} \n")
httpd.serve_forever()
def run_upload(port: int):
from scripts.upload_server import Handler
from http.server import HTTPServer
httpd = HTTPServer(("127.0.0.1", port), Handler)
print(f"Upload server running on http://127.0.0.1:{port} \n")
httpd.serve_forever()
def main():
os.chdir(Path(__file__).resolve().parent) # Ensure cwd is project root (UNC-safe)
parser = argparse.ArgumentParser(description="Start Flow local servers")
parser.add_argument("--web", type=int, default=None)
parser.add_argument("--upload", type=int, default=8001)
parser.add_argument("--no-browser", action="store_true", help="Do not open the web UI automatically")
args = parser.parse_args()
web_port = args.web if args.web is not None else get_port(default=5500)
write_runtime_config(args.upload)
web_thread = threading.Thread(target=run_web, args=(web_port,), daemon=True)
upload_thread = threading.Thread(target=run_upload, args=(args.upload,), daemon=True)
web_thread.start()
upload_thread.start()
if not args.no_browser:
# Give the server a moment to bind before opening the UI
time.sleep(0.25)
webbrowser.open("http://127.0.0.1:%d/index.html" % web_port, new=2)
web_thread.join()
if __name__ == "__main__":
main()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.