···
cfg = config.atelier.frpc;
frpc-tunnel = pkgs.writeShellScriptBin "frpc-tunnel" ''
11
-
# Check if gum is available
12
-
if ! command -v ${pkgs.gum}/bin/gum >/dev/null 2>&1; then
13
-
echo "Error: gum is required but not installed"
21
-
${pkgs.gum}/bin/gum style --foreground 212 --bold "๐ FRP Tunnel"
15
+
${pkgs.gum}/bin/gum style --bold --foreground 212 "Creating FRP tunnel"
23
-
subdomain=$(${pkgs.gum}/bin/gum input --placeholder "Enter subdomain (e.g., myapp)")
17
+
subdomain=$(${pkgs.gum}/bin/gum input --placeholder "myapp" --prompt "Subdomain: ")
if [ -z "$subdomain" ]; then
25
-
${pkgs.gum}/bin/gum style --foreground 196 "โ Subdomain cannot be empty"
19
+
${pkgs.gum}/bin/gum style --foreground 196 "No subdomain provided"
if ! echo "$subdomain" | ${pkgs.gnugrep}/bin/grep -qE '^[a-z0-9-]+$'; then
32
-
${pkgs.gum}/bin/gum style --foreground 196 "โ Subdomain must contain only lowercase letters, numbers, and hyphens"
26
+
${pkgs.gum}/bin/gum style --foreground 196 "Invalid subdomain (use only lowercase letters, numbers, and hyphens)"
···
40
-
port=$(${pkgs.gum}/bin/gum input --placeholder "Enter local port (e.g., 8000)")
34
+
port=$(${pkgs.gum}/bin/gum input --placeholder "8000" --prompt "Local port: ")
42
-
${pkgs.gum}/bin/gum style --foreground 196 "โ Port cannot be empty"
36
+
${pkgs.gum}/bin/gum style --foreground 196 "No port provided"
if ! echo "$port" | ${pkgs.gnugrep}/bin/grep -qE '^[0-9]+$'; then
49
-
${pkgs.gum}/bin/gum style --foreground 196 "โ Port must be a number"
43
+
${pkgs.gum}/bin/gum style --foreground 196 "Invalid port (must be a number)"
47
+
# Check if local port is accessible
48
+
if ! ${pkgs.netcat}/bin/nc -z 127.0.0.1 "$port" 2>/dev/null; then
49
+
${pkgs.gum}/bin/gum style --foreground 214 "! Warning: Nothing listening on localhost:$port"
52
+
# Create config file
config_file=$(${pkgs.coreutils}/bin/mktemp)
trap "${pkgs.coreutils}/bin/rm -f $config_file" EXIT
···
73
+
public_url="https://$subdomain.${cfg.domain}"
73
-
${pkgs.gum}/bin/gum style --border double --padding "1 2" --border-foreground 212 \
74
-
"๐ Tunnel Active" \
76
-
"Local: $(${pkgs.gum}/bin/gum style --foreground 212 --bold "localhost:$port")" \
77
-
"Public: $(${pkgs.gum}/bin/gum style --foreground 212 --bold "https://$subdomain.bore.dunkirk.sh")" \
79
-
"Press $(${pkgs.gum}/bin/gum style --foreground 196 --bold "Ctrl+C") to stop"
75
+
${pkgs.gum}/bin/gum style --foreground 35 "โ Tunnel configured"
76
+
${pkgs.gum}/bin/gum style --foreground 117 " Local: localhost:$port"
77
+
${pkgs.gum}/bin/gum style --foreground 117 " Public: $public_url"
79
+
${pkgs.gum}/bin/gum style --foreground 214 "Connecting to ${cfg.serverAddr}:${toString cfg.serverPort}..."
exec ${pkgs.frp}/bin/frpc -c $config_file
···
serverAddr = lib.mkOption {
91
-
default = "terebithia.dunkirk.sh";
90
+
default = "bore.dunkirk.sh";
description = "frp server address";
···
description = "frp server port";
100
+
domain = lib.mkOption {
101
+
type = lib.types.str;
102
+
default = "bore.dunkirk.sh";
103
+
description = "Domain for public tunnel URLs";
authTokenFile = lib.mkOption {