Skip to content

Commit 73c4bb1

Browse files
committed
Add URL base option (--url-base, -u)
1 parent 49d7540 commit 73c4bb1

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

config.py

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
CREDENTIALS = None
3737
TERMINAL_ID = False
3838
MAX_ITERATIONS_TO_RET = 1000
39+
URL_BASE = "/"
3940

4041
def init():
4142
global VERBOSE
@@ -49,6 +50,7 @@ def init():
4950
global CREDENTIALS
5051
global TERMINAL_ID
5152
global MAX_ITERATIONS_TO_RET
53+
global URL_BASE
5254

5355
def setJSON(config_json):
5456
new_config = json.loads(config_json)

frontend/templates/modules/main/main.html

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<title>GDBFrontend</title>
66

7+
<base href="{url_base}" target="_blank">
8+
79
<link rel="shortcut icon" href="/images/bug.png" />
810

911
<link rel="stylesheet" type="text/css" href="/css/main.css" />

run.py

+6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ def argHandler_dontopenuionstartup():
139139
global dontopenuionstartup
140140
dontopenuionstartup = True
141141

142+
def argHandler_urlBase(path):
143+
arg_config["URL_BASE"] = path
144+
config.URL_BASE = path
145+
142146
def argHandler_help():
143147
global gdb_executable
144148

@@ -154,6 +158,7 @@ def argHandler_help():
154158
print(" --host=IP, -H IP:\t\t\t\tSpecifies current host address that you can access via for HTTP and WS servers.")
155159
print(" --listen=IP, -l IP:\t\t\t\tSpecifies listen address for HTTP and WS servers.")
156160
print(" --port=PORT, -p PORT:\t\t\t\tSpecifies HTTP port. (0 for random port.)")
161+
print(" --url-base=PATH, -u PATH:\t\t\tSpecifies URL base path. (Default: /)")
157162
print(" --readonly, -r:\t\t\t\tMakes code editor readonly. (Notice: This option is not related to security.)")
158163
print(" --workdir, -w:\t\t\t\tSpecifies working directory.")
159164
print(" --plugin-dir, -P:\t\t\t\tSpecifies plugins directory.")
@@ -217,6 +222,7 @@ def quit_tmux_gdb():
217222
["--plugins-dir", "-P", argHandler_pluginsDir, True],
218223
["--help", "-h", argHandler_help, False],
219224
["--dontopenuionstartup", "-D", argHandler_dontopenuionstartup, False],
225+
["--url-base", "-u", argHandler_urlBase, True],
220226
["--version", "-v", argHandler_version, False]
221227
]
222228

url_modules/main/main.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ def run(request, params):
5050

5151
is_wsl = False
5252

53+
url_base = config.URL_BASE
54+
5355
if os.name == 'posix':
5456
config_uname = {
5557
"sysname": uname.sysname,
@@ -73,15 +75,16 @@ def run(request, params):
7375
7476
GDBFrontend.config = {};
7577
GDBFrontend.config.terminal_id = """+json.dumps(config.TERMINAL_ID)+""";
76-
GDBFrontend.config.host_address = '"""+str(config.HOST_ADDRESS)+"""';
77-
GDBFrontend.config.bind_address = '"""+str(config.BIND_ADDRESS)+"""';
78-
GDBFrontend.config.http_port = """+str(config.HTTP_PORT)+""";
79-
GDBFrontend.config.app_path = '"""+str(config.app_path)+"""';
80-
GDBFrontend.config.plugins_dir = '"""+str(config.PLUGINS_DIR)+"""';
81-
GDBFrontend.config.gdb_path = '"""+str(config.gdb_path)+"""';
78+
GDBFrontend.config.host_address = """+json.dumps(config.HOST_ADDRESS)+""";
79+
GDBFrontend.config.bind_address = """+json.dumps(config.BIND_ADDRESS)+""";
80+
GDBFrontend.config.http_port = """+json.dumps(config.HTTP_PORT)+""";
81+
GDBFrontend.config.app_path = """+json.dumps(config.app_path)+""";
82+
GDBFrontend.config.plugins_dir = """+json.dumps(config.PLUGINS_DIR)+""";
83+
GDBFrontend.config.gdb_path = """+json.dumps(config.gdb_path)+""";
8284
GDBFrontend.config.is_readonly = """+json.dumps(config.IS_READONLY)+""";
8385
GDBFrontend.config.workdir = """+json.dumps(config.WORKDIR)+""";
8486
GDBFrontend.config.max_iterations_to_ret = """+json.dumps(config.MAX_ITERATIONS_TO_RET)+""";
87+
GDBFrontend.config.url_base = """+json.dumps(url_base)+""";
8588
GDBFrontend.imports = {};
8689
GDBFrontend.load_plugins = JSON.parse('"""+json.dumps(load_plugins)+"""');
8790
"""

0 commit comments

Comments
 (0)