Switch from localtunnel to cloudflared, fix static file serving

- Replace localtunnel with cloudflared (no interstitial password page)
- Wait for "Registered tunnel connection" before starting bot
- Serve index.html at / instead of directory listing
- Remove localtunnel npm package build from flake.nix

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Danny 2026-03-24 20:35:05 +01:00
parent f025e5fd19
commit f2cfe72d63
3 changed files with 20 additions and 22 deletions

View file

@ -19,22 +19,10 @@
aiohttp
]);
localtunnel = pkgs.buildNpmPackage {
pname = "localtunnel";
version = "2.0.2";
src = pkgs.fetchFromGitHub {
owner = "localtunnel";
repo = "localtunnel";
rev = "v2.0.2";
hash = "sha256-6gEK1VjF25Kbe2drxbxUKDNJGqZ+OXgkulPkAkMR2+k=";
};
npmDepsHash = "sha256-R9FYkEe93oGF+dR7i1MxwzEW3EM3SasH/B6LLC2CNXM=";
dontNpmBuild = true;
};
in
{
devShells.default = pkgs.mkShell {
packages = [ pythonEnv localtunnel ];
packages = [ pythonEnv pkgs.cloudflared ];
shellHook = ''
echo "💪 BigBiggerBiggestBot dev shell"
echo " Run: python start.py (server + tunnel + bot)"
@ -46,7 +34,7 @@
apps.default = {
type = "app";
program = toString (pkgs.writeShellScript "run-fitness-bot" ''
export PATH="${pkgs.lib.makeBinPath [ pythonEnv localtunnel ]}:$PATH"
export PATH="${pkgs.lib.makeBinPath [ pythonEnv pkgs.cloudflared ]}:$PATH"
exec ${pythonEnv}/bin/python "$PWD/start.py"
'');
};