From 536bda25fb5f1a8eb9a85396c2269a84c6b5f24d Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 4 Oct 2023 00:51:04 +0500 Subject: [PATCH] added support to open links --- Dockerfile | 5 ++++- README.md | 5 +++++ docker-compose.yml | 2 ++ xdg-open-listener.sh | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 xdg-open-listener.sh diff --git a/Dockerfile b/Dockerfile index a5c9e96..3d1f833 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,11 @@ WORKDIR /root COPY 64gram-desktop-bin-1_1.0.85-1-x86_64.pkg.tar.zst . -RUN pacman -Sy alsa-utils --noconfirm \ +RUN pacman -Sy alsa-utils xdg-utils socat --noconfirm \ && pacman -U 64gram-desktop-bin-1_1.0.85-1-x86_64.pkg.tar.zst --noconfirm \ && rm -rfv 64gram-desktop-bin-1_1.0.85-1-x86_64.pkg.tar.zst /var/cache/pacman/pkg/* +COPY xdg-open-listener.sh /usr/sbin/xdg-open +RUN chmod +x /usr/sbin/xdg-open + CMD telegram-desktop diff --git a/README.md b/README.md index 226a051..f26ea8b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ services: image: git.shihaam.dev/dockerfiles/64gram environment: - DISPLAY # For GUI access + - XDG_OPEN_LISTENER_PORT=6969 # Set this to port number of socat server + - XDG_OPEN_LISTENER_HOST=192.168.x.x # set this to your host machine IP devices: - /dev/snd:/dev/snd # Mic and Speaker support - /dev/video0:/dev/video0 # Webcam support @@ -30,4 +32,7 @@ services: ``` and run `podman-compose up -d` or if you wanna live dangerously then you may..: `docker compose up -d` +Telegram cannot open links from the container to host machine, and to work around that is this command +`socat TCP-LISTEN:$XDG_OPEN_LISTENER_PORT,fork EXEC:"xargs -n 1 xdg-open"` + k, thanks, bye diff --git a/docker-compose.yml b/docker-compose.yml index 75c98ee..3b919e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ services: image: git.shihaam.dev/dockerfiles/64gram environment: - DISPLAY # For GUI access + - XDG_OPEN_LISTENER_PORT=6969 # Set this to port number of socat server + - XDG_OPEN_LISTENER_HOST=192.168.x.x # set this to your host machine IP devices: - /dev/snd:/dev/snd # Mic and Speaker support - /dev/video0:/dev/video0 # Webcam support diff --git a/xdg-open-listener.sh b/xdg-open-listener.sh new file mode 100644 index 0000000..74c7988 --- /dev/null +++ b/xdg-open-listener.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo $1 | socat - TCP:$XDG_OPEN_LISTENER_HOST:$XDG_OPEN_LISTENER_PORT