From bff89b94d59e1632286e8329f9c7c9b3e048d6b8 Mon Sep 17 00:00:00 2001 From: samlm0 <9084029+samlm0@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:43:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=20IP=20=E5=88=B0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/clients/websocket.php | 7 ++++++- ui/src/components/Information.vue | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/app/clients/websocket.php b/backend/app/clients/websocket.php index 423bd2c..01366d9 100644 --- a/backend/app/clients/websocket.php +++ b/backend/app/clients/websocket.php @@ -15,8 +15,13 @@ class Websocket public function __construct($request, $response, $fd) { global $config; + $localConfig = $config; + $this->request = $request; + $this->clientIp = $this->request->header['x-real-ip']; + $localConfig['client_ip'] = $this->clientIp + $this->response = $response; $this->fd = $fd; $this->sendChannel = new \Swoole\Coroutine\Channel(100); @@ -29,7 +34,7 @@ class Websocket } }); - $this->send('1000|' . json_encode($config)); + $this->send('1000|' . json_encode($localConfig)); } /** diff --git a/ui/src/components/Information.vue b/ui/src/components/Information.vue index 2866c1e..ad0e75e 100644 --- a/ui/src/components/Information.vue +++ b/ui/src/components/Information.vue @@ -11,6 +11,9 @@
公网 IPv6 地址: [{{ publicIpv6 }}]
+
+ 您当前的 IP 地址: {{ clientIp }} +
@@ -28,6 +31,7 @@ export default defineComponent({ data() { return { location: false, + clientIp: false, publicIpv4: false, publicIpv6: false, } @@ -39,6 +43,7 @@ export default defineComponent({ let data = JSON.parse(e[1]) this.wsMessage.splice(i, 1) this.location = data.location + this.clientIp = data.client_ip this.publicIpv4 = data.public_ipv4 this.publicIpv6 = data.public_ipv6 this.componentConfig.public_ipv4 = data.public_ipv4 From c3f4525b77acd67436625bbf5eed5c46d66cdf50 Mon Sep 17 00:00:00 2001 From: samlm0 <9084029+samlm0@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:44:57 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E5=9B=BD=E5=86=85?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E5=9C=B0=E5=9D=80=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63ddc23..8c90d27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,7 @@ RUN npm i && \ FROM alpine:3.16 LABEL maintainer="samlm0 " -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \ - apk add --no-cache php81 php81-pecl-maxminddb php81-ctype php81-pecl-swoole nginx xz \ +RUN apk add --no-cache php81 php81-pecl-maxminddb php81-ctype php81-pecl-swoole nginx xz \ iperf iperf3 \ mtr \ traceroute \ @@ -18,4 +17,4 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/re ADD backend/app /app COPY --from=0 /app/dist /app/webspaces -CMD php81 /app/app.php \ No newline at end of file +CMD php81 /app/app.php From e2d19132eb3c611c1ffb6706e6201e216b5242a9 Mon Sep 17 00:00:00 2001 From: samlm0 <9084029+samlm0@users.noreply.github.com> Date: Fri, 19 Aug 2022 19:59:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/clients/websocket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/clients/websocket.php b/backend/app/clients/websocket.php index 01366d9..30cdca4 100644 --- a/backend/app/clients/websocket.php +++ b/backend/app/clients/websocket.php @@ -20,7 +20,7 @@ class Websocket $this->request = $request; $this->clientIp = $this->request->header['x-real-ip']; - $localConfig['client_ip'] = $this->clientIp + $localConfig['client_ip'] = $this->clientIp; $this->response = $response; $this->fd = $fd; From 6a97e9212974ab11251fcd382565412735fa9c1c Mon Sep 17 00:00:00 2001 From: samlm0 <9084029+samlm0@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:40:35 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 98de310..ff3ec02 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ docker run -d --name looking-glass --restart always --network host wikihostinc/looking-glass-server ``` +[DEMO](http://lg.hk1-bgp.hkg.50network.com/) + ## Host Requirements - Can run docker (yes, only docker is required) @@ -42,4 +44,4 @@ https://github.com/librespeed/speedtest Code is licensed under MIT Public License. -* If you wish to support my efforts, keep the "Powered by LookingGlass" link intact. \ No newline at end of file +* If you wish to support my efforts, keep the "Powered by LookingGlass" link intact.