diff --git a/synapse_topology/asdfsaf.asdf b/synapse_topology/asdfsaf.asdf new file mode 100644 index 0000000000..ffba8971d7 --- /dev/null +++ b/synapse_topology/asdfsaf.asdf @@ -0,0 +1 @@ +ed25519 a_altJ iZSrNbHiO1acwiNW3j6kYheALALGXe5uQMzs5NEKP2A diff --git a/synapse_topology/config_dir/homeserver.yaml b/synapse_topology/config_dir/homeserver.yaml deleted file mode 100644 index 4769e776d5..0000000000 --- a/synapse_topology/config_dir/homeserver.yaml +++ /dev/null @@ -1,20 +0,0 @@ -database: - args: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/homeserver.db - name: psycopg2 -listeners: -- port: 8008 - resources: - - names: - - federation - - client - tls: true - type: http -log_config: /home/jorik/Dev/synapse/synapse_topology/config_dir/undefined.log.config -media_store_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/media_store -pid_file: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/homeserver.pid -report_stats: true -server_config_in_use: true -server_name: myserver.net -tls_certificate_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/undefined.tls.cert -tls_private_key_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/undefined.tls.key -uploads_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/uploads diff --git a/synapse_topology/controller/server/server.py b/synapse_topology/controller/server/server.py index 5932193e90..1dcdd1d49f 100644 --- a/synapse_topology/controller/server/server.py +++ b/synapse_topology/controller/server/server.py @@ -110,8 +110,13 @@ def check_ports(request, body): return json.dumps({"ports": results}) -@app.route("/start", methods=["POST"]) -def start_synapse(): +@app.route("/iw", methods=["POST"]) +def start_synapse(request): print("Start") - subprocess.Popen("synctl", "start", "-c", model.get_config_dir(), "homeserver.yaml") + subprocess.Popen(["synctl", "start", model.get_config_dir() + "/homeserver.yaml"]) sys.exit() + + +@app.route("/favicon.ico") +def noop(request): + return diff --git a/synapse_topology/model/__init__.py b/synapse_topology/model/__init__.py index cd895bfb42..7fae2caa78 100644 --- a/synapse_topology/model/__init__.py +++ b/synapse_topology/model/__init__.py @@ -9,11 +9,12 @@ from .constants import ( CONFIG_LOCK, CONFIG_LOCK_DATA, DATA_SUBDIR, - SECRET_KEY, SERVER_NAME, ) from .errors import BasConfigInUseError, BaseConfigNotFoundError, ConfigNotFoundError +import subprocess + def set_config_dir(conf_dir): global config_dir @@ -68,6 +69,7 @@ def generate_base_config(server_name, report_stats): generate_secrets=True, report_stats=report_stats, ) + with open(path.join(config_dir, BASE_CONFIG), "w") as f: f.write(conf) f.write(CONFIG_LOCK_DATA) @@ -81,7 +83,11 @@ def get_server_name(): def get_secret_key(): config = get_config() - return config.get(SECRET_KEY) + server_name = config.get(SERVER_NAME) + signing_key_path = path.join(config_dir, server_name + ".signing.key") + subprocess.run(["generate_signing_key.py", "-o", signing_key_path]) + with open(signing_key_path, "r") as f: + return f.read() def verify_yaml(): diff --git a/synapse_topology/view/webui/js/actions/index.js b/synapse_topology/view/webui/js/actions/index.js index 0ea23b7d39..38955a4333 100644 --- a/synapse_topology/view/webui/js/actions/index.js +++ b/synapse_topology/view/webui/js/actions/index.js @@ -28,7 +28,7 @@ import { import { get_server_setup, post_server_name, - fetch_secret_key, + get_secretkey, post_cert_paths, post_certs, test_ports, @@ -139,7 +139,7 @@ export const getting_secret_keys = () => ({ export const get_secret_key = () => { return dispatch => { - fetch_secret_key().then( + get_secretkey().then( result => dispatch(set_secret_key(result)), error => dispatch(fail(error)), ) diff --git a/synapse_topology/view/webui/js/api/index.js b/synapse_topology/view/webui/js/api/index.js index cfe57fef00..521a5a5393 100644 --- a/synapse_topology/view/webui/js/api/index.js +++ b/synapse_topology/view/webui/js/api/index.js @@ -63,7 +63,7 @@ export const test_ports = (ports) => } ).then(res => res.json()) -export const fetch_secret_key = () => +export const get_secretkey = () => fetchAbs(SECRET_KEY) .then(res => res.json()) .then(json => json.secret_key) diff --git a/synapse_topology/view/webui/js/index.jsx b/synapse_topology/view/webui/js/index.jsx index 4f1d7794fe..aeff2d5c87 100644 --- a/synapse_topology/view/webui/js/index.jsx +++ b/synapse_topology/view/webui/js/index.jsx @@ -20,7 +20,7 @@ store.dispatch(startup()); render( - + {/* */} , document.getElementById("content") diff --git a/synapse_topology/view/webui/js/utils/yaml.js b/synapse_topology/view/webui/js/utils/yaml.js index bdc7e4d124..6b8dc5c6fb 100644 --- a/synapse_topology/view/webui/js/utils/yaml.js +++ b/synapse_topology/view/webui/js/utils/yaml.js @@ -102,7 +102,7 @@ export const base_config_to_synapse_config = config => { const conf = { server_name: config.servername, report_stats: config.report_stats, - log_config: config.config_dir + "/" + config.server_name + ".log.config", + log_config: config.config_dir + "/" + config.servername + ".log.config", media_store_path: config.config_dir + "/data/media_store", uploads_path: config.config_dir + "/data/uploads", pid_file: config.config_dir + "/data/homeserver.pid",