From 67967bbff924938a77aa6e517d05bc7db45d4f6d Mon Sep 17 00:00:00 2001 From: cococo <17401091+kingmo888@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:32:20 +0800 Subject: [PATCH 1/7] Update views_front.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决前台偶发500问题 --- api/views_front.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/views_front.py b/api/views_front.py index 8b40d14..9eb2367 100644 --- a/api/views_front.py +++ b/api/views_front.py @@ -186,8 +186,9 @@ def get_all_info(): for peer in peers: user = UserProfile.objects.filter(Q(id=peer.uid)).first() - devices[peer.rid]['rust_user'] = user.username - + device = devices.get(peer.rid, None) + if device: + devices['rust_user'] = user.username return [v for k,v in devices.items()] @@ -203,4 +204,4 @@ def work(request): all_info = get_all_info() print(all_info) - return render(request, 'show_work.html', {'single_info':single_info, 'all_info':all_info, 'u':u}) \ No newline at end of file + return render(request, 'show_work.html', {'single_info':single_info, 'all_info':all_info, 'u':u}) From 1a0d9f8ad4b6fb563d497ff977642eccd1e158e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A2=9E=E6=B5=B7?= <860007600@qq.com> Date: Wed, 6 Dec 2023 19:08:21 +0800 Subject: [PATCH 2/7] d --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 147b180..39bc2fe 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,9 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 ``` +#### Docker方式 + + ### 计划开发 From c39068a8403ec3e1546a078bd29337c72cdb6319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A2=9E=E6=B5=B7?= <860007600@qq.com> Date: Wed, 6 Dec 2023 19:11:07 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=B6=E5=8F=91SERVER5?= =?UTF-8?q?00=E5=8F=8A=E5=A2=9E=E5=8A=A0Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 22 ++++++++++++++++++++++ README.md | 1 + 2 files changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d219ebf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.10.3-slim-bullseye + +WORKDIR /rustdesk-api-server +ADD . /rustdesk-api-server + +RUN pip install pip -U -i https://mirrors.cloud.tencent.com/pypi/simple +RUN pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple +RUN pip config set install.trusted-host mirrors.cloud.tencent.com +RUN pip install -r requirements.txt + +VOLUME /rustdesk-api-server/db.sqlite3 + +ENV HOST 0.0.0.0 +ENV TZ=Asia/Shanghai \ + DEBIAN_FRONTEND=noninteractive + +EXPOSE 21114/tcp +EXPOSE 21114/udp + +RUN cd /rustdesk-api-server + +ENTRYPOINT ["bash", "run.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 39bc2fe..f6c31b9 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 #### Docker方式 +`docker compose --compatibility up --build -d;` ### 计划开发 From 19ef7ee4a601b1f3ce143d932a7791f9df0d0ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A2=9E=E6=B5=B7?= <860007600@qq.com> Date: Wed, 6 Dec 2023 19:12:21 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=B6=E5=8F=91SERVER5?= =?UTF-8?q?00=E5=8F=8A=E5=A2=9E=E5=8A=A0Docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/views_front.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/api/views_front.py b/api/views_front.py index 9eb2367..8a4ddf7 100644 --- a/api/views_front.py +++ b/api/views_front.py @@ -177,25 +177,19 @@ def get_single_info(uid): return [v for k,v in peers.items()] - def get_all_info(): devices = RustDesDevice.objects.all() peers = RustDeskPeer.objects.all() - devices = {x.rid:model_to_dict2(x) for x in devices} - for peer in peers: user = UserProfile.objects.filter(Q(id=peer.uid)).first() device = devices.get(peer.rid, None) if device: devices['rust_user'] = user.username - return [v for k,v in devices.items()] - @login_required(login_url='/api/user_action?action=login') def work(request): - #return JsonResponse({'code':0, 'msg':'登录成功'}) username = request.user u = UserProfile.objects.get(username=username) From d30648d02dd2337a275479463c4aa9c78dd41801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A2=9E=E6=B5=B7?= <860007600@qq.com> Date: Wed, 6 Dec 2023 19:14:50 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index f6c31b9..226b704 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,6 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 说明:类似网盘url分享,url激活后可以获得某个或某组或某个标签下的设备 备注:其实web api作为中间件,可做的不多,更多功能还是需要修改客户端来实现,就不太值当了。 + +2、集成Web桌面形式 + 将大神的web桌面集成进来(待议) \ No newline at end of file From 7447026d43e70291a874f9e4f31fba30ad46729a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A2=9E=E6=B5=B7?= <860007600@qq.com> Date: Wed, 6 Dec 2023 19:19:32 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 226b704..ab96ea5 100644 --- a/README.md +++ b/README.md @@ -77,13 +77,16 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 #### Docker方式 +根目录执行命令: `docker compose --compatibility up --build -d;` +感谢热心网友 @ferocknew 提供。 ### 计划开发 1、分享设备给其他已注册用户 + 说明:类似网盘url分享,url激活后可以获得某个或某组或某个标签下的设备 备注:其实web api作为中间件,可做的不多,更多功能还是需要修改客户端来实现,就不太值当了。 From 4690ce70d80e97ca3c24fc126a2bce3cbe233ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A2=9E=E6=B5=B7?= <860007600@qq.com> Date: Wed, 6 Dec 2023 19:20:02 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab96ea5..fd19bc6 100644 --- a/README.md +++ b/README.md @@ -86,9 +86,9 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 1、分享设备给其他已注册用户 - 说明:类似网盘url分享,url激活后可以获得某个或某组或某个标签下的设备 备注:其实web api作为中间件,可做的不多,更多功能还是需要修改客户端来实现,就不太值当了。 2、集成Web桌面形式 + 将大神的web桌面集成进来(待议) \ No newline at end of file