diff --git a/ampg/install_plan.py b/ampg/install_plan.py index 1b10ebe..d9b38df 100644 --- a/ampg/install_plan.py +++ b/ampg/install_plan.py @@ -685,14 +685,16 @@ Log notice file {state_dir / "tor.log"} """ if protocol.name == "i2p": port = int(protocol.options.get("local_port", 18081)) + inport = int(protocol.options.get("inport", 80)) key_file = protocol.options.get("keys_file", f"{site.id}-web.dat") tunnel_name = protocol.options.get("tunnel_name", f"{site.id}-web") return f"""# Generated by AMPG. Review before installing. [{tunnel_name}] -type = server +type = http host = 127.0.0.1 port = {port} -keys = {state_dir / str(key_file)} +inport = {inport} +keys = {key_file} """ if protocol.name == "gemini": port = int(protocol.options.get("port", 1965)) @@ -837,10 +839,12 @@ WantedBy=multi-user.target """ shell = "/data/data/com.termux/files/usr/bin/sh" if provider.name == "android-termux" else "/bin/sh" + state_dir = _state_dir(config, provider, site, protocol) + data_dir_setup = f"\nmkdir -p {state_dir / 'data'}" if protocol.name == "i2p" else "" return f"""#!{shell} # Generated by AMPG. Review before installing. set -eu -mkdir -p {_state_dir(config, provider, site, protocol)} +mkdir -p {state_dir}{data_dir_setup} {command} """ diff --git a/ampg/plan.py b/ampg/plan.py index 367c87e..0cce417 100644 --- a/ampg/plan.py +++ b/ampg/plan.py @@ -148,14 +148,16 @@ HiddenServicePort 80 127.0.0.1:{port} def _i2pd_artifact(site: SiteConfig, protocol: ProtocolConfig) -> PlanArtifact: port = int(protocol.options.get("local_port", 18081)) + inport = int(protocol.options.get("inport", 80)) key_file = protocol.options.get("keys_file", f"{site.id}-web.dat") tunnel_name = protocol.options.get("tunnel_name", f"{site.id}-web") path = _protocol_plan_dir(site, protocol) / "i2pd-tunnel.conf" content = f"""# Generated by AMPG. Review before installing. [{tunnel_name}] -type = server +type = http host = 127.0.0.1 port = {port} +inport = {inport} keys = {key_file} """ return PlanArtifact(path=path, content=content) diff --git a/ampg/state_contract.py b/ampg/state_contract.py index 305bc0a..3b05a09 100644 --- a/ampg/state_contract.py +++ b/ampg/state_contract.py @@ -210,7 +210,7 @@ def _i2p_contract( site, protocol, role="identity-key", - path=state_dir / key_file, + path=state_dir / "data" / key_file, owner="daemon", required=True, sensitive=True, diff --git a/examples/ampgateway-online.gateway.toml b/examples/ampgateway-online.gateway.toml index 08406dd..2c1633d 100644 --- a/examples/ampgateway-online.gateway.toml +++ b/examples/ampgateway-online.gateway.toml @@ -59,7 +59,7 @@ daemon_policy = "auto" local_port = 18181 keys_file = "ampgateway-online-web.dat" tunnel_name = "ampgateway-online-web" -i2p_url = "http://vfhcumcxtbysxr6wvbpdytb6jpslcqlo3j6e35w7s63el5vsorca.b32.i2p/" +i2p_url = "http://veyotzzzjal5acfkjsoeuzvt45s3hynr55rmrt6hotwcdlwmbfia.b32.i2p/" max_asset_bytes = 1048576 script_policy = "strip" @@ -125,7 +125,7 @@ daemon_policy = "auto" local_port = 18281 keys_file = "ampgateway-site-web.dat" tunnel_name = "ampgateway-site-web" -i2p_url = "http://zajoo4f5dso64tvtazas27se2galkihgpfgoy636uxm7loo42cdq.b32.i2p/" +i2p_url = "http://ipahplmdbdwa23wpslqfylghlbqdlmsh23cj64fsvbp3lftxozka.b32.i2p/" max_asset_bytes = 1048576 script_policy = "strip" diff --git a/sites/ampgateway-online/index.html b/sites/ampgateway-online/index.html index 2f91536..1f15d06 100644 --- a/sites/ampgateway-online/index.html +++ b/sites/ampgateway-online/index.html @@ -204,7 +204,7 @@