diff --git a/Dockerfile b/Dockerfile index 52c6b3f..50a38fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,15 @@ VOLUME /rustdesk-api-server/db.sqlite3 ENV HOST 0.0.0.0 ENV TZ=Asia/Shanghai \ DEBIAN_FRONTEND=noninteractive + ENV CSRF_TRUSTED_ORIGINS="" + EXPOSE 21114/tcp EXPOSE 21114/udp RUN cd /rustdesk-api-server + ENTRYPOINT ["bash", "run.sh"] + diff --git a/README.md b/README.md index 147b180..fd19bc6 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,12 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 ``` +#### Docker方式 + +根目录执行命令: +`docker compose --compatibility up --build -d;` + +感谢热心网友 @ferocknew 提供。 ### 计划开发 @@ -82,3 +88,7 @@ from pysqlite3 import dbapi2 as Database # 启用pysqlite3 说明:类似网盘url分享,url激活后可以获得某个或某组或某个标签下的设备 备注:其实web api作为中间件,可做的不多,更多功能还是需要修改客户端来实现,就不太值当了。 + +2、集成Web桌面形式 + + 将大神的web桌面集成进来(待议) \ No newline at end of file diff --git a/api/views_front.py b/api/views_front.py index 8b40d14..8a4ddf7 100644 --- a/api/views_front.py +++ b/api/views_front.py @@ -177,24 +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() - 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()] - @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) @@ -203,4 +198,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})