mirror of
https://github.com/kingmo888/rustdesk-api-server.git
synced 2026-02-21 18:37:23 +08:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71c6f290d1 | ||
|
|
d04154aa7e | ||
|
|
175e1165db | ||
|
|
7b8951d441 | ||
|
|
3978cf6ec8 | ||
|
|
6a4eeac871 | ||
|
|
e2bbf9c04c | ||
|
|
f8f6fc5668 | ||
|
|
67ce71773b | ||
|
|
38e4269025 | ||
|
|
f08d67ab78 | ||
|
|
e465b8eb08 | ||
|
|
352faed075 | ||
|
|
e26dc2d073 | ||
|
|
f90f707fd0 | ||
|
|
557dafe7ba | ||
|
|
0748c8aace | ||
|
|
20597e4769 | ||
|
|
51c53bb132 | ||
|
|
3d58e134aa | ||
|
|
1226b6ceee | ||
|
|
de5979bf3c | ||
|
|
44fa7a73e3 | ||
|
|
81341d5b6d | ||
|
|
aba300a0fa | ||
|
|
cefb253dad | ||
|
|
33c85f8b08 | ||
|
|
908d489326 | ||
|
|
e30db99700 | ||
|
|
a44bf5eb61 | ||
|
|
bad2eeef7c | ||
|
|
5ac578422b | ||
|
|
fcd5ccedd4 | ||
|
|
c5fe3e125c | ||
|
|
53068fd8de | ||
|
|
efa3decc31 | ||
|
|
acf11d5ab8 | ||
|
|
a9c21ffad4 | ||
|
|
5020b45962 | ||
|
|
a8b07cbc35 | ||
|
|
bbf586ff8c | ||
|
|
08b4e8ce3d | ||
|
|
41cbeed1c3 | ||
|
|
514a5b78c5 | ||
|
|
454d7a67a3 | ||
|
|
0a1107f71a | ||
|
|
a13d0fc7db | ||
|
|
fb1b0f7ce8 | ||
|
|
f0262634fd | ||
|
|
0aec8b49ec | ||
|
|
9731c58128 | ||
|
|
0585aa9ab7 | ||
|
|
2b3de4173a | ||
|
|
aa736e13b1 | ||
|
|
051ea1e504 | ||
|
|
b303d776c4 | ||
|
|
408f2847bc | ||
|
|
6c7cd025e6 |
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
name: Bug Report
|
name: Bug Report
|
||||||
description: File a bug report
|
description: Submit an error report. Failure to respond within 3 days after receiving a response will result in closure. Attention! Asking questions without starting is very unethical.(提交错误报告。在收到回复后3天内未做出回复将导致关闭。注意!不star却提问是很没有道德的。)
|
||||||
title: "[Bug]: "
|
title: "[Bug]: "
|
||||||
labels: ["bug"]
|
labels: ["bug"]
|
||||||
|
|
||||||
|
|||||||
56
.github/workflows/auto-close-issues.yml
vendored
Normal file
56
.github/workflows/auto-close-issues.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: Auto Close Issues if Not Starred
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
close_issue:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check if user has starred the repo
|
||||||
|
id: check_star
|
||||||
|
run: |
|
||||||
|
ISSUE_USER=$(jq -r '.issue.user.login' < $GITHUB_EVENT_PATH)
|
||||||
|
echo "Issue created by user: $ISSUE_USER"
|
||||||
|
PAGE=1
|
||||||
|
STARRED=""
|
||||||
|
|
||||||
|
while [[ -z "$STARRED" ]]; do
|
||||||
|
STARRED_RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
"https://api.github.com/repos/${{ github.repository }}/stargazers?per_page=100&page=$PAGE")
|
||||||
|
echo "STARRED_RESPONSE=$STARRED_RESPONSE" # 输出 API 返回的数据以检查结构
|
||||||
|
|
||||||
|
if [[ -z "$STARRED_RESPONSE" || "$STARRED_RESPONSE" == "[]" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
STARRED=$(echo "$STARRED_RESPONSE" | jq -r '.[] | select(.login == "'$ISSUE_USER'") | .login')
|
||||||
|
PAGE=$((PAGE + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$STARRED" ]]; then
|
||||||
|
echo "User has not starred the repo."
|
||||||
|
else
|
||||||
|
echo "User has starred the repo."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "starred=$STARRED" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: Close issue if not starred
|
||||||
|
if: env.starred == '0'
|
||||||
|
run: |
|
||||||
|
ISSUE_NUMBER=$(jq -r '.issue.number' < $GITHUB_EVENT_PATH)
|
||||||
|
echo "Closing issue #$ISSUE_NUMBER"
|
||||||
|
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/comments \
|
||||||
|
-d '{"body":"Please star the project before submitting an issue."}'
|
||||||
|
|
||||||
|
curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER \
|
||||||
|
-d '{"state":"closed"}'
|
||||||
119
.github/workflows/build.yml
vendored
Normal file
119
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
name: RustDesk Web Api
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
docker_username:
|
||||||
|
description: 'docker user name'
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
docker_password:
|
||||||
|
description: 'docker user password'
|
||||||
|
required: true
|
||||||
|
default: ''
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
alpine:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build Docker Image (Alpine)
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Release version
|
||||||
|
id: release_version
|
||||||
|
run: |
|
||||||
|
app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
||||||
|
echo "app_version=${app_version}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ github.event.inputs.docker_username }}/rustdesk-api-server
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.app_version }}
|
||||||
|
type=raw,value=latest
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Set Up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Set Up Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Login DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ github.event.inputs.docker_username }}
|
||||||
|
password: ${{ github.event.inputs.docker_password }}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Build Image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: docker
|
||||||
|
file: docker/Dockerfile
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
debian:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build Docker Image (Debian)
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Release version
|
||||||
|
id: release_version
|
||||||
|
run: |
|
||||||
|
app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
||||||
|
echo "app_version=${app_version}-debian" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ github.event.inputs.docker_username }}/rustdesk-api-server
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.app_version }}
|
||||||
|
type=raw,value=debian
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Set Up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Set Up Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Login DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ github.event.inputs.docker_username }}
|
||||||
|
password: ${{ github.event.inputs.docker_password }}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Build Image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: docker
|
||||||
|
file: docker/debian.Dockerfile
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
31
.github/workflows/docker-publish.yml
vendored
31
.github/workflows/docker-publish.yml
vendored
@ -10,10 +10,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
tags:
|
tags:
|
||||||
- "v*.*"
|
- "v*"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -21,13 +20,18 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: |
|
||||||
|
${{ env.IMAGE_NAME }}
|
||||||
|
ghcr.io/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@ -38,10 +42,16 @@ jobs:
|
|||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
@ -58,3 +68,12 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Update repo description
|
||||||
|
uses: peter-evans/dockerhub-description@v4
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
repository: ${{ env.IMAGE_NAME }}
|
||||||
|
short-description: ${{ github.event.repository.description }}
|
||||||
|
enable-url-completion: true
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
@ -23,4 +23,9 @@ dist
|
|||||||
dist-
|
dist-
|
||||||
dist_py38
|
dist_py38
|
||||||
|
|
||||||
LICENSE.rst
|
LICENSE.rst
|
||||||
|
|
||||||
|
db/test_db.sqlite3
|
||||||
|
job2en.py
|
||||||
|
|
||||||
|
新建文本文档.txt
|
||||||
@ -3,6 +3,13 @@ FROM python:3.10.3-alpine
|
|||||||
WORKDIR /rustdesk-api-server
|
WORKDIR /rustdesk-api-server
|
||||||
ADD . /rustdesk-api-server
|
ADD . /rustdesk-api-server
|
||||||
|
|
||||||
|
# 安装系统依赖
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
gcc \
|
||||||
|
musl-dev \
|
||||||
|
mariadb-connector-c-dev \
|
||||||
|
pkgconfig
|
||||||
|
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& pip install --no-cache-dir --disable-pip-version-check -r requirements.txt \
|
&& pip install --no-cache-dir --disable-pip-version-check -r requirements.txt \
|
||||||
&& rm -rf /var/cache/apk/* \
|
&& rm -rf /var/cache/apk/* \
|
||||||
|
|||||||
661
LICENSE.rst
661
LICENSE.rst
@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published
|
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
64
README.md
64
README.md
@ -1,13 +1,12 @@
|
|||||||
# rustdesk-api-server
|
# rustdesk-api-server
|
||||||
|
|
||||||
## 如果项目有帮到你,给个star不过分吧?
|
|
||||||
|
|
||||||
[The English explanation is available by clicking here.](https://github.com/kingmo888/rustdesk-api-server/blob/master/README_EN.md)
|
[The English explanation is available by clicking here.](https://github.com/kingmo888/rustdesk-api-server/blob/master/README_EN.md)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<i>一个 python 实现的 Rustdesk API 接口,支持 WebUI 管理</i>
|
<i>一个 python 实现的 Rustdesk API 接口,支持 WebUI 管理</i>
|
||||||
<br/>
|
<br/>
|
||||||
<img src ="https://img.shields.io/badge/Version-1.4.5-blueviolet.svg"/>
|
<img src ="https://img.shields.io/badge/Version-1.5.2-blueviolet.svg"/>
|
||||||
<img src ="https://img.shields.io/badge/Python-3.7|3.8|3.9|3.10|3.11-blue.svg" />
|
<img src ="https://img.shields.io/badge/Python-3.7|3.8|3.9|3.10|3.11-blue.svg" />
|
||||||
<img src ="https://img.shields.io/badge/Django-3.2+|4.x-yelow.svg" />
|
<img src ="https://img.shields.io/badge/Django-3.2+|4.x-yelow.svg" />
|
||||||
<br/>
|
<br/>
|
||||||
@ -15,6 +14,30 @@
|
|||||||
<img src ="https://img.shields.io/badge/Docker-arm|arm64|amd64-blue.svg" />
|
<img src ="https://img.shields.io/badge/Docker-arm|arm64|amd64-blue.svg" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
# 1.2.3版本与1.2.6+版本区别
|
||||||
|
#### **请使用自定义key,因不填写key、或使用服务端自动生成的key而引起的链接超时或建立链接时间过长的问题,不在本项目解决范围内。**
|
||||||
|
|
||||||
|
|
||||||
|
> rustdesk官方在其新版服务端中已[强制要求key](https://rustdesk.com/docs/zh-cn/self-host/rustdesk-server-oss/install/#key)(rustdesk-server版本号大概>=1.1.10)
|
||||||
|
|
||||||
|
- rustdesk版本<=1.2.3, 服务端请配合使用rustdesk-server<=1.1.10
|
||||||
|
- 根据自身需要来选择是否配置服务端的key参数。
|
||||||
|
- rustdesk版本>1.2.3, 服务端请配合使用rustdesk-server>=1.1.11
|
||||||
|
- 当使用rustdesk-server自动生成的key时,会出现链接缓慢甚至链接超时。
|
||||||
|
- 解决办法:使用自定义k——配置rustdesk-server时,传入k参数来自定义key值,同时客户端同步配置相同的key,即可秒连。
|
||||||
|
|
||||||
|
- rustdesk-server的dock-compose配置参考:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
`key是保证别人不能在知道你中继服务器的IP后,利用你的IP做中继。如果不配置key,就做好中继IP的保密工作,不要泄露给其他人。
|
||||||
|
而只要服务端配置了密钥,无论是随机生成(生成后本身就固定了),还是自定义的,如果控制客户端不配置对应key就无法控制其他机器(被控机器可以不填key)`
|
||||||
|
|
||||||
|
对于自定义key是否生效,请看rustdesk server中`hbbs`的日志:
|
||||||
|

|
||||||
|
|
||||||
|
## 展示
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 功能特点
|
## 功能特点
|
||||||
@ -131,6 +154,16 @@ services:
|
|||||||
| `CSRF_TRUSTED_ORIGINS` | 可选,默认关闭验证;<br>如需开启填写你的访问地址 `http://yourdomain.com:21114` <br>**如需关闭验证请删除此变量,而不是留空** | 防跨域信任来源 |
|
| `CSRF_TRUSTED_ORIGINS` | 可选,默认关闭验证;<br>如需开启填写你的访问地址 `http://yourdomain.com:21114` <br>**如需关闭验证请删除此变量,而不是留空** | 防跨域信任来源 |
|
||||||
| `ID_SERVER` | 可选,默认为和API服务器同主机。<br>可自定义如 `yourdomain.com` | Web控制端使用的ID服务器 |
|
| `ID_SERVER` | 可选,默认为和API服务器同主机。<br>可自定义如 `yourdomain.com` | Web控制端使用的ID服务器 |
|
||||||
| `DEBUG` | 可选,默认 `False` | 调试模式 |
|
| `DEBUG` | 可选,默认 `False` | 调试模式 |
|
||||||
|
| `ALLOW_REGISTRATION` | 可选,默认 `True` | 是否允许新用户注册 |
|
||||||
|
| 数据库配置 | -- 开始 -- | 若不使用MYSQL则以下皆无需配置 |
|
||||||
|
| `DATABASE_TYPE` | 可选,默认 `SQLITE3` | 数据库类型(SQLITE/MYSQL) |
|
||||||
|
| `MYSQL_DBNAME` | 可选,默认 `-` | MYSQL数据库名 |
|
||||||
|
| `MYSQL_HOST` | 可选,默认 `127.0.0.1` | MYSQL数据库的服务器IP |
|
||||||
|
| `MYSQL_USER` | 可选,默认 `-` | MYSQL数据库的用户名 |
|
||||||
|
| `MYSQL_PASSWORD` | 可选,默认 `-` | MYSQL数据库的密码 |
|
||||||
|
| `MYSQL_PORT` | 可选,默认 `3306` | MYSQL数据库端口 |
|
||||||
|
| 数据库配置 | -- 结束 -- | 查看【[sqlite3迁移mysql教程](/tutorial/sqlite2mysql.md)】 |
|
||||||
|
| `LANGUAGE_CODE` | 可选,默认 `zh-hans` | 语言,支持中文(`zh-hans`)、英语(`en`) |
|
||||||
|
|
||||||
## 使用问题
|
## 使用问题
|
||||||
|
|
||||||
@ -160,6 +193,10 @@ services:
|
|||||||
|
|
||||||
这种操作大概率是docker配置+nginx反代+SSL的组合,要注意修改CSRF_TRUSTED_ORIGINS,如果是ssl那就是https开头,否则就是http。
|
这种操作大概率是docker配置+nginx反代+SSL的组合,要注意修改CSRF_TRUSTED_ORIGINS,如果是ssl那就是https开头,否则就是http。
|
||||||
|
|
||||||
|
- Mysql版本要求
|
||||||
|
|
||||||
|
如果你使用的是Mysql数据库,需要注意django4.x版本需要Mysql8.0,如果要使用mysql5.8则需要将django版本降至3.2。
|
||||||
|
|
||||||
## 开发计划
|
## 开发计划
|
||||||
|
|
||||||
- [x] 分享设备给其他已注册用户(v1.3+)
|
- [x] 分享设备给其他已注册用户(v1.3+)
|
||||||
@ -170,14 +207,24 @@ services:
|
|||||||
- [x] 集成Web客户端形式(v1.4+)
|
- [x] 集成Web客户端形式(v1.4+)
|
||||||
|
|
||||||
> 将大神的web客户端集成进来,已集成。 [来源](https://www.52pojie.cn/thread-1708319-1-1.html)
|
> 将大神的web客户端集成进来,已集成。 [来源](https://www.52pojie.cn/thread-1708319-1-1.html)
|
||||||
|
|
||||||
- [ ] 对过期(不在线)设备的过滤,用以区分在线&离线设备
|
- [x] 对过期(不在线)设备的过滤,用以区分在线&离线设备(1.4.7)
|
||||||
|
|
||||||
> 通过配置方式,对过期超过指定时间的设备清理或过滤。
|
> 通过配置方式,对过期超过指定时间的设备清理或过滤。
|
||||||
|
|
||||||
- [ ] 首屏拆分为用户列表页与管理员列表页并增加分页。
|
- [x] 首屏拆分为用户列表页与管理员列表页并增加分页(1.4.6)。
|
||||||
|
|
||||||
- [ ] 支持信息导出到为xlsx文件。
|
- [x] 支持信息导出到为xlsx文件(1.4.6)。
|
||||||
|
|
||||||
|
> 支持管理员在【所有设备】页面导出所有设备信息。
|
||||||
|
|
||||||
|
- [x] 通过配置项设定是否允许新用户注册(1.4.7)。
|
||||||
|
|
||||||
|
- [x] 支持mysql及sqlite3迁移mysql(1.4.8)。
|
||||||
|
|
||||||
|
- [-] 用户前端修改密码。
|
||||||
|
|
||||||
|
- [-] 前端改造,所有页面自适应,前后端分离(计划V2)。
|
||||||
|
|
||||||
|
|
||||||
## 其他相关工具
|
## 其他相关工具
|
||||||
@ -190,3 +237,8 @@ services:
|
|||||||
|
|
||||||
## Stargazers over time
|
## Stargazers over time
|
||||||
[](https://starchart.cc/kingmo888/rustdesk-api-server)
|
[](https://starchart.cc/kingmo888/rustdesk-api-server)
|
||||||
|
|
||||||
|
|
||||||
|
## 联络我
|
||||||
|
|
||||||
|

|
||||||
131
README_EN.md
131
README_EN.md
@ -1,9 +1,15 @@
|
|||||||
# rustdesk-api-server
|
# rustdesk-api-server
|
||||||
|
|
||||||
|
## If the project has helped you, giving a star isn't too much, right?
|
||||||
|
|
||||||
|
## Please use the latest version 1.2.3 of the client.
|
||||||
|
|
||||||
|
[点击这里查看中文说明。](https://github.com/kingmo888/rustdesk-api-server/blob/master/README.md)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<i>A Python implementation of Rustdesk API with WebUI management support</i>
|
<i>A Rustdesk API interface implemented in Python, with WebUI management support</i>
|
||||||
<br/>
|
<br/>
|
||||||
<img src ="https://img.shields.io/badge/Version-1.4.2-blueviolet.svg"/>
|
<img src ="https://img.shields.io/badge/Version-1.5.1-blueviolet.svg"/>
|
||||||
<img src ="https://img.shields.io/badge/Python-3.7|3.8|3.9|3.10|3.11-blue.svg" />
|
<img src ="https://img.shields.io/badge/Python-3.7|3.8|3.9|3.10|3.11-blue.svg" />
|
||||||
<img src ="https://img.shields.io/badge/Django-3.2+|4.x-yelow.svg" />
|
<img src ="https://img.shields.io/badge/Django-3.2+|4.x-yelow.svg" />
|
||||||
<br/>
|
<br/>
|
||||||
@ -11,23 +17,19 @@
|
|||||||
<img src ="https://img.shields.io/badge/Docker-arm|arm64|amd64-blue.svg" />
|
<img src ="https://img.shields.io/badge/Docker-arm|arm64|amd64-blue.svg" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Background
|
|
||||||
|
|
||||||
After reviewing various versions of RustDesk WEB APIs available in the market, I found that there are some shortcomings, such as the need for URL registration, lack of support for certain interfaces in the new client version, and the inability to easily change passwords. Therefore, I decided to combine the strengths of different versions and create my own version that I like. I want to express my gratitude to the friends on the forum and GitHub who wrote the interfaces, saving me time in capturing and finding interfaces.
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Supports self-registration and login on the front-end web page.
|
- Supports self-registration and login on the front-end webpage.
|
||||||
- Registration and login pages:
|
- Registration and login pages:
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
- Displays device information on the front-end, with separate versions for administrators and users.
|
- Supports displaying device information on the front end, divided into administrator and user versions.
|
||||||
- Supports custom aliases (remarks).
|
- Supports custom aliases (remarks).
|
||||||
- Supports backend management.
|
- Supports backend management.
|
||||||
- Supports colored labels.
|
- Supports colored tags.
|
||||||

|

|
||||||
|
|
||||||
- Supports device online statistics.
|
- Supports device online statistics.
|
||||||
@ -35,21 +37,22 @@ After reviewing various versions of RustDesk WEB APIs available in the market, I
|
|||||||
- Automatically manages tokens and keeps them alive using the heartbeat interface.
|
- Automatically manages tokens and keeps them alive using the heartbeat interface.
|
||||||
- Supports sharing devices with other users.
|
- Supports sharing devices with other users.
|
||||||

|

|
||||||
- Supports web control panel (currently only supports non-SSL mode, see usage issues below).
|
- Supports web control terminal (currently only supports non-SSL mode, see below for usage issues)
|
||||||

|

|
||||||
|
|
||||||
Admin homepage:
|
Admin Home Page:
|
||||||

|

|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Method 1: Out-of-the-box
|
### Method 1: Out-of-the-box
|
||||||
|
|
||||||
Only supports Windows. Download the release, no need to install the environment, just run `启动.bat` directly. Screenshots:
|
Only supports Windows, please go to the release to download, no need to install environment, just run `启动.bat` directly. Screenshots:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Method 2: Run the Code
|
|
||||||
|
### Method 2: Running the Code
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone the code locally
|
# Clone the code locally
|
||||||
@ -58,28 +61,28 @@ git clone https://github.com/kingmo888/rustdesk-api-server.git
|
|||||||
cd rustdesk-api-server
|
cd rustdesk-api-server
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
# After ensuring that the dependencies are installed correctly, execute:
|
# After ensuring dependencies are installed correctly, execute:
|
||||||
# Modify the port number as needed; it is recommended to keep 21114 as the default port for Rustdesk API
|
# Please modify the port number yourself, it is recommended to keep 21114 as the default port for Rustdesk API
|
||||||
python manage.py runserver 0.0.0.0:21114
|
python manage.py runserver 0.0.0.0:21114
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you can access it using the format `http://localhost:port`.
|
Now you can access it using `http://localhostIP:Port`.
|
||||||
|
|
||||||
**Note**: If configuring on CentOS, Django 4 may have issues due to the system's low version of sqlite3. Please modify the file in the dependency library. Path: `xxxx/Lib/site-packages/django/db/backends/sqlite3/base.py` (find the package location according to your situation), and modify the content:
|
**Note**: When configuring on CentOS, Django4 may have problems due to the low version of sqlite3 in the system. Please modify the file in the dependency library. Path: `xxxx/Lib/site-packages/django/db/backends/sqlite3/base.py` (Find the package address according to the situation), modify the content:
|
||||||
```python
|
```python
|
||||||
# from sqlite3 import dbapi2 as Database #(Comment out this line)
|
# from sqlite3 import dbapi2 as Database #(comment out this line)
|
||||||
from pysqlite3 import dbapi2 as Database # Enable pysqlite3
|
from pysqlite3 import dbapi2 as Database # enable pysqlite3
|
||||||
```
|
```
|
||||||
|
|
||||||
### Method 3: Docker Run
|
### Method 3: Docker Run
|
||||||
|
|
||||||
#### Docker Method 1: Build it yourself
|
#### Docker Method 1: Build Yourself
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/kingmo888/rustdesk-api-server.git
|
git clone https://github.com/kingmo888/rustdesk-api-server.git
|
||||||
cd rustdesk-api-server
|
cd rustdesk-api-server
|
||||||
docker compose --compatibility up --build -d
|
docker compose --compatibility up --build -d
|
||||||
```
|
```
|
||||||
Thanks to the enthusiastic netizen @ferocknew for providing this.
|
Thanks to the enthusiastic netizen @ferocknew for providing.
|
||||||
|
|
||||||
#### Docker Method 2: Pre-built Run
|
#### Docker Method 2: Pre-built Run
|
||||||
|
|
||||||
@ -89,9 +92,9 @@ docker run command:
|
|||||||
docker run -d \
|
docker run -d \
|
||||||
--name rustdesk-api-server \
|
--name rustdesk-api-server \
|
||||||
-p 21114:21114 \
|
-p 21114:21114 \
|
||||||
-e CSRF_TRUSTED_ORIGINS=http://yourdomain.com:21114 \ # Cross-origin trusted source, optional
|
-e CSRF_TRUSTED_ORIGINS=http://yourdomain.com:21114 \ #Cross-origin trusted source, optional
|
||||||
-e ID_SERVER=yourdomain.com \ # ID server used by the Web control panel
|
-e ID_SERVER=yourdomain.com \ #ID server used by the web control terminal
|
||||||
-v /yourpath/db:/rustdesk-api-server/db \ # Modify /yourpath/db to the directory where you want to mount the database on your host
|
-v /yourpath/db:/rustdesk-api-server/db \ #Modify /yourpath/db to your host database mount directory
|
||||||
-v /etc/timezone:/etc/timezone:ro \
|
-v /etc/timezone:/etc/timezone:ro \
|
||||||
-v /etc/localtime:/etc/localtime:ro \
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
--network bridge \
|
--network bridge \
|
||||||
@ -108,10 +111,10 @@ services:
|
|||||||
container_name: rustdesk-api-server
|
container_name: rustdesk-api-server
|
||||||
image: ghcr.io/kingmo888/rustdesk-api-server:latest
|
image: ghcr.io/kingmo888/rustdesk-api-server:latest
|
||||||
environment:
|
environment:
|
||||||
- CSRF_TRUSTED_ORIGINS=http://yourdomain.com:21114 # Cross-origin trusted source, optional
|
- CSRF_TRUSTED_ORIGINS=http://yourdomain.com:21114 #Cross-origin trusted source, optional
|
||||||
- ID_SERVER=yourdomain.com # ID server used by the Web control panel
|
- ID_SERVER=yourdomain.com #ID server used by the web control terminal
|
||||||
volumes:
|
volumes:
|
||||||
- /yourpath/db:/rustdesk-api-server/db # Modify /yourpath/db to the directory where you want to mount the database on your host
|
- /yourpath/db:/rustdesk-api-server/db #Modify /yourpath/db to your host database mount directory
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
network_mode: bridge
|
network_mode: bridge
|
||||||
@ -122,60 +125,86 @@ services:
|
|||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
| Variable Name | Reference Value | Remarks |
|
| Variable Name | Reference Value | Note |
|
||||||
| ---- | ------- | ----------- |
|
| ---- | ------- | ----------- |
|
||||||
| `HOST` | Default `0.0.0.0` | IP to bind the service |
|
| `HOST` | Default `0.0.0.0` | IP binding of the service |
|
||||||
| `TZ` | Default `Asia/Shanghai`, optional | Timezone |
|
| `TZ` | Default `Asia/Shanghai`, optional | Timezone |
|
||||||
| `SECRET_KEY` | Optional, custom random string | Program encryption key |
|
| `SECRET_KEY` | Optional, custom a random string | Program encryption key |
|
||||||
| `CSRF_TRUSTED_ORIGINS` | Optional, verification closed by default;<br> If needed, fill in your access address `http://yourdomain.com:21114` <br>**If you want to disable verification, please delete this variable instead of leaving it blank** | Cross-origin trusted source |
|
| `CSRF_TRUSTED_ORIGINS` | Optional, verification off by default;<br>If you need to enable it, fill in your access address `http://yourdomain.com:21114` <br>**To disable verification, please delete this variable instead of leaving it blank** | Cross-origin trusted source |
|
||||||
| `ID_SERVER` | Optional, default is the same host as the API server.<br> Can be customized, such as `yourdomain.com` | ID server used by the Web control panel |
|
| `ID_SERVER` | Optional, default is the same host as the API server.<br>Customizable like `yourdomain.com` | ID server used by the web control terminal |
|
||||||
| `DEBUG` | Optional, default `False` | Debug mode |
|
| `DEBUG` | Optional, default `False` | Debug mode |
|
||||||
|
| `ALLOW_REGISTRATION` | Optional, default `True` | Whether to allow new user registration |
|
||||||
|
| Database Configuration | -- Start -- | If not using MYSQL, the following are unnecessary |
|
||||||
|
| `DATABASE_TYPE` | Optional, default `SQLITE3` | Database type (SQLITE/MYSQL) |
|
||||||
|
| `MYSQL_DBNAME` | Optional, default `-` | MYSQL database name |
|
||||||
|
| `MYSQL_HOST` | Optional, default `127.0.0.1` | MYSQL database server IP |
|
||||||
|
| `MYSQL_USER` | Optional, default `-` | MYSQL database username |
|
||||||
|
| `MYSQL_PASSWORD` | Optional, default `-` | MYSQL database password |
|
||||||
|
| `MYSQL_PORT` | Optional, default `3306` | MYSQL database port |
|
||||||
|
| Database Configuration | -- End -- | See [sqlite3 migration to mysql tutorial](/tutorial/sqlite2mysql.md) |
|
||||||
|
|
||||||
## Usage Issues
|
## Usage Issues
|
||||||
|
|
||||||
- Administrator Setup
|
- Administrator Settings
|
||||||
|
|
||||||
When there is no account in the database, the first registered account will directly obtain super administrator privileges, and subsequent registered accounts will be ordinary accounts.
|
When there are no accounts in the database, the first registered account directly obtains super administrator privileges,
|
||||||
|
|
||||||
|
and subsequently registered accounts are ordinary accounts.
|
||||||
|
|
||||||
- Device Information
|
- Device Information
|
||||||
|
|
||||||
After testing, the client will periodically send device information to the API interface in the service mode installed in non-green mode. Therefore, if you want device information, you need to install the rustdesk client and start the service.
|
Tested, the client will send device information to the API interface regularly in the mode of installation as a service under non-green mode, so if you want device information, you need to install the Rustdesk client and start the service.
|
||||||
|
|
||||||
- Slow Connection Speed
|
- Slow Connection Speed
|
||||||
|
|
||||||
In the new Key mode, the connection speed is slow. When starting the service on the server, do not use the -k without parameters. In this case, the client cannot configure the key either.
|
The new version Key mode connection speed is slow. You can start the service on the server without the -k parameter. At this time, the client cannot configure the key either.
|
||||||
|
|
||||||
- Web Control Panel Configuration
|
- Web Control Terminal Configuration
|
||||||
|
|
||||||
- Set the ID_SERVER environment variable, or modify the ID_SERVER configuration
|
- Set the ID_SERVER environment variable or modify the ID_SERVER configuration item in the rustdesk_server_api/settings.py file and fill in the IP or domain name of the ID server/relay server.
|
||||||
|
|
||||||
item in the rustdesk_server_api/settings.py file, and fill in the IP or domain name of the ID server.
|
- Web Control Terminal Keeps Spinning
|
||||||
|
|
||||||
- Web Control Panel Keeps Spinning
|
- Check if the ID server filling is correct.
|
||||||
|
|
||||||
- Check if the ID server is filled in correctly.
|
- The web control terminal currently only supports non-SSL mode. If the webui is accessed via https, remove the 's', otherwise ws cannot connect and keeps spinning. For example: https://domain.com/webui, change to http://domain.com/webui
|
||||||
|
|
||||||
- The Web control panel currently only supports non-SSL mode. If the webui is accessed via https, please remove the 's', otherwise ws will not connect and keep spinning. For example: https://domain.com/webui, change it to http://domain.com/webui
|
- CSRF verification failed when logging in or logging out of backend operations. Request interrupted.
|
||||||
|
|
||||||
- CSRF verification fails when logging in or logging out of backend operations: The CSRF verification failed. The request was aborted.
|
This operation is highly likely to be a combination of docker configuration + nginx reverse proxy + SSL. Pay attention to modifying CSRF_TRUSTED_ORIGINS. If it is SSL, it starts with https, otherwise it is http.
|
||||||
|
|
||||||
This type of operation is most likely a combination of Docker configuration + Nginx reverse proxy + SSL. Pay attention to modifying CSRF_TRUSTED_ORIGINS. If it is SSL, it should start with https, otherwise it should be http.
|
|
||||||
|
|
||||||
## Development Plans
|
## Development Plans
|
||||||
|
|
||||||
- [x] Share devices with other registered users (v1.3+)
|
- [x] Share devices with other registered users (v1.3+)
|
||||||
|
|
||||||
> Explanation: Similar to sharing URLs of cloud disks, activating the URL will allow access to devices under a certain group or certain label.
|
> Explanation: Similar to sharing URLs of network disks, the URL can be activated to obtain devices under a certain group or certain label.
|
||||||
> Note: As a middleware, the web API can't do much, and more features still need to be implemented by modifying the client, which is not very cost-effective.
|
> Note: In fact, there is not much that can be done with the web API as middleware. More functions still need to be implemented by modifying the client, which is not very worthwhile.
|
||||||
|
|
||||||
- [x] Integration of Web client form (v1.4+)
|
- [x] Integration of Web client form (v1.4+)
|
||||||
|
|
||||||
> Integrated the web client of a master. Already integrated. [Source](https://www.52pojie.cn/thread-1708319-1-1.html)
|
> Integrating the great god's web client, already integrated. [Source](https://www.52pojie.cn/thread-1708319-1-1.html)
|
||||||
|
|
||||||
|
- [x] Filter expired (offline) devices to distinguish between online and offline devices (1.4.7)
|
||||||
|
|
||||||
|
> By configuration, clean or filter devices that have expired for more than a specified time.
|
||||||
|
|
||||||
|
- [x] Split the first screen into user list page and administrator list page and add pagination (1.4.6).
|
||||||
|
|
||||||
|
- [x] Support exporting information to xlsx files (1.4.6).
|
||||||
|
|
||||||
|
> Allows administrators to export all device information on the [All Devices] page.
|
||||||
|
|
||||||
|
- [x] Set whether to allow new user registration through configuration items (1.4.7).
|
||||||
|
|
||||||
|
- [x] Support mysql and sqlite3 migration to mysql (1.4.8).
|
||||||
|
|
||||||
## Other Related Tools
|
## Other Related Tools
|
||||||
|
|
||||||
- [CMD script to change client ID](https://github.com/abdullah-erturk/RustDesk-ID-Changer)
|
- [CMD script for modifying client ID](https://github.com/abdullah-erturk/RustDesk-ID-Changer)
|
||||||
|
|
||||||
- [rustdesk](https://github.com/rustdesk/rustdesk)
|
- [rustdesk](https://github.com/rustdesk/rustdesk)
|
||||||
|
|
||||||
- [rustdesk-server](https://github.com/rustdesk/rustdesk-server)
|
- [rustdesk-server](https://github.com/rustdesk/rustdesk-server)
|
||||||
|
|
||||||
|
## Stargazers over time
|
||||||
|
[](https://starchart.cc/kingmo888/rustdesk-api-server)
|
||||||
@ -5,14 +5,14 @@ from django import forms
|
|||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||||
from django.contrib.auth.forms import ReadOnlyPasswordHashField
|
from django.contrib.auth.forms import ReadOnlyPasswordHashField
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
||||||
class UserCreationForm(forms.ModelForm):
|
class UserCreationForm(forms.ModelForm):
|
||||||
"""A form for creating new users. Includes all the required
|
"""A form for creating new users. Includes all the required
|
||||||
fields, plus a repeated password."""
|
fields, plus a repeated password."""
|
||||||
password1 = forms.CharField(label='密码', widget=forms.PasswordInput)
|
password1 = forms.CharField(label=_('密码'), widget=forms.PasswordInput)
|
||||||
password2 = forms.CharField(label='再次输入密码', widget=forms.PasswordInput)
|
password2 = forms.CharField(label=_('再次输入密码'), widget=forms.PasswordInput)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.UserProfile
|
model = models.UserProfile
|
||||||
@ -23,7 +23,7 @@ class UserCreationForm(forms.ModelForm):
|
|||||||
password1 = self.cleaned_data.get("password1")
|
password1 = self.cleaned_data.get("password1")
|
||||||
password2 = self.cleaned_data.get("password2")
|
password2 = self.cleaned_data.get("password2")
|
||||||
if password1 and password2 and password1 != password2:
|
if password1 and password2 and password1 != password2:
|
||||||
raise forms.ValidationError("密码校验失败,两次密码不一致。")
|
raise forms.ValidationError(_("密码校验失败,两次密码不一致。"))
|
||||||
return password2
|
return password2
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class UserChangeForm(forms.ModelForm):
|
|||||||
the user, but replaces the password field with admin's
|
the user, but replaces the password field with admin's
|
||||||
password hash display field.
|
password hash display field.
|
||||||
"""
|
"""
|
||||||
password = ReadOnlyPasswordHashField(label=("密码Hash值"), help_text=("<a href=\"../password/\">点击修改密码</a>."))
|
password = ReadOnlyPasswordHashField(label=(_("密码Hash值")), help_text=("<a href=\"../password/\">点击修改密码</a>."))
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.UserProfile
|
model = models.UserProfile
|
||||||
fields = ('username', 'is_active', 'is_admin')
|
fields = ('username', 'is_active', 'is_admin')
|
||||||
@ -72,7 +72,7 @@ class UserAdmin(BaseUserAdmin):
|
|||||||
list_display = ('username', 'rid')
|
list_display = ('username', 'rid')
|
||||||
list_filter = ('is_admin', 'is_active')
|
list_filter = ('is_admin', 'is_active')
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('基本信息', {'fields': ('username', 'password', 'is_active', 'is_admin', 'rid', 'uuid', 'deviceInfo',)}),
|
(_('基本信息'), {'fields': ('username', 'password', 'is_active', 'is_admin', 'rid', 'uuid', 'deviceInfo',)}),
|
||||||
|
|
||||||
)
|
)
|
||||||
readonly_fields = ( 'rid', 'uuid')
|
readonly_fields = ( 'rid', 'uuid')
|
||||||
@ -94,6 +94,8 @@ admin.site.register(models.RustDeskTag, models.RustDeskTagAdmin)
|
|||||||
admin.site.register(models.RustDeskPeer, models.RustDeskPeerAdmin)
|
admin.site.register(models.RustDeskPeer, models.RustDeskPeerAdmin)
|
||||||
admin.site.register(models.RustDesDevice, models.RustDesDeviceAdmin)
|
admin.site.register(models.RustDesDevice, models.RustDesDeviceAdmin)
|
||||||
admin.site.register(models.ShareLink, models.ShareLinkAdmin)
|
admin.site.register(models.ShareLink, models.ShareLinkAdmin)
|
||||||
|
admin.site.register(models.ConnLog, models.ConnLogAdmin)
|
||||||
|
admin.site.register(models.FileLog, models.FileLogAdmin)
|
||||||
admin.site.unregister(Group)
|
admin.site.unregister(Group)
|
||||||
admin.site.site_header = 'RustDesk自建Web'
|
admin.site.site_header = _('RustDesk自建Web')
|
||||||
admin.site.site_title = '未定义'
|
admin.site.site_title = _('未定义')
|
||||||
78
api/front_locale.py
Normal file
78
api/front_locale.py
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
||||||
|
_('管理后台')
|
||||||
|
_('ID列表')
|
||||||
|
_('分享机器')
|
||||||
|
_('这么简易的东西,忘记密码这功能就没必要了吧。')
|
||||||
|
_('立即注册')
|
||||||
|
_('创建时间')
|
||||||
|
_('注册成功,请前往登录页登录。')
|
||||||
|
_('注册日期')
|
||||||
|
_('2、所分享的机器,被分享人享有相同的权限,如果机器设置了保存密码,被分享人也可以直接连接。')
|
||||||
|
_('导出xlsx')
|
||||||
|
_('生成分享链接')
|
||||||
|
_('请输入8~20位密码。可以包含字母、数字和特殊字符。')
|
||||||
|
_('尾页')
|
||||||
|
_('请确认密码')
|
||||||
|
_('注册')
|
||||||
|
_('内存')
|
||||||
|
_('首页')
|
||||||
|
_('网页控制')
|
||||||
|
_('注册时间')
|
||||||
|
_('链接地址')
|
||||||
|
_('请输入密码')
|
||||||
|
_('系统用户名')
|
||||||
|
_('状态')
|
||||||
|
_('已有账号?立即登录')
|
||||||
|
_('密码')
|
||||||
|
_('别名')
|
||||||
|
_('上一页')
|
||||||
|
_('更新时间')
|
||||||
|
_('综合屏')
|
||||||
|
_('平台')
|
||||||
|
_('全部用户')
|
||||||
|
_('注册页')
|
||||||
|
_('分享机器给其他用户')
|
||||||
|
_('所有设备')
|
||||||
|
_('连接密码')
|
||||||
|
_('设备统计')
|
||||||
|
_('所属用户')
|
||||||
|
_('分享')
|
||||||
|
_('请输入用户名')
|
||||||
|
_('1、链接有效期为15分钟,切勿随意分享给他人。')
|
||||||
|
_('CPU')
|
||||||
|
_('客户端ID')
|
||||||
|
_('下一页')
|
||||||
|
_('登录')
|
||||||
|
_('退出')
|
||||||
|
_('请将要分享的机器调整到右侧')
|
||||||
|
_('成功!如需分享,请复制以下链接给其他人:<br>')
|
||||||
|
_('忘记密码?')
|
||||||
|
_('计算机名')
|
||||||
|
_('两次输入密码不一致!')
|
||||||
|
_('页码')
|
||||||
|
_('版本')
|
||||||
|
_('用户名')
|
||||||
|
_('3、为保障安全,链接有效期为15分钟、链接仅有效1次。链接一旦被(非分享人的登录用户)访问,分享生效,后续访问链接失效。')
|
||||||
|
_('系统')
|
||||||
|
_('我的机器')
|
||||||
|
_('信息')
|
||||||
|
_('远程ID')
|
||||||
|
_('远程别名')
|
||||||
|
_('用户ID')
|
||||||
|
_('用户别名')
|
||||||
|
_('用户IP')
|
||||||
|
_('文件大小')
|
||||||
|
_('发送/接受')
|
||||||
|
_('记录于')
|
||||||
|
_('连接开始时间')
|
||||||
|
_('连接结束时间')
|
||||||
|
_('时长')
|
||||||
|
_('连接日志')
|
||||||
|
_('文件传输日志')
|
||||||
|
_('页码 #')
|
||||||
|
_('下一页 #')
|
||||||
|
_('上一页 #')
|
||||||
|
_('第一页')
|
||||||
|
_('上页')
|
||||||
238
api/migrations/0003_alter_rustdesdevice_options_and_more.py
Normal file
238
api/migrations/0003_alter_rustdesdevice_options_and_more.py
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-03-15 20:52
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("api", "0002_alter_rustdesdevice_cpu_alter_rustdesdevice_hostname_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesdevice",
|
||||||
|
options={
|
||||||
|
"ordering": ("-rid",),
|
||||||
|
"verbose_name": "Device",
|
||||||
|
"verbose_name_plural": "Device List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdeskpeer",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Peers",
|
||||||
|
"verbose_name_plural": "Peers List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktag",
|
||||||
|
options={
|
||||||
|
"ordering": ("-uid",),
|
||||||
|
"verbose_name": "Tags",
|
||||||
|
"verbose_name_plural": "Tags List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktoken",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Token",
|
||||||
|
"verbose_name_plural": "Token List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="sharelink",
|
||||||
|
options={
|
||||||
|
"ordering": ("-create_time",),
|
||||||
|
"verbose_name": "Share Link",
|
||||||
|
"verbose_name_plural": "Link List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="userprofile",
|
||||||
|
options={
|
||||||
|
"permissions": (
|
||||||
|
("view_task", "Can see available tasks"),
|
||||||
|
("change_task_status", "Can change the status of tasks"),
|
||||||
|
("close_task", "Can remove a task by setting its status as closed"),
|
||||||
|
),
|
||||||
|
"verbose_name": "User",
|
||||||
|
"verbose_name_plural": "User List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="Device Registration Time"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Hostname"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="memory",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Memory"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="os",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Operating System"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="Client ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=100, verbose_name="System Username"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="version",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Client Version"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="alias",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Alias"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Operating System Name"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="platform",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Platform"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rhash",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=60, verbose_name="Device Connection Password"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="Client ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="tags",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Tag"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="System Username"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_color",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="Tag Color"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_name",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="Tag Name"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="Belongs to User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="access_token",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=60, verbose_name="Access Token"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="Login Time"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="Username"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uuid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="UUID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="Creation Time"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_expired",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Is Expired"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_used",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Is Used"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="peers",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="Machine ID List"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="shash",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="Link Key"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="deviceInfo",
|
||||||
|
field=models.TextField(blank=True, verbose_name="Login Information:"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_active",
|
||||||
|
field=models.BooleanField(default=True, verbose_name="Is Activated"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_admin",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Is Admin"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=50, unique=True, verbose_name="Username"),
|
||||||
|
),
|
||||||
|
]
|
||||||
232
api/migrations/0004_alter_rustdesdevice_options_and_more.py
Normal file
232
api/migrations/0004_alter_rustdesdevice_options_and_more.py
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-03-15 23:52
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("api", "0003_alter_rustdesdevice_options_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesdevice",
|
||||||
|
options={
|
||||||
|
"ordering": ("-rid",),
|
||||||
|
"verbose_name": "设备",
|
||||||
|
"verbose_name_plural": "设备列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdeskpeer",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Peers",
|
||||||
|
"verbose_name_plural": "Peers列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktag",
|
||||||
|
options={
|
||||||
|
"ordering": ("-uid",),
|
||||||
|
"verbose_name": "Tags",
|
||||||
|
"verbose_name_plural": "Tags列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktoken",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Token",
|
||||||
|
"verbose_name_plural": "Token列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="sharelink",
|
||||||
|
options={
|
||||||
|
"ordering": ("-create_time",),
|
||||||
|
"verbose_name": "分享链接",
|
||||||
|
"verbose_name_plural": "链接列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="userprofile",
|
||||||
|
options={
|
||||||
|
"permissions": (
|
||||||
|
("view_task", "Can see available tasks"),
|
||||||
|
("change_task_status", "Can change the status of tasks"),
|
||||||
|
("close_task", "Can remove a task by setting its status as closed"),
|
||||||
|
),
|
||||||
|
"verbose_name": "用户",
|
||||||
|
"verbose_name_plural": "用户列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="设备注册时间"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="主机名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="memory",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="内存"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="os",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="操作系统"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="客户端ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(blank=True, max_length=100, verbose_name="系统用户名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="version",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="客户端版本"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="alias",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="别名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="操作系统名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="platform",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="平台"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rhash",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="设备链接密码"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="客户端ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="tags",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="标签"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="系统用户名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_color",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="标签颜色"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_name",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="标签名称"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="所属用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="access_token",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=60, verbose_name="access_token"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="登录时间"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="用户名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uuid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="uuid"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="生成时间"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_expired",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="是否过期"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_used",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="是否使用"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="peers",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="机器ID列表"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="shash",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="链接Key"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="deviceInfo",
|
||||||
|
field=models.TextField(blank=True, verbose_name="登录信息:"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_active",
|
||||||
|
field=models.BooleanField(default=True, verbose_name="是否激活"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_admin",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="是否管理员"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=50, unique=True, verbose_name="用户名"),
|
||||||
|
),
|
||||||
|
]
|
||||||
41
api/migrations/0005_connlog_filelog.py
Normal file
41
api/migrations/0005_connlog_filelog.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Generated by Django 5.0.3 on 2024-04-17 08:35
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0004_alter_rustdesdevice_options_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ConnLog',
|
||||||
|
fields=[
|
||||||
|
('id', models.IntegerField(primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('action', models.CharField(max_length=20, null=True, verbose_name='Action')),
|
||||||
|
('conn_id', models.CharField(max_length=10, null=True, verbose_name='Connection ID')),
|
||||||
|
('from_ip', models.CharField(max_length=30, null=True, verbose_name='From IP')),
|
||||||
|
('from_id', models.CharField(max_length=20, null=True, verbose_name='From ID')),
|
||||||
|
('rid', models.CharField(max_length=20, null=True, verbose_name='To ID')),
|
||||||
|
('conn_start', models.DateTimeField(null=True, verbose_name='Connected')),
|
||||||
|
('conn_end', models.DateTimeField(null=True, verbose_name='Disconnected')),
|
||||||
|
('session_id', models.CharField(max_length=60, null=True, verbose_name='Session ID')),
|
||||||
|
('uuid', models.CharField(max_length=60, null=True, verbose_name='uuid')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='FileLog',
|
||||||
|
fields=[
|
||||||
|
('id', models.IntegerField(primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('file', models.CharField(max_length=500, verbose_name='Path')),
|
||||||
|
('remote_id', models.CharField(default='0', max_length=20, verbose_name='Remote ID')),
|
||||||
|
('user_id', models.CharField(default='0', max_length=20, verbose_name='User ID')),
|
||||||
|
('user_ip', models.CharField(default='0', max_length=20, verbose_name='User IP')),
|
||||||
|
('filesize', models.CharField(default='', max_length=500, verbose_name='Filesize')),
|
||||||
|
('direction', models.IntegerField(default=0, verbose_name='Direction')),
|
||||||
|
('logged_at', models.DateTimeField(null=True, verbose_name='Logged At')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
240
api/migrations/0006_alter_rustdesdevice_options_and_more.py
Normal file
240
api/migrations/0006_alter_rustdesdevice_options_and_more.py
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-05-14 10:43
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("api", "0005_connlog_filelog"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesdevice",
|
||||||
|
options={
|
||||||
|
"ordering": ("-rid",),
|
||||||
|
"verbose_name": "Device",
|
||||||
|
"verbose_name_plural": "Device List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdeskpeer",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Peers",
|
||||||
|
"verbose_name_plural": "Peers List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktag",
|
||||||
|
options={
|
||||||
|
"ordering": ("-uid",),
|
||||||
|
"verbose_name": "Tags",
|
||||||
|
"verbose_name_plural": "Tags List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktoken",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Token",
|
||||||
|
"verbose_name_plural": "Token List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="sharelink",
|
||||||
|
options={
|
||||||
|
"ordering": ("-create_time",),
|
||||||
|
"verbose_name": "Share Link",
|
||||||
|
"verbose_name_plural": "Link List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="userprofile",
|
||||||
|
options={
|
||||||
|
"permissions": (
|
||||||
|
("view_task", "Can see available tasks"),
|
||||||
|
("change_task_status", "Can change the status of tasks"),
|
||||||
|
("close_task", "Can remove a task by setting its status as closed"),
|
||||||
|
),
|
||||||
|
"verbose_name": "User",
|
||||||
|
"verbose_name_plural": "User List",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="Device Registration Time"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Hostname"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="memory",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Memory"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="os",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Operating System"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="Client ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=100, verbose_name="System Username"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="version",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="Client Version"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="alias",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Alias"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Operating System Name"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="platform",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Platform"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rhash",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=60, verbose_name="Device Connection Password"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="Client ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="tags",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="Tag"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="System Username"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_color",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="Tag Color"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_name",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="Tag Name"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="Belongs to User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="access_token",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=60, verbose_name="Access Token"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="Login Time"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="Username"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uuid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="UUID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(
|
||||||
|
auto_now_add=True, verbose_name="Generation Time"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_expired",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Is Expired"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_used",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Is Used"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="peers",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="Machine ID List"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="shash",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="Link Key"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="User ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="deviceInfo",
|
||||||
|
field=models.TextField(blank=True, verbose_name="Login Information:"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_active",
|
||||||
|
field=models.BooleanField(default=True, verbose_name="Is Active"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_admin",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Is Administrator"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=50, unique=True, verbose_name="Username"),
|
||||||
|
),
|
||||||
|
]
|
||||||
232
api/migrations/0007_alter_rustdesdevice_options_and_more.py
Normal file
232
api/migrations/0007_alter_rustdesdevice_options_and_more.py
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-05-14 10:46
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("api", "0006_alter_rustdesdevice_options_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesdevice",
|
||||||
|
options={
|
||||||
|
"ordering": ("-rid",),
|
||||||
|
"verbose_name": "设备",
|
||||||
|
"verbose_name_plural": "设备列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdeskpeer",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Peers",
|
||||||
|
"verbose_name_plural": "Peers列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktag",
|
||||||
|
options={
|
||||||
|
"ordering": ("-uid",),
|
||||||
|
"verbose_name": "Tags",
|
||||||
|
"verbose_name_plural": "Tags列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="rustdesktoken",
|
||||||
|
options={
|
||||||
|
"ordering": ("-username",),
|
||||||
|
"verbose_name": "Token",
|
||||||
|
"verbose_name_plural": "Token列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="sharelink",
|
||||||
|
options={
|
||||||
|
"ordering": ("-create_time",),
|
||||||
|
"verbose_name": "分享链接",
|
||||||
|
"verbose_name_plural": "链接列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="userprofile",
|
||||||
|
options={
|
||||||
|
"permissions": (
|
||||||
|
("view_task", "Can see available tasks"),
|
||||||
|
("change_task_status", "Can change the status of tasks"),
|
||||||
|
("close_task", "Can remove a task by setting its status as closed"),
|
||||||
|
),
|
||||||
|
"verbose_name": "用户",
|
||||||
|
"verbose_name_plural": "用户列表",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="设备注册时间"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="主机名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="memory",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="内存"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="os",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="操作系统"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="客户端ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(blank=True, max_length=100, verbose_name="系统用户名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesdevice",
|
||||||
|
name="version",
|
||||||
|
field=models.CharField(max_length=100, verbose_name="客户端版本"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="alias",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="别名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="hostname",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="操作系统名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="platform",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="平台"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rhash",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="设备链接密码"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="rid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="客户端ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="tags",
|
||||||
|
field=models.CharField(max_length=30, verbose_name="标签"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdeskpeer",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="系统用户名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_color",
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name="标签颜色"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="tag_name",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="标签名称"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktag",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="所属用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="access_token",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=60, verbose_name="access_token"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="登录时间"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="用户名"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="rustdesktoken",
|
||||||
|
name="uuid",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="uuid"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="create_time",
|
||||||
|
field=models.DateTimeField(auto_now_add=True, verbose_name="生成时间"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_expired",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="是否过期"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="is_used",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="是否使用"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="peers",
|
||||||
|
field=models.CharField(max_length=20, verbose_name="机器ID列表"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="shash",
|
||||||
|
field=models.CharField(max_length=60, verbose_name="链接Key"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="sharelink",
|
||||||
|
name="uid",
|
||||||
|
field=models.CharField(max_length=16, verbose_name="用户ID"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="deviceInfo",
|
||||||
|
field=models.TextField(blank=True, verbose_name="登录信息:"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_active",
|
||||||
|
field=models.BooleanField(default=True, verbose_name="是否激活"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="is_admin",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="是否管理员"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="username",
|
||||||
|
field=models.CharField(max_length=50, unique=True, verbose_name="用户名"),
|
||||||
|
),
|
||||||
|
]
|
||||||
18
api/migrations/0008_rustdesdevice_ip_address.py
Normal file
18
api/migrations/0008_rustdesdevice_ip_address.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2 on 2024-09-09 10:37
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('api', '0007_alter_rustdesdevice_options_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='rustdesdevice',
|
||||||
|
name='ip_address',
|
||||||
|
field=models.CharField(blank=True, max_length=60, verbose_name='IP'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -4,7 +4,7 @@ from django.contrib.auth.models import (
|
|||||||
BaseUserManager,AbstractBaseUser,PermissionsMixin
|
BaseUserManager,AbstractBaseUser,PermissionsMixin
|
||||||
)
|
)
|
||||||
from .models_work import *
|
from .models_work import *
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
class MyUserManager(BaseUserManager):
|
class MyUserManager(BaseUserManager):
|
||||||
def create_user(self, username, password=None):
|
def create_user(self, username, password=None):
|
||||||
@ -29,7 +29,7 @@ class MyUserManager(BaseUserManager):
|
|||||||
|
|
||||||
|
|
||||||
class UserProfile(AbstractBaseUser, PermissionsMixin):
|
class UserProfile(AbstractBaseUser, PermissionsMixin):
|
||||||
username = models.CharField('用户名',
|
username = models.CharField(_('用户名'),
|
||||||
unique=True,
|
unique=True,
|
||||||
max_length=50)
|
max_length=50)
|
||||||
|
|
||||||
@ -37,10 +37,10 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||||||
uuid = models.CharField(verbose_name='uuid', max_length=60)
|
uuid = models.CharField(verbose_name='uuid', max_length=60)
|
||||||
autoLogin = models.BooleanField(verbose_name='autoLogin', default=True)
|
autoLogin = models.BooleanField(verbose_name='autoLogin', default=True)
|
||||||
rtype = models.CharField(verbose_name='rtype', max_length=20)
|
rtype = models.CharField(verbose_name='rtype', max_length=20)
|
||||||
deviceInfo = models.TextField(verbose_name='登录信息:', blank=True)
|
deviceInfo = models.TextField(verbose_name=_('登录信息:'), blank=True)
|
||||||
|
|
||||||
is_active = models.BooleanField(verbose_name='是否激活', default=True)
|
is_active = models.BooleanField(verbose_name=_('是否激活'), default=True)
|
||||||
is_admin = models.BooleanField(verbose_name='是否管理员', default=False)
|
is_admin = models.BooleanField(verbose_name=_('是否管理员'), default=False)
|
||||||
|
|
||||||
objects = MyUserManager()
|
objects = MyUserManager()
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
verbose_name = "用户"
|
verbose_name = _("用户")
|
||||||
verbose_name_plural = "用户列表"
|
verbose_name_plural = _("用户列表")
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_task", "Can see available tasks"),
|
("view_task", "Can see available tasks"),
|
||||||
("change_task_status", "Can change the status of tasks"),
|
("change_task_status", "Can change the status of tasks"),
|
||||||
|
|||||||
@ -1,114 +1,153 @@
|
|||||||
# cython:language_level=3
|
# cython:language_level=3
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
||||||
class RustDeskToken(models.Model):
|
class RustDeskToken(models.Model):
|
||||||
''' Token
|
''' Token
|
||||||
'''
|
'''
|
||||||
username = models.CharField(verbose_name='用户名', max_length=20)
|
username = models.CharField(verbose_name=_('用户名'), max_length=20)
|
||||||
rid = models.CharField(verbose_name='RustDesk ID', max_length=16)
|
rid = models.CharField(verbose_name=_('RustDesk ID'), max_length=16)
|
||||||
uid = models.CharField(verbose_name='用户ID', max_length=16)
|
uid = models.CharField(verbose_name=_('用户ID'), max_length=16)
|
||||||
uuid = models.CharField(verbose_name='uuid', max_length=60)
|
uuid = models.CharField(verbose_name=_('uuid'), max_length=60)
|
||||||
access_token = models.CharField(verbose_name='access_token', max_length=60, blank=True)
|
access_token = models.CharField(verbose_name=_('access_token'), max_length=60, blank=True)
|
||||||
create_time = models.DateTimeField(verbose_name='登录时间', auto_now_add=True)
|
create_time = models.DateTimeField(verbose_name=_('登录时间'), auto_now_add=True)
|
||||||
#expire_time = models.DateTimeField(verbose_name='过期时间')
|
# expire_time = models.DateTimeField(verbose_name='过期时间')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('-username',)
|
ordering = ('-username',)
|
||||||
verbose_name = "Token"
|
verbose_name = "Token"
|
||||||
verbose_name_plural = "Token列表"
|
verbose_name_plural = _("Token列表")
|
||||||
|
|
||||||
|
|
||||||
class RustDeskTokenAdmin(admin.ModelAdmin):
|
class RustDeskTokenAdmin(admin.ModelAdmin):
|
||||||
list_display = ('username', 'uid')
|
list_display = ('username', 'uid')
|
||||||
search_fields = ('username', 'uid')
|
search_fields = ('username', 'uid')
|
||||||
list_filter = ('create_time', ) #过滤器
|
list_filter = ('create_time', ) # 过滤器
|
||||||
|
|
||||||
|
|
||||||
class RustDeskTag(models.Model):
|
class RustDeskTag(models.Model):
|
||||||
''' Tags
|
''' Tags
|
||||||
'''
|
'''
|
||||||
uid = models.CharField(verbose_name='所属用户ID', max_length=16)
|
uid = models.CharField(verbose_name=_('所属用户ID'), max_length=16)
|
||||||
tag_name = models.CharField(verbose_name='标签名称', max_length=60)
|
tag_name = models.CharField(verbose_name=_('标签名称'), max_length=60)
|
||||||
tag_color = models.CharField(verbose_name='标签颜色', max_length=60, blank=True)
|
tag_color = models.CharField(verbose_name=_('标签颜色'), max_length=60, blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('-uid',)
|
ordering = ('-uid',)
|
||||||
verbose_name = "Tags"
|
verbose_name = "Tags"
|
||||||
verbose_name_plural = "Tags列表"
|
verbose_name_plural = _("Tags列表")
|
||||||
|
|
||||||
|
|
||||||
class RustDeskTagAdmin(admin.ModelAdmin):
|
class RustDeskTagAdmin(admin.ModelAdmin):
|
||||||
list_display = ('tag_name', 'uid', 'tag_color')
|
list_display = ('tag_name', 'uid', 'tag_color')
|
||||||
search_fields = ('tag_name', 'uid')
|
search_fields = ('tag_name', 'uid')
|
||||||
list_filter = ('uid', )
|
list_filter = ('uid', )
|
||||||
|
|
||||||
|
|
||||||
class RustDeskPeer(models.Model):
|
class RustDeskPeer(models.Model):
|
||||||
''' Pees
|
''' Pees
|
||||||
'''
|
'''
|
||||||
uid = models.CharField(verbose_name='用户ID', max_length=16)
|
uid = models.CharField(verbose_name=_('用户ID'), max_length=16)
|
||||||
rid = models.CharField(verbose_name='客户端ID', max_length=60)
|
rid = models.CharField(verbose_name=_('客户端ID'), max_length=60)
|
||||||
username = models.CharField(verbose_name='系统用户名', max_length=20)
|
username = models.CharField(verbose_name=_('系统用户名'), max_length=20)
|
||||||
hostname = models.CharField(verbose_name='操作系统名', max_length=30)
|
hostname = models.CharField(verbose_name=_('操作系统名'), max_length=30)
|
||||||
alias = models.CharField(verbose_name='别名', max_length=30)
|
alias = models.CharField(verbose_name=_('别名'), max_length=30)
|
||||||
platform = models.CharField(verbose_name='平台', max_length=30)
|
platform = models.CharField(verbose_name=_('平台'), max_length=30)
|
||||||
tags = models.CharField(verbose_name='标签', max_length=30)
|
tags = models.CharField(verbose_name=_('标签'), max_length=30)
|
||||||
rhash = models.CharField(verbose_name='设备链接密码', max_length=60)
|
rhash = models.CharField(verbose_name=_('设备链接密码'), max_length=60)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('-username',)
|
ordering = ('-username',)
|
||||||
verbose_name = "Peers"
|
verbose_name = "Peers"
|
||||||
verbose_name_plural = "Peers列表"
|
verbose_name_plural = _("Peers列表")
|
||||||
|
|
||||||
|
|
||||||
class RustDeskPeerAdmin(admin.ModelAdmin):
|
class RustDeskPeerAdmin(admin.ModelAdmin):
|
||||||
list_display = ('rid', 'uid', 'username', 'hostname', 'platform', 'alias', 'tags')
|
list_display = ('rid', 'uid', 'username', 'hostname', 'platform', 'alias', 'tags')
|
||||||
search_fields = ('deviceid', 'alias')
|
search_fields = ('deviceid', 'alias')
|
||||||
list_filter = ('rid', 'uid', )
|
list_filter = ('rid', 'uid', )
|
||||||
|
|
||||||
|
|
||||||
class RustDesDevice(models.Model):
|
class RustDesDevice(models.Model):
|
||||||
rid = models.CharField(verbose_name='客户端ID', max_length=60, blank=True)
|
rid = models.CharField(verbose_name=_('客户端ID'), max_length=60, blank=True)
|
||||||
cpu = models.CharField(verbose_name='CPU', max_length=100)
|
cpu = models.CharField(verbose_name='CPU', max_length=100)
|
||||||
hostname = models.CharField(verbose_name='主机名', max_length=100)
|
hostname = models.CharField(verbose_name=_('主机名'), max_length=100)
|
||||||
memory = models.CharField(verbose_name='内存', max_length=100)
|
memory = models.CharField(verbose_name=_('内存'), max_length=100)
|
||||||
os = models.CharField(verbose_name='操作系统', max_length=100)
|
os = models.CharField(verbose_name=_('操作系统'), max_length=100)
|
||||||
uuid = models.CharField(verbose_name='uuid', max_length=100)
|
uuid = models.CharField(verbose_name='uuid', max_length=100)
|
||||||
username = models.CharField(verbose_name='系统用户名', max_length=100, blank=True)
|
username = models.CharField(verbose_name=_('系统用户名'), max_length=100, blank=True)
|
||||||
version = models.CharField(verbose_name='客户端版本', max_length=100)
|
version = models.CharField(verbose_name=_('客户端版本'), max_length=100)
|
||||||
create_time = models.DateTimeField(verbose_name='设备注册时间', auto_now_add=True)
|
ip_address = models.CharField(verbose_name=_('IP'), max_length=60, blank=True)
|
||||||
update_time = models.DateTimeField(verbose_name='设备更新时间', auto_now=True, blank=True)
|
create_time = models.DateTimeField(verbose_name=_('设备注册时间'), auto_now_add=True)
|
||||||
|
update_time = models.DateTimeField(verbose_name=('设备更新时间'), auto_now=True, blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('-rid',)
|
ordering = ('-rid',)
|
||||||
verbose_name = "设备"
|
verbose_name = _("设备")
|
||||||
verbose_name_plural = "设备列表"
|
verbose_name_plural = _("设备列表")
|
||||||
|
|
||||||
|
|
||||||
class RustDesDeviceAdmin(admin.ModelAdmin):
|
class RustDesDeviceAdmin(admin.ModelAdmin):
|
||||||
list_display = ('rid', 'hostname', 'memory', 'uuid', 'version', 'create_time', 'update_time')
|
list_display = ('rid', 'hostname', 'memory', 'uuid', 'version', 'create_time', 'update_time')
|
||||||
search_fields = ('hostname', 'memory')
|
search_fields = ('hostname', 'memory')
|
||||||
list_filter = ('rid', )
|
list_filter = ('rid', )
|
||||||
|
|
||||||
|
|
||||||
|
class ConnLog(models.Model):
|
||||||
|
id = models.IntegerField(verbose_name='ID', primary_key=True)
|
||||||
|
action = models.CharField(verbose_name='Action', max_length=20, null=True)
|
||||||
|
conn_id = models.CharField(verbose_name='Connection ID', max_length=10, null=True)
|
||||||
|
from_ip = models.CharField(verbose_name='From IP', max_length=30, null=True)
|
||||||
|
from_id = models.CharField(verbose_name='From ID', max_length=20, null=True)
|
||||||
|
rid = models.CharField(verbose_name='To ID', max_length=20, null=True)
|
||||||
|
conn_start = models.DateTimeField(verbose_name='Connected', null=True)
|
||||||
|
conn_end = models.DateTimeField(verbose_name='Disconnected', null=True)
|
||||||
|
session_id = models.CharField(verbose_name='Session ID', max_length=60, null=True)
|
||||||
|
uuid = models.CharField(verbose_name='uuid', max_length=60, null=True)
|
||||||
|
|
||||||
|
|
||||||
|
class ConnLogAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('id', 'action', 'conn_id', 'from_ip', 'from_id', 'rid', 'conn_start', 'conn_end', 'session_id', 'uuid')
|
||||||
|
search_fields = ('from_ip', 'rid')
|
||||||
|
list_filter = ('id', 'from_ip', 'from_id', 'rid', 'conn_start', 'conn_end')
|
||||||
|
|
||||||
|
|
||||||
|
class FileLog(models.Model):
|
||||||
|
id = models.IntegerField(verbose_name='ID', primary_key=True)
|
||||||
|
file = models.CharField(verbose_name='Path', max_length=500)
|
||||||
|
remote_id = models.CharField(verbose_name='Remote ID', max_length=20, default='0')
|
||||||
|
user_id = models.CharField(verbose_name='User ID', max_length=20, default='0')
|
||||||
|
user_ip = models.CharField(verbose_name='User IP', max_length=20, default='0')
|
||||||
|
filesize = models.CharField(verbose_name='Filesize', max_length=500, default='')
|
||||||
|
direction = models.IntegerField(verbose_name='Direction', default=0)
|
||||||
|
logged_at = models.DateTimeField(verbose_name='Logged At', null=True)
|
||||||
|
|
||||||
|
|
||||||
|
class FileLogAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('id', 'file', 'remote_id', 'user_id', 'user_ip', 'filesize', 'direction', 'logged_at')
|
||||||
|
search_fields = ('file', 'remote_id', 'user_id', 'user_ip')
|
||||||
|
list_filter = ('id', 'file', 'remote_id', 'user_id', 'user_ip', 'filesize', 'direction', 'logged_at')
|
||||||
|
|
||||||
|
|
||||||
class ShareLink(models.Model):
|
class ShareLink(models.Model):
|
||||||
''' 分享链接
|
''' 分享链接
|
||||||
'''
|
'''
|
||||||
uid = models.CharField(verbose_name='用户ID', max_length=16)
|
uid = models.CharField(verbose_name=_('用户ID'), max_length=16)
|
||||||
shash = models.CharField(verbose_name='链接Key', max_length=60)
|
shash = models.CharField(verbose_name=_('链接Key'), max_length=60)
|
||||||
peers = models.CharField(verbose_name='机器ID列表', max_length=20)
|
peers = models.CharField(verbose_name=_('机器ID列表'), max_length=20)
|
||||||
is_used = models.BooleanField(verbose_name='是否使用', default=False)
|
is_used = models.BooleanField(verbose_name=_('是否使用'), default=False)
|
||||||
is_expired = models.BooleanField(verbose_name='是否过期', default=False)
|
is_expired = models.BooleanField(verbose_name=_('是否过期'), default=False)
|
||||||
create_time = models.DateTimeField(verbose_name='生成时间', auto_now_add=True)
|
create_time = models.DateTimeField(verbose_name=_('生成时间'), auto_now_add=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('-create_time',)
|
ordering = ('-create_time',)
|
||||||
verbose_name = "分享链接"
|
verbose_name = _("分享链接")
|
||||||
verbose_name_plural = "链接列表"
|
verbose_name_plural = _("链接列表")
|
||||||
|
|
||||||
|
|
||||||
class ShareLinkAdmin(admin.ModelAdmin):
|
class ShareLinkAdmin(admin.ModelAdmin):
|
||||||
list_display = ('shash', 'uid', 'peers', 'is_used', 'is_expired', 'create_time')
|
list_display = ('shash', 'uid', 'peers', 'is_used', 'is_expired', 'create_time')
|
||||||
search_fields = ('peers', )
|
search_fields = ('peers', )
|
||||||
list_filter = ('is_used', 'uid', 'is_expired' )
|
list_filter = ('is_used', 'uid', 'is_expired')
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load i18n %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
@ -27,15 +28,25 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul class="layui-nav">
|
<ul class="layui-nav">
|
||||||
<li class="layui-nav-item"><a href="/">首页</a></li>
|
<li class="layui-nav-item"><a href="/">{% trans "首页" %}</a></li>
|
||||||
<li class="layui-nav-item"><a href="/api/share">分享</a></li>
|
|
||||||
<li class="layui-nav-item"><a href="/webui" target="_blank">网页控制</a></li>
|
|
||||||
|
|
||||||
{% if u.is_admin %}
|
{% if u.is_admin %}
|
||||||
<li class="layui-nav-item"><a href="/admin" target="_blank">管理后台</a>
|
<li class="layui-nav-item"><a href="/api/work?show_type=admin">{% trans "所有设备" %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="layui-nav-item"><a href="/api/user_action?action=logout" target="_blank">退出</a></li>
|
<li class="layui-nav-item"><a href="/api/share">{% trans "分享" %}</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/webui" target="_blank">{% trans "网页控制" %}</a></li>
|
||||||
|
|
||||||
|
{% if u.is_admin %}
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="">{% trans "日志" %}</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a href="/api/conn_log">{% trans "连接日志" %}</a></dd>
|
||||||
|
<dd><a href="/api/file_log">{% trans "文件传输日志" %}</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item"><a href="/admin" target="_blank">{% trans "管理后台" %}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
<li class="layui-nav-item"><a href="/api/user_action?action=logout" target="_blank">{% trans "退出" %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load my_filters %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
<title>登录_【RustDeskWeb】</title>
|
<title>{{ "登录" | translate }}_【RustDeskWeb】</title>
|
||||||
<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
|
<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
|
||||||
<link rel="stylesheet" href="{% static 'layui/css/style.css' %}">
|
<link rel="stylesheet" href="{% static 'layui/css/style.css' %}">
|
||||||
|
|
||||||
@ -13,21 +14,21 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="login-main">
|
<div class="login-main">
|
||||||
<header class="layui-elip">登录</header>
|
<header class="layui-elip">{{ "登录" | translate }}</header>
|
||||||
<form class="layui-form">
|
<form class="layui-form">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" name="account" required lay-verify="required" placeholder="用户名" autocomplete="off"
|
<input type="text" name="account" required lay-verify="required" placeholder="{{ "用户名" | translate }}" autocomplete="off"
|
||||||
class="layui-input">
|
class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="password" name="password" required lay-verify="required" placeholder="密码" autocomplete="off"
|
<input type="password" name="password" required lay-verify="required" placeholder="{{ "密码" | translate }}" autocomplete="off"
|
||||||
class="layui-input">
|
class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-input-inline login-btn">
|
<div class="layui-input-inline login-btn">
|
||||||
<button lay-submit lay-filter="login" class="layui-btn">登录</button>
|
<button lay-submit lay-filter="login" class="layui-btn">{{ "登录" | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<p><a href="/api/user_action?action=register" class="fl">立即注册</a><a href="javascript:;" class="fr">忘记密码?</a></p>
|
<p><a href="/api/user_action?action=register" class="fl">{{ "立即注册" | translate }}</a><a href="javascript:;" class="fr">{{ "忘记密码?" | translate }}</a></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -59,7 +60,7 @@
|
|||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
$('.fr').on('click', function(){
|
$('.fr').on('click', function(){
|
||||||
layer.alert("这么简易的东西,忘记密码这功能就没必要了吧。",{icon:5});
|
layer.alert("{{ "这么简易的东西,忘记密码这功能就没必要了吧。" | translate }}",{icon:5});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load my_filters %}
|
||||||
{% block title %}{{title}}{% endblock %}
|
{% block title %}{{title}}{% endblock %}
|
||||||
{% block legend_name %}信息{% endblock %}
|
{% block legend_name %}{{ "信息" | translate }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div style="padding: 20px; background-color: #F2F2F2;">
|
<div style="padding: 20px; background-color: #F2F2F2;">
|
||||||
<div class="layui-row layui-col-space15">
|
<div class="layui-row layui-col-space15">
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load my_filters %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -6,7 +7,7 @@
|
|||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<title>注册_【RustDeskWeb】</title>
|
<title>{{ "注册" | translate }}_【RustDeskWeb】</title>
|
||||||
<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
|
<link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
|
||||||
<link rel="stylesheet" href="{% static 'layui/css/style.css' %}">
|
<link rel="stylesheet" href="{% static 'layui/css/style.css' %}">
|
||||||
<link rel="icon" href="../frame/static/image/code.png">
|
<link rel="icon" href="../frame/static/image/code.png">
|
||||||
@ -14,14 +15,14 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="login-main">
|
<div class="login-main">
|
||||||
<header class="layui-elip" style="width: 82%">注册页</header>
|
<header class="layui-elip" style="width: 82%">{{ "注册页" | translate }}</header>
|
||||||
|
|
||||||
<!-- 表单选项 -->
|
<!-- 表单选项 -->
|
||||||
<form class="layui-form">
|
<form class="layui-form">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<!-- 用户名 -->
|
<!-- 用户名 -->
|
||||||
<div class="layui-inline" style="width: 85%">
|
<div class="layui-inline" style="width: 85%">
|
||||||
<input type="text" id="user" name="account" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
<input type="text" id="user" name="account" required lay-verify="required" placeholder="{{ "请输入用户名" | translate }}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<!-- 对号 -->
|
<!-- 对号 -->
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
@ -35,7 +36,7 @@
|
|||||||
<!-- 密码 -->
|
<!-- 密码 -->
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<div class="layui-inline" style="width: 85%">
|
<div class="layui-inline" style="width: 85%">
|
||||||
<input type="password" id="pwd" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
|
<input type="password" id="pwd" name="password" required lay-verify="required" placeholder="{{ "请输入密码" | translate }}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<!-- 对号 -->
|
<!-- 对号 -->
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
@ -49,7 +50,7 @@
|
|||||||
<!-- 确认密码 -->
|
<!-- 确认密码 -->
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<div class="layui-inline" style="width: 85%">
|
<div class="layui-inline" style="width: 85%">
|
||||||
<input type="password" id="rpwd" name="repassword" required lay-verify="required" placeholder="请确认密码" autocomplete="off" class="layui-input">
|
<input type="password" id="rpwd" name="repassword" required lay-verify="required" placeholder="{{ "请确认密码" | translate }}" autocomplete="off" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
<!-- 对号 -->
|
<!-- 对号 -->
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
@ -63,10 +64,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="layui-input-inline login-btn" style="width: 85%">
|
<div class="layui-input-inline login-btn" style="width: 85%">
|
||||||
<button type="submit" lay-submit lay-filter="sub" class="layui-btn">注册</button>
|
<button type="submit" lay-submit lay-filter="sub" class="layui-btn">{{ "注册" | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
<hr style="width: 85%" />
|
<hr style="width: 85%" />
|
||||||
<p style="width: 85%"><a href="/api/user_action?action=login" class="fl">已有账号?立即登录</a></p>
|
<p style="width: 85%"><a href="/api/user_action?action=login" class="fl">{{ "已有账号?立即登录" | translate }}</a></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -94,7 +95,7 @@
|
|||||||
//layer.msg('请输入合法密码');
|
//layer.msg('请输入合法密码');
|
||||||
$('#pwr').removeAttr('hidden');
|
$('#pwr').removeAttr('hidden');
|
||||||
$('#pri').attr('hidden','hidden');
|
$('#pri').attr('hidden','hidden');
|
||||||
layer.msg('请输入8~20位密码。可以包含字母、数字和特殊字符。');
|
layer.msg('{{ "请输入8~20位密码。可以包含字母、数字和特殊字符。" | translate }}');
|
||||||
}else {
|
}else {
|
||||||
$('#pri').removeAttr('hidden');
|
$('#pri').removeAttr('hidden');
|
||||||
$('#pwr').attr('hidden','hidden');
|
$('#pwr').attr('hidden','hidden');
|
||||||
@ -106,7 +107,7 @@
|
|||||||
if($('#pwd').val() != $('#rpwd').val()){
|
if($('#pwd').val() != $('#rpwd').val()){
|
||||||
$('#rpwr').removeAttr('hidden');
|
$('#rpwr').removeAttr('hidden');
|
||||||
$('#rpri').attr('hidden','hidden');
|
$('#rpri').attr('hidden','hidden');
|
||||||
layer.msg('两次输入密码不一致!');
|
layer.msg('{{ "两次输入密码不一致!" | translate }}');
|
||||||
}else {
|
}else {
|
||||||
$('#rpri').removeAttr('hidden');
|
$('#rpri').removeAttr('hidden');
|
||||||
$('#rpwr').attr('hidden','hidden');
|
$('#rpwr').attr('hidden','hidden');
|
||||||
@ -126,7 +127,7 @@
|
|||||||
},
|
},
|
||||||
success:function(data){
|
success:function(data){
|
||||||
if (data.code == 1) {
|
if (data.code == 1) {
|
||||||
layer.msg('注册成功,请前往登录页登录。');
|
layer.msg('{{ "注册成功,请前往登录页登录。" | translate }}');
|
||||||
///location.href = "login.html";
|
///location.href = "login.html";
|
||||||
}else {
|
}else {
|
||||||
layer.msg(data.msg);
|
layer.msg(data.msg);
|
||||||
|
|||||||
@ -1,20 +1,21 @@
|
|||||||
|
|
||||||
{% extends "base.html" %}{% load static %}
|
{% extends "base.html" %}{% load static %}
|
||||||
{% block title %}分享机器{% endblock %}
|
{% load my_filters %}
|
||||||
|
{% block title %}{{ "分享机器" | translate }}{% endblock %}
|
||||||
{% block link %}<link rel="stylesheet" href="{% static 'layui/css/style.css' %}">{% endblock %}
|
{% block link %}<link rel="stylesheet" href="{% static 'layui/css/style.css' %}">{% endblock %}
|
||||||
{% block legend_name %}分享机器给其他用户{% endblock %}
|
{% block legend_name %}{{ "分享机器给其他用户" | translate }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
<div class="layui-container">
|
<div class="layui-container">
|
||||||
<div class="layui-card layui-col-md3-offset2">
|
<div class="layui-card layui-col-md3-offset2">
|
||||||
<div class="layui-card-header">请将要分享的机器调整到右侧</div>
|
<div class="layui-card-header">{{ "请将要分享的机器调整到右侧" | translate }}</div>
|
||||||
<div id="showdevice"></div>
|
<div id="showdevice"></div>
|
||||||
<button id="create" type="button" class="layui-btn padding-5" lay-on="getData">生成分享链接</button>
|
<button id="create" type="button" class="layui-btn padding-5" lay-on="getData">{{ "生成分享链接" | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-card">1、链接有效期为15分钟,切勿随意分享给他人。</div>
|
<div class="layui-card">{{ "1、链接有效期为15分钟,切勿随意分享给他人。" | translate }}</div>
|
||||||
<div class="layui-card">2、所分享的机器,被分享人享有相同的权限,如果机器设置了保存密码,被分享人也可以直接连接。</div>
|
<div class="layui-card">{{ "2、所分享的机器,被分享人享有相同的权限,如果机器设置了保存密码,被分享人也可以直接连接。" | translate }}</div>
|
||||||
<div class="layui-card">3、为保障安全,链接有效期为15分钟、链接仅有效1次。链接一旦被(非分享人的登录用户)访问,分享生效,后续访问链接失效。</div>
|
<div class="layui-card">{{ "3、为保障安全,链接有效期为15分钟、链接仅有效1次。链接一旦被(非分享人的登录用户)访问,分享生效,后续访问链接失效。" | translate }}</div>
|
||||||
|
|
||||||
<div class="layui-card layui-col-md6-offset1">
|
<div class="layui-card layui-col-md6-offset1">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
@ -26,9 +27,9 @@
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>链接地址</th>
|
<th>{{ "链接地址" | translate }}</th>
|
||||||
<th>创建时间</th>
|
<th>{{ "创建时间" | translate }}</th>
|
||||||
<th>ID列表</th>
|
<th>{{ "ID列表" | translate }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -57,7 +58,7 @@
|
|||||||
//渲染
|
//渲染
|
||||||
transfer.render({
|
transfer.render({
|
||||||
elem: '#showdevice' //绑定元素
|
elem: '#showdevice' //绑定元素
|
||||||
,title: ['我的机器', '分享机器'] //自定义标题
|
,title: ['{{ "我的机器" | translate }}', '{{ "分享机器" | translate }}'] //自定义标题
|
||||||
//,width: 500 //定义宽度
|
//,width: 500 //定义宽度
|
||||||
//,height: 300 //定义高度
|
//,height: 300 //定义高度
|
||||||
,data: [//定义数据源
|
,data: [//定义数据源
|
||||||
@ -90,7 +91,7 @@
|
|||||||
// time:false //取消自动关闭
|
// time:false //取消自动关闭
|
||||||
// });
|
// });
|
||||||
//layer.msg('注册成功,请前往登录页登录。');
|
//layer.msg('注册成功,请前往登录页登录。');
|
||||||
layer.alert('成功!如需分享,请复制以下链接给其他人:<br>'+ window.location + '/' +data.shash, function (index) {
|
layer.alert('{{ "成功!如需分享,请复制以下链接给其他人:<br>" | translate }}'+ window.location + '/' +data.shash, function (index) {
|
||||||
location.reload();});
|
location.reload();});
|
||||||
}else {
|
}else {
|
||||||
layer.msg(data.msg);
|
layer.msg(data.msg);
|
||||||
|
|||||||
62
api/templates/show_conn_log.html
Normal file
62
api/templates/show_conn_log.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load my_filters %}
|
||||||
|
{% block title %}RustDesk WebUI{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div style="padding: 20px; background-color: #F2F2F2;">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md15">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">{{ "连接日志" | translate }}:【{{u.username}}】</div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<table class="layui-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ "用户IP" | translate }}</th>
|
||||||
|
<th>{{ "用户ID" | translate }}</th>
|
||||||
|
<th>{{ "用户别名" | translate }}</th>
|
||||||
|
<th>{{ "远程ID" | translate }}</th>
|
||||||
|
<th>{{ "远程别名" | translate }}</th>
|
||||||
|
<th>{{ "连接开始时间" | translate }}</th>
|
||||||
|
<th>{{ "连接结束时间" | translate }}</th>
|
||||||
|
<th>{{ "时长" | translate }}(HH:MM:SS)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for one in page_obj %}
|
||||||
|
<tr>
|
||||||
|
<td>{{one.from_ip}} </td>
|
||||||
|
<td>{{one.from_id}}</td>
|
||||||
|
<td>{{one.from_alias}}</td>
|
||||||
|
<td>{{one.rid}}</td>
|
||||||
|
<td>{{one.alias}}</td>
|
||||||
|
<td>{{one.conn_start}}</td>
|
||||||
|
<td>{{one.conn_end}}</td>
|
||||||
|
<td>{{one.duration}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-md4 layui-col-md-offset4">
|
||||||
|
<span class="step-links">
|
||||||
|
{% if page_obj.has_previous %}
|
||||||
|
<button class="layui-btn" ><a href="?page=1">« {{ "First" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?page={{ page_obj.previous_page_number }}">{{ "Previous" | translate }}</a></button>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.paginator.num_pages > 1 %}
|
||||||
|
<span class="current">
|
||||||
|
{{ "页码 #" | translate }} {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.has_next %}
|
||||||
|
<button class="layui-btn" > <a href="?page={{ page_obj.next_page_number }}">{{ "Next" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?page={{ page_obj.paginator.num_pages }}">{{ "Last" | translate }} »</a></button>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
68
api/templates/show_file_log.html
Normal file
68
api/templates/show_file_log.html
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load my_filters %}
|
||||||
|
{% block title %}RustDesk WebUI{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div style="padding: 20px; background-color: #F2F2F2;">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md15">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">{{ "文件传输日志" | translate }}:【{{u.username}}】</div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<table class="layui-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ "文件" | translate }}</th>
|
||||||
|
<th>{{ "远程ID" | translate }}</th>
|
||||||
|
<th>{{ "远程别名" | translate }}</th>
|
||||||
|
<th>{{ "用户ID" | translate }}</th>
|
||||||
|
<th>{{ "用户别名" | translate }}</th>
|
||||||
|
<th>{{ "用户IP" | translate }}</th>
|
||||||
|
<th>{{ "文件大小" | translate }}</th>
|
||||||
|
<th>{{ "发送/接受" | translate }}</th>
|
||||||
|
<th>{{ "记录于" | translate }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for one in page_obj %}
|
||||||
|
<tr>
|
||||||
|
<td>{{one.file}}</td>
|
||||||
|
<td>{{one.remote_id}} </td>
|
||||||
|
<td>{{one.remote_alias}}</td>
|
||||||
|
<td>{{one.user_id}}</td>
|
||||||
|
<td>{{one.user_alias}}</td>
|
||||||
|
<td>{{one.user_ip}}</td>
|
||||||
|
<td>{{one.filesize}}</td>
|
||||||
|
{% if one.direction == 0 %}
|
||||||
|
<td>User Received File</td>
|
||||||
|
{% else %}
|
||||||
|
<td>User Sent File</td>
|
||||||
|
{% endif %}
|
||||||
|
<td>{{one.logged_at}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-md4 layui-col-md-offset4">
|
||||||
|
<span class="step-links">
|
||||||
|
{% if page_obj.has_previous %}
|
||||||
|
<button class="layui-btn" ><a href="?page=1">« {{ "首页" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?page={{ page_obj.previous_page_number }}">{{ "Previous" | translate }}</a></button>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.paginator.num_pages > 1 %}
|
||||||
|
<span class="current">
|
||||||
|
{{ "页码 #" | translate }} {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.has_next %}
|
||||||
|
<button class="layui-btn" > <a href="?page={{ page_obj.next_page_number }}">{{ "Next" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?page={{ page_obj.paginator.num_pages }}">{{ "Last" | translate }} »</a></button>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@ -1,32 +1,36 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load my_filters %}
|
||||||
{% block title %}RustDesk WebUI{% endblock %}
|
{% block title %}RustDesk WebUI{% endblock %}
|
||||||
{% block legend_name %}综合屏{% endblock %}
|
{% block legend_name %}{{ "综合屏" | translate }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div style="padding: 20px; background-color: #F2F2F2;">
|
<div style="padding: 20px; background-color: #F2F2F2;">
|
||||||
<div class="layui-row layui-col-space15">
|
<div class="layui-row layui-col-space15">
|
||||||
|
{% if not show_all %}
|
||||||
<div class="layui-col-md15">
|
<div class="layui-col-md15">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-header">设备统计 - 【用户名:{{u.username}}】</div>
|
<div class="layui-card-header">{{ "设备统计" | translate }} - 【{{ "用户名" | translate }}:{{u.username}}】</div>
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>客户端ID</th>
|
<th>{{ "客户端ID" | translate }}</th>
|
||||||
<th>版本</th>
|
<th>{{ "版本" | translate }}</th>
|
||||||
<th>连接密码</th>
|
<th>{{ "连接密码" | translate }}</th>
|
||||||
<th>系统用户名</th>
|
<th>{{ "系统用户名" | translate }}</th>
|
||||||
<th>计算机名</th>
|
<th>{{ "计算机名" | translate }}</th>
|
||||||
<th>别名</th>
|
<th>{{ "别名" | translate }}</th>
|
||||||
<th>平台</th>
|
<th>{{ "平台" | translate }}</th>
|
||||||
<th>系统</th>
|
<th>{{ "系统" | translate }}</th>
|
||||||
<th>CPU</th>
|
<th>{{ "CPU" | translate }}</th>
|
||||||
<th>内存</th>
|
<th>{{ "内存" | translate }}</th>
|
||||||
<th>注册时间</th>
|
<th>{{ "IP" | translate }}</th>
|
||||||
<th>更新时间</th>
|
<th>{{ "注册时间" | translate }}</th>
|
||||||
|
<th>{{ "更新时间" | translate }}</th>
|
||||||
|
<th>{{ "状态" | translate }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for one in single_info %}
|
{% for one in page_obj %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{one.rid}} </td>
|
<td>{{one.rid}} </td>
|
||||||
<td>{{one.version}}</td>
|
<td>{{one.version}}</td>
|
||||||
@ -38,8 +42,10 @@
|
|||||||
<td>{{one.os}}</td>
|
<td>{{one.os}}</td>
|
||||||
<td>{{one.cpu}}</td>
|
<td>{{one.cpu}}</td>
|
||||||
<td>{{one.memory}}</td>
|
<td>{{one.memory}}</td>
|
||||||
|
<td>{{one.ip_address}}</td>
|
||||||
<td>{{one.create_time}}</td>
|
<td>{{one.create_time}}</td>
|
||||||
<td>{{one.update_time}}</td>
|
<td>{{one.update_time}}</td>
|
||||||
|
<td>{{one.status}} </td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -47,30 +53,53 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-col-md4 layui-col-md-offset4">
|
||||||
|
<span class="step-links">
|
||||||
|
{% if page_obj.has_previous %}
|
||||||
|
<button class="layui-btn" ><a href="?page=1">« {{ "首页" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?page={{ page_obj.previous_page_number }}">{{ "上一页" | translate }}</a></button>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.paginator.num_pages > 1 %}
|
||||||
|
<span class="current">
|
||||||
|
{{ "页码" | translate }} {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.has_next %}
|
||||||
|
<button class="layui-btn" > <a href="?page={{ page_obj.next_page_number }}">{{ "下一页" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?page={{ page_obj.paginator.num_pages }}">{{ "尾页" | translate }} »</a></button>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if u.is_admin %}
|
|
||||||
|
{% if u.is_admin and show_all %}
|
||||||
<div class="layui-col-md15">
|
<div class="layui-col-md15">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-header">全部用户</div>
|
<div class="layui-card-header">{{ "全部用户" | translate }} »
|
||||||
|
<div class="layui-btn" ><a href="/api/down_peers">{{ "导出xlsx" | translate }}</a></div>
|
||||||
|
</div>
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>客户端ID</th>
|
<th>{{ "客户端ID" | translate }}</th>
|
||||||
<th>所属用户</th>
|
<th>{{ "所属用户" | translate }}</th>
|
||||||
<th>版本</th>
|
<th>{{ "版本" | translate }}</th>
|
||||||
<th>系统用户名</th>
|
<th>{{ "系统用户名" | translate }}</th>
|
||||||
<th>计算机名</th>
|
<th>{{ "计算机名" | translate }}</th>
|
||||||
<th>系统</th>
|
<th>{{ "系统" | translate }}</th>
|
||||||
<th>CPU</th>
|
<th>{{ "CPU" | translate }}</th>
|
||||||
<th>内存</th>
|
<th>{{ "内存" | translate }}</th>
|
||||||
<th>注册时间</th>
|
<th>{{ "IP" | translate }}</th>
|
||||||
<th>更新时间</th>
|
<th>{{ "注册日期" | translate }}</th>
|
||||||
|
<th>{{ "更新时间" | translate }}</th>
|
||||||
|
<th>{{ "状态" | translate }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{% for one in all_info %}
|
{% for one in page_obj %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{one.rid}} </td>
|
<td>{{one.rid}} </td>
|
||||||
<td>{{one.rust_user}} </td>
|
<td>{{one.rust_user}} </td>
|
||||||
@ -80,8 +109,10 @@
|
|||||||
<td>{{one.os}} </td>
|
<td>{{one.os}} </td>
|
||||||
<td>{{one.cpu}} </td>
|
<td>{{one.cpu}} </td>
|
||||||
<td>{{one.memory}} </td>
|
<td>{{one.memory}} </td>
|
||||||
|
<td>{{one.ip_address}}</td>
|
||||||
<td>{{one.create_time}} </td>
|
<td>{{one.create_time}} </td>
|
||||||
<td>{{one.update_time}} </td>
|
<td>{{one.update_time}} </td>
|
||||||
|
<td>{{one.status}} </td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -89,8 +120,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-col-md4 layui-col-md-offset4">
|
||||||
|
<span class="step-links">
|
||||||
|
{% if page_obj.has_previous %}
|
||||||
|
<button class="layui-btn" ><a href="?show_type=admin&page=1">« {{ "首页" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?show_type=admin&page={{ page_obj.previous_page_number }}">{{ "上一页" | translate }}</a></button>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.paginator.num_pages > 1 %}
|
||||||
|
<span class="current">
|
||||||
|
{{ "页码" | translate }} {{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if page_obj.has_next %}
|
||||||
|
<button class="layui-btn" > <a href="?show_type=admin&page={{ page_obj.next_page_number }}">{{ "下一页" | translate }}</a></button>
|
||||||
|
<button class="layui-btn" ><a href="?show_type=admin&page={{ page_obj.paginator.num_pages }}">{{ "尾页" | translate }} »</a></button>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
0
api/templatetags/__init__.py
Normal file
0
api/templatetags/__init__.py
Normal file
8
api/templatetags/my_filters.py
Normal file
8
api/templatetags/my_filters.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from django import template
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def translate(text):
|
||||||
|
return _(text)
|
||||||
11
api/urls.py
11
api/urls.py
@ -9,7 +9,8 @@ from api import views
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^login',views.login),
|
url(r'^login',views.login),
|
||||||
url(r'^logout',views.logout),
|
url(r'^logout',views.logout),
|
||||||
url(r'^ab',views.ab),
|
url(r'^ab$',views.ab),
|
||||||
|
url(r'^ab\/get',views.ab_get), # 兼容 x86-sciter 版客户端
|
||||||
url(r'^users',views.users),
|
url(r'^users',views.users),
|
||||||
url(r'^peers',views.peers),
|
url(r'^peers',views.peers),
|
||||||
url(r'^currentUser',views.currentUser),
|
url(r'^currentUser',views.currentUser),
|
||||||
@ -17,6 +18,10 @@ urlpatterns = [
|
|||||||
url(r'^heartbeat',views.heartbeat),
|
url(r'^heartbeat',views.heartbeat),
|
||||||
#url(r'^register',views.register),
|
#url(r'^register',views.register),
|
||||||
url(r'^user_action',views.user_action), # 前端
|
url(r'^user_action',views.user_action), # 前端
|
||||||
url(r'^work',views.work), # 前端
|
url(r'^work',views.work), # 前端
|
||||||
url(r'^share',views.share), # 前端
|
url(r'^down_peers$',views.down_peers), # 前端
|
||||||
|
url(r'^share',views.share), # 前端
|
||||||
|
url(r'^conn_log',views.conn_log),
|
||||||
|
url(r'^file_log',views.file_log),
|
||||||
|
url(r'^audit',views.audit),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -22,3 +22,4 @@ import copy
|
|||||||
|
|
||||||
from .views_front import *
|
from .views_front import *
|
||||||
from .views_api import *
|
from .views_api import *
|
||||||
|
from .front_locale import *
|
||||||
|
|||||||
218
api/views_api.py
218
api/views_api.py
@ -3,24 +3,34 @@ from django.http import JsonResponse
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
# import hashlib
|
||||||
|
import math
|
||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
from django.forms.models import model_to_dict
|
# from django.forms.models import model_to_dict
|
||||||
from api.models import RustDeskToken, UserProfile, RustDeskTag, RustDeskPeer, RustDesDevice
|
from api.models import RustDeskToken, UserProfile, RustDeskTag, RustDeskPeer, RustDesDevice, ConnLog, FileLog
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
import copy
|
import copy
|
||||||
from .views_front import *
|
from .views_front import *
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
||||||
|
def get_client_ip(request):
|
||||||
|
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
|
||||||
|
if x_forwarded_for:
|
||||||
|
ip = x_forwarded_for.split(',')[0]
|
||||||
|
else:
|
||||||
|
ip = request.META.get('REMOTE_ADDR')
|
||||||
|
return ip
|
||||||
|
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
result = {}
|
result = {}
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
result['error'] = '请求方式错误!请使用POST方式。'
|
result['error'] = _('请求方式错误!请使用POST方式。')
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
data = json.loads(request.body.decode())
|
data = json.loads(request.body.decode())
|
||||||
|
|
||||||
username = data.get('username', '')
|
username = data.get('username', '')
|
||||||
password = data.get('password', '')
|
password = data.get('password', '')
|
||||||
rid = data.get('id', '')
|
rid = data.get('id', '')
|
||||||
@ -28,19 +38,31 @@ def login(request):
|
|||||||
autoLogin = data.get('autoLogin', True)
|
autoLogin = data.get('autoLogin', True)
|
||||||
rtype = data.get('type', '')
|
rtype = data.get('type', '')
|
||||||
deviceInfo = data.get('deviceInfo', '')
|
deviceInfo = data.get('deviceInfo', '')
|
||||||
user = auth.authenticate(username=username,password=password)
|
user = auth.authenticate(username=username, password=password)
|
||||||
if not user:
|
if not user:
|
||||||
result['error'] = '帐号或密码错误!请重试,多次重试后将被锁定IP!'
|
result['error'] = _('帐号或密码错误!请重试,多次重试后将被锁定IP!')
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
user.rid = rid
|
user.rid = rid
|
||||||
user.uuid = uuid
|
user.uuid = uuid
|
||||||
user.autoLogin = autoLogin
|
user.autoLogin = autoLogin
|
||||||
user.rtype = rtype
|
user.rtype = rtype
|
||||||
user.deviceInfo = json.dumps(deviceInfo)
|
user.deviceInfo = json.dumps(deviceInfo)
|
||||||
user.save()
|
user.save()
|
||||||
|
# 绑定设备 20240819
|
||||||
|
peer = RustDeskPeer.objects.filter(Q(rid=rid)).first()
|
||||||
|
if not peer:
|
||||||
|
device = RustDesDevice.objects.filter(Q(uuid=uuid)).first()
|
||||||
|
if device:
|
||||||
|
peer = RustDeskPeer()
|
||||||
|
peer.uid = user.id
|
||||||
|
peer.rid = device.rid
|
||||||
|
# peer.abid = ab.guid # v2, current version not used
|
||||||
|
peer.hostname = device.hostname
|
||||||
|
peer.username = device.username
|
||||||
|
peer.save()
|
||||||
|
|
||||||
token = RustDeskToken.objects.filter(Q(uid=user.id) & Q(username=user.username) & Q(rid=user.rid)).first()
|
token = RustDeskToken.objects.filter(Q(uid=user.id) & Q(username=user.username) & Q(rid=user.rid)).first()
|
||||||
|
|
||||||
# 检查是否过期
|
# 检查是否过期
|
||||||
if token:
|
if token:
|
||||||
now_t = datetime.datetime.now()
|
now_t = datetime.datetime.now()
|
||||||
@ -48,7 +70,7 @@ def login(request):
|
|||||||
if nums >= EFFECTIVE_SECONDS:
|
if nums >= EFFECTIVE_SECONDS:
|
||||||
token.delete()
|
token.delete()
|
||||||
token = None
|
token = None
|
||||||
|
|
||||||
if not token:
|
if not token:
|
||||||
# 获取并保存token
|
# 获取并保存token
|
||||||
token = RustDeskToken(
|
token = RustDeskToken(
|
||||||
@ -56,52 +78,52 @@ def login(request):
|
|||||||
uid=user.id,
|
uid=user.id,
|
||||||
uuid=user.uuid,
|
uuid=user.uuid,
|
||||||
rid=user.rid,
|
rid=user.rid,
|
||||||
access_token=getStrMd5(str(time.time())+salt)
|
access_token=getStrMd5(str(time.time()) + salt)
|
||||||
)
|
)
|
||||||
token.save()
|
token.save()
|
||||||
|
|
||||||
result['access_token'] = token.access_token
|
result['access_token'] = token.access_token
|
||||||
result['type'] = 'access_token'
|
result['type'] = 'access_token'
|
||||||
result['user'] = {'name':user.username}
|
result['user'] = {'name': user.username}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
def logout(request):
|
def logout(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
result = {'error':'请求方式错误!'}
|
result = {'error': _('请求方式错误!')}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
data = json.loads(request.body.decode())
|
data = json.loads(request.body.decode())
|
||||||
rid = data.get('id', '')
|
rid = data.get('id', '')
|
||||||
uuid = data.get('uuid', '')
|
uuid = data.get('uuid', '')
|
||||||
user = UserProfile.objects.filter(Q(rid=rid) & Q(uuid=uuid)).first()
|
user = UserProfile.objects.filter(Q(rid=rid) & Q(uuid=uuid)).first()
|
||||||
if not user:
|
if not user:
|
||||||
result = {'error':'异常请求!'}
|
result = {'error': _('异常请求!')}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
token = RustDeskToken.objects.filter(Q(uid=user.id) & Q(rid=user.rid)).first()
|
token = RustDeskToken.objects.filter(Q(uid=user.id) & Q(rid=user.rid)).first()
|
||||||
if token:
|
if token:
|
||||||
token.delete()
|
token.delete()
|
||||||
|
|
||||||
result = {'code':1}
|
result = {'code': 1}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
def currentUser(request):
|
def currentUser(request):
|
||||||
result = {}
|
result = {}
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
result['error'] = '错误的提交方式!'
|
result['error'] = _('错误的提交方式!')
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
postdata = json.loads(request.body)
|
# postdata = json.loads(request.body)
|
||||||
rid = postdata.get('id', '')
|
# rid = postdata.get('id', '')
|
||||||
uuid = postdata.get('uuid', '')
|
# uuid = postdata.get('uuid', '')
|
||||||
|
|
||||||
access_token = request.META.get('HTTP_AUTHORIZATION', '')
|
access_token = request.META.get('HTTP_AUTHORIZATION', '')
|
||||||
access_token = access_token.split('Bearer ')[-1]
|
access_token = access_token.split('Bearer ')[-1]
|
||||||
token = RustDeskToken.objects.filter(Q(access_token=access_token) ).first()
|
token = RustDeskToken.objects.filter(Q(access_token=access_token)).first()
|
||||||
user = None
|
user = None
|
||||||
if token:
|
if token:
|
||||||
user = UserProfile.objects.filter(Q(id=token.uid)).first()
|
user = UserProfile.objects.filter(Q(id=token.uid)).first()
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
if token:
|
if token:
|
||||||
result['access_token'] = token.access_token
|
result['access_token'] = token.access_token
|
||||||
@ -115,53 +137,53 @@ def ab(request):
|
|||||||
'''
|
'''
|
||||||
access_token = request.META.get('HTTP_AUTHORIZATION', '')
|
access_token = request.META.get('HTTP_AUTHORIZATION', '')
|
||||||
access_token = access_token.split('Bearer ')[-1]
|
access_token = access_token.split('Bearer ')[-1]
|
||||||
token = RustDeskToken.objects.filter(Q(access_token=access_token) ).first()
|
token = RustDeskToken.objects.filter(Q(access_token=access_token)).first()
|
||||||
if not token:
|
if not token:
|
||||||
result = {'error':'拉取列表错误!'}
|
result = {'error': _('拉取列表错误!')}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
result = {}
|
result = {}
|
||||||
uid = token.uid
|
uid = token.uid
|
||||||
tags = RustDeskTag.objects.filter(Q(uid=uid) )
|
tags = RustDeskTag.objects.filter(Q(uid=uid))
|
||||||
tag_names = []
|
tag_names = []
|
||||||
tag_colors = {}
|
tag_colors = {}
|
||||||
if tags:
|
if tags:
|
||||||
tag_names = [str(x.tag_name) for x in tags]
|
tag_names = [str(x.tag_name) for x in tags]
|
||||||
tag_colors = {str(x.tag_name):int(x.tag_color) for x in tags if x.tag_color!=''}
|
tag_colors = {str(x.tag_name): int(x.tag_color) for x in tags if x.tag_color != ''}
|
||||||
|
|
||||||
peers_result = []
|
peers_result = []
|
||||||
peers = RustDeskPeer.objects.filter(Q(uid=uid) )
|
peers = RustDeskPeer.objects.filter(Q(uid=uid))
|
||||||
if peers:
|
if peers:
|
||||||
for peer in peers:
|
for peer in peers:
|
||||||
tmp = {
|
tmp = {
|
||||||
'id':peer.rid,
|
'id': peer.rid,
|
||||||
'username':peer.username,
|
'username': peer.username,
|
||||||
'hostname':peer.hostname,
|
'hostname': peer.hostname,
|
||||||
'alias':peer.alias,
|
'alias': peer.alias,
|
||||||
'platform':peer.platform,
|
'platform': peer.platform,
|
||||||
'tags':peer.tags.split(','),
|
'tags': peer.tags.split(','),
|
||||||
'hash':peer.rhash,
|
'hash': peer.rhash,
|
||||||
}
|
}
|
||||||
peers_result.append(tmp)
|
peers_result.append(tmp)
|
||||||
|
|
||||||
result['updated_at'] = datetime.datetime.now()
|
result['updated_at'] = datetime.datetime.now()
|
||||||
result['data'] = {
|
result['data'] = {
|
||||||
'tags':tag_names,
|
'tags': tag_names,
|
||||||
'peers':peers_result,
|
'peers': peers_result,
|
||||||
'tag_colors':json.dumps(tag_colors)
|
'tag_colors': json.dumps(tag_colors)
|
||||||
}
|
}
|
||||||
result['data'] = json.dumps(result['data'])
|
result['data'] = json.dumps(result['data'])
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
else:
|
else:
|
||||||
postdata = json.loads(request.body.decode())
|
postdata = json.loads(request.body.decode())
|
||||||
data = postdata.get('data', '')
|
data = postdata.get('data', '')
|
||||||
data = {} if data=='' else json.loads(data)
|
data = {} if data == '' else json.loads(data)
|
||||||
tagnames = data.get('tags', [])
|
tagnames = data.get('tags', [])
|
||||||
tag_colors = data.get('tag_colors', '')
|
tag_colors = data.get('tag_colors', '')
|
||||||
tag_colors = {} if tag_colors=='' else json.loads(tag_colors)
|
tag_colors = {} if tag_colors == '' else json.loads(tag_colors)
|
||||||
peers = data.get('peers', [])
|
peers = data.get('peers', [])
|
||||||
|
|
||||||
if tagnames:
|
if tagnames:
|
||||||
# 删除旧的tag
|
# 删除旧的tag
|
||||||
RustDeskTag.objects.filter(uid=token.uid).delete()
|
RustDeskTag.objects.filter(uid=token.uid).delete()
|
||||||
@ -188,27 +210,34 @@ def ab(request):
|
|||||||
platform=one['platform'],
|
platform=one['platform'],
|
||||||
tags=','.join(one['tags']),
|
tags=','.join(one['tags']),
|
||||||
rhash=one['hash'],
|
rhash=one['hash'],
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
newlist.append(peer)
|
newlist.append(peer)
|
||||||
RustDeskPeer.objects.bulk_create(newlist)
|
RustDeskPeer.objects.bulk_create(newlist)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'code':102,
|
'code': 102,
|
||||||
'data':'更新地址簿有误'
|
'data': _('更新地址簿有误')
|
||||||
}
|
}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
|
def ab_get(request):
|
||||||
|
# 兼容 x86-sciter 版客户端,此版客户端通过访问 "POST /api/ab/get" 来获取地址簿
|
||||||
|
request.method = 'GET'
|
||||||
|
return ab(request)
|
||||||
|
|
||||||
|
|
||||||
def sysinfo(request):
|
def sysinfo(request):
|
||||||
# 客户端注册服务后,才会发送设备信息
|
# 客户端注册服务后,才会发送设备信息
|
||||||
result = {}
|
result = {}
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
result['error'] = '错误的提交方式!'
|
result['error'] = _('错误的提交方式!')
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
client_ip = get_client_ip(request)
|
||||||
postdata = json.loads(request.body)
|
postdata = json.loads(request.body)
|
||||||
device = RustDesDevice.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid']) ).first()
|
device = RustDesDevice.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid'])).first()
|
||||||
if not device:
|
if not device:
|
||||||
device = RustDesDevice(
|
device = RustDesDevice(
|
||||||
rid=postdata['id'],
|
rid=postdata['id'],
|
||||||
@ -219,38 +248,101 @@ def sysinfo(request):
|
|||||||
username=postdata.get('username', '-'),
|
username=postdata.get('username', '-'),
|
||||||
uuid=postdata['uuid'],
|
uuid=postdata['uuid'],
|
||||||
version=postdata['version'],
|
version=postdata['version'],
|
||||||
|
ip_address=client_ip
|
||||||
)
|
)
|
||||||
device.save()
|
device.save()
|
||||||
else:
|
else:
|
||||||
postdata2 = copy.copy(postdata)
|
postdata2 = copy.copy(postdata)
|
||||||
postdata2['rid'] = postdata2['id']
|
postdata2['rid'] = postdata2['id']
|
||||||
postdata2.pop('id')
|
postdata2.pop('id')
|
||||||
RustDesDevice.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid']) ).update(**postdata2)
|
RustDesDevice.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid'])).update(**postdata2)
|
||||||
result['data'] = 'ok'
|
result['data'] = 'ok'
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
def heartbeat(request):
|
def heartbeat(request):
|
||||||
postdata = json.loads(request.body)
|
postdata = json.loads(request.body)
|
||||||
device = RustDesDevice.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid']) ).first()
|
device = RustDesDevice.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid'])).first()
|
||||||
if device:
|
if device:
|
||||||
|
client_ip = get_client_ip(request)
|
||||||
|
device.ip_address = client_ip
|
||||||
device.save()
|
device.save()
|
||||||
# token保活
|
# token保活
|
||||||
create_time = datetime.datetime.now() + datetime.timedelta(seconds=EFFECTIVE_SECONDS)
|
create_time = datetime.datetime.now() + datetime.timedelta(seconds=EFFECTIVE_SECONDS)
|
||||||
RustDeskToken.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid']) ).update(create_time=create_time)
|
RustDeskToken.objects.filter(Q(rid=postdata['id']) & Q(uuid=postdata['uuid'])).update(create_time=create_time)
|
||||||
result = {}
|
result = {}
|
||||||
result['data'] = '在线'
|
result['data'] = _('在线')
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
|
def audit(request):
|
||||||
|
postdata = json.loads(request.body)
|
||||||
|
# print(postdata)
|
||||||
|
audit_type = postdata['action'] if 'action' in postdata else ''
|
||||||
|
if audit_type == 'new':
|
||||||
|
new_conn_log = ConnLog(
|
||||||
|
action=postdata['action'] if 'action' in postdata else '',
|
||||||
|
conn_id=postdata['conn_id'] if 'conn_id' in postdata else 0,
|
||||||
|
from_ip=postdata['ip'] if 'ip' in postdata else '',
|
||||||
|
from_id='',
|
||||||
|
rid=postdata['id'] if 'id' in postdata else '',
|
||||||
|
conn_start=datetime.datetime.now(),
|
||||||
|
session_id=postdata['session_id'] if 'session_id' in postdata else 0,
|
||||||
|
uuid=postdata['uuid'] if 'uuid' in postdata else '',
|
||||||
|
)
|
||||||
|
new_conn_log.save()
|
||||||
|
elif audit_type == "close":
|
||||||
|
ConnLog.objects.filter(Q(conn_id=postdata['conn_id'])).update(conn_end=datetime.datetime.now())
|
||||||
|
elif 'is_file' in postdata:
|
||||||
|
print(postdata)
|
||||||
|
files = json.loads(postdata['info'])['files']
|
||||||
|
filesize = convert_filesize(int(files[0][1]))
|
||||||
|
new_file_log = FileLog(
|
||||||
|
file=postdata['path'],
|
||||||
|
user_id=postdata['peer_id'],
|
||||||
|
user_ip=json.loads(postdata['info'])['ip'],
|
||||||
|
remote_id=postdata['id'],
|
||||||
|
filesize=filesize,
|
||||||
|
direction=postdata['type'],
|
||||||
|
logged_at=datetime.datetime.now(),
|
||||||
|
)
|
||||||
|
new_file_log.save()
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
peer = postdata['peer']
|
||||||
|
ConnLog.objects.filter(Q(conn_id=postdata['conn_id'])).update(session_id=postdata['session_id'])
|
||||||
|
ConnLog.objects.filter(Q(conn_id=postdata['conn_id'])).update(from_id=peer[0])
|
||||||
|
except Exception as e:
|
||||||
|
print(postdata, e)
|
||||||
|
|
||||||
|
result = {
|
||||||
|
'code': 1,
|
||||||
|
'data': 'ok'
|
||||||
|
}
|
||||||
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
|
def convert_filesize(size_bytes):
|
||||||
|
if size_bytes == 0:
|
||||||
|
return "0B"
|
||||||
|
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
|
||||||
|
i = int(math.floor(math.log(size_bytes, 1024)))
|
||||||
|
p = math.pow(1024, i)
|
||||||
|
s = round(size_bytes / p, 2)
|
||||||
|
return "%s %s" % (s, size_name[i])
|
||||||
|
|
||||||
|
|
||||||
def users(request):
|
def users(request):
|
||||||
result = {
|
result = {
|
||||||
'code':1,
|
'code': 1,
|
||||||
'data':'好的'
|
'data': _('好的')
|
||||||
}
|
}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
def peers(request):
|
def peers(request):
|
||||||
result = {
|
result = {
|
||||||
'code':1,
|
'code': 1,
|
||||||
'data':'ok'
|
'data': 'ok'
|
||||||
}
|
}
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|||||||
@ -6,8 +6,11 @@ from django.http import JsonResponse
|
|||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
from api.models import RustDeskPeer, RustDesDevice, UserProfile, ShareLink
|
from api.models import RustDeskPeer, RustDesDevice, UserProfile, ShareLink, ConnLog, FileLog
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
|
from django.core.paginator import Paginator
|
||||||
|
from django.http import HttpResponse
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from django.db.models.fields import DateTimeField, DateField, CharField, TextField
|
from django.db.models.fields import DateTimeField, DateField, CharField, TextField
|
||||||
@ -18,9 +21,14 @@ import time
|
|||||||
import hashlib
|
import hashlib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from io import BytesIO
|
||||||
|
import xlwt
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
salt = 'xiaomo'
|
salt = 'xiaomo'
|
||||||
EFFECTIVE_SECONDS = 7200
|
EFFECTIVE_SECONDS = 7200
|
||||||
|
|
||||||
|
|
||||||
def getStrMd5(s):
|
def getStrMd5(s):
|
||||||
if not isinstance(s, (str,)):
|
if not isinstance(s, (str,)):
|
||||||
s = str(s)
|
s = str(s)
|
||||||
@ -30,6 +38,7 @@ def getStrMd5(s):
|
|||||||
|
|
||||||
return myHash.hexdigest()
|
return myHash.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def model_to_dict2(instance, fields=None, exclude=None, replace=None, default=None):
|
def model_to_dict2(instance, fields=None, exclude=None, replace=None, default=None):
|
||||||
"""
|
"""
|
||||||
:params instance: 模型对象,不能是queryset数据集
|
:params instance: 模型对象,不能是queryset数据集
|
||||||
@ -40,23 +49,23 @@ def model_to_dict2(instance, fields=None, exclude=None, replace=None, default=No
|
|||||||
"""
|
"""
|
||||||
# 对传递进来的模型对象校验
|
# 对传递进来的模型对象校验
|
||||||
if not isinstance(instance, Model):
|
if not isinstance(instance, Model):
|
||||||
raise Exception('model_to_dict接收的参数必须是模型对象')
|
raise Exception(_('model_to_dict接收的参数必须是模型对象'))
|
||||||
# 对替换数据库字段名字校验
|
# 对替换数据库字段名字校验
|
||||||
if replace and type(replace) == dict:
|
if replace and type(replace) == dict: # noqa
|
||||||
for replace_field in replace.values():
|
for replace_field in replace.values():
|
||||||
if hasattr(instance, replace_field):
|
if hasattr(instance, replace_field):
|
||||||
raise Exception(f'model_to_dict,要替换成{replace_field}字段已经存在了')
|
raise Exception(_(f'model_to_dict,要替换成{replace_field}字段已经存在了'))
|
||||||
# 对要新增的默认值进行校验
|
# 对要新增的默认值进行校验
|
||||||
if default and type(default) == dict:
|
if default and type(default) == dict: # noqa
|
||||||
for default_key in default.keys():
|
for default_key in default.keys():
|
||||||
if hasattr(instance, default_key):
|
if hasattr(instance, default_key):
|
||||||
raise Exception(f'model_to_dict,要新增默认值,但字段{default_key}已经存在了')
|
raise Exception(_(f'model_to_dict,要新增默认值,但字段{default_key}已经存在了')) # noqa
|
||||||
opts = instance._meta
|
opts = instance._meta
|
||||||
data = {}
|
data = {}
|
||||||
for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many):
|
for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many):
|
||||||
# 源码下:这块代码会将时间字段剔除掉,我加上一层判断,让其不再剔除时间字段
|
# 源码下:这块代码会将时间字段剔除掉,我加上一层判断,让其不再剔除时间字段
|
||||||
if not getattr(f, 'editable', False):
|
if not getattr(f, 'editable', False):
|
||||||
if type(f) == DateField or type(f) == DateTimeField:
|
if type(f) == DateField or type(f) == DateTimeField: # noqa
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
@ -69,22 +78,22 @@ def model_to_dict2(instance, fields=None, exclude=None, replace=None, default=No
|
|||||||
|
|
||||||
key = f.name
|
key = f.name
|
||||||
# 获取字段对应的数据
|
# 获取字段对应的数据
|
||||||
if type(f) == DateTimeField:
|
if type(f) == DateTimeField: # noqa
|
||||||
# 字段类型是,DateTimeFiled 使用自己的方式操作
|
# 字段类型是,DateTimeFiled 使用自己的方式操作
|
||||||
value = getattr(instance, key)
|
value = getattr(instance, key)
|
||||||
value = datetime.datetime.strftime(value, '%Y-%m-%d')
|
value = datetime.datetime.strftime(value, '%Y-%m-%d %H:%M')
|
||||||
elif type(f) == DateField:
|
elif type(f) == DateField: # noqa
|
||||||
# 字段类型是,DateFiled 使用自己的方式操作
|
# 字段类型是,DateFiled 使用自己的方式操作
|
||||||
value = getattr(instance, key)
|
value = getattr(instance, key)
|
||||||
value = datetime.datetime.strftime(value, '%Y-%m-%d')
|
value = datetime.datetime.strftime(value, '%Y-%m-%d')
|
||||||
elif type(f) == CharField or type(f) == TextField:
|
elif type(f) == CharField or type(f) == TextField: # noqa
|
||||||
# 字符串数据是否可以进行序列化,转成python结构数据
|
# 字符串数据是否可以进行序列化,转成python结构数据
|
||||||
value = getattr(instance, key)
|
value = getattr(instance, key)
|
||||||
try:
|
try:
|
||||||
value = json.loads(value)
|
value = json.loads(value)
|
||||||
except Exception as _:
|
except Exception as _: # noqa
|
||||||
value = value
|
value = value
|
||||||
else:#其他类型的字段
|
else: # 其他类型的字段
|
||||||
# value = getattr(instance, key)
|
# value = getattr(instance, key)
|
||||||
key = f.name
|
key = f.name
|
||||||
value = f.value_from_object(instance)
|
value = f.value_from_object(instance)
|
||||||
@ -93,30 +102,30 @@ def model_to_dict2(instance, fields=None, exclude=None, replace=None, default=No
|
|||||||
if replace and key in replace.keys():
|
if replace and key in replace.keys():
|
||||||
key = replace.get(key)
|
key = replace.get(key)
|
||||||
data[key] = value
|
data[key] = value
|
||||||
#2、新增默认的字段数据
|
# 2、新增默认的字段数据
|
||||||
if default:
|
if default:
|
||||||
data.update(default)
|
data.update(default)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
print('sdf',sys.argv)
|
print('sdf', sys.argv)
|
||||||
if request.user and request.user.username!='AnonymousUser':
|
if request.user and request.user.username != 'AnonymousUser':
|
||||||
return HttpResponseRedirect('/api/work')
|
return HttpResponseRedirect('/api/work')
|
||||||
return HttpResponseRedirect('/api/user_action?action=login')
|
return HttpResponseRedirect('/api/user_action?action=login')
|
||||||
|
|
||||||
|
|
||||||
def user_action(request):
|
def user_action(request):
|
||||||
action = request.GET.get('action', '')
|
action = request.GET.get('action', '')
|
||||||
if action == '':
|
|
||||||
return
|
|
||||||
if action == 'login':
|
if action == 'login':
|
||||||
return user_login(request)
|
return user_login(request)
|
||||||
if action == 'register':
|
elif action == 'register':
|
||||||
return user_register(request)
|
return user_register(request)
|
||||||
if action == 'logout':
|
elif action == 'logout':
|
||||||
return user_logout(request)
|
return user_logout(request)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def user_login(request):
|
def user_login(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
@ -125,110 +134,157 @@ def user_login(request):
|
|||||||
username = request.POST.get('account', '')
|
username = request.POST.get('account', '')
|
||||||
password = request.POST.get('password', '')
|
password = request.POST.get('password', '')
|
||||||
if not username or not password:
|
if not username or not password:
|
||||||
return JsonResponse({'code':0, 'msg':'出了点问题。'})
|
return JsonResponse({'code': 0, 'msg': _('出了点问题,未获取用户名或密码。')})
|
||||||
|
|
||||||
user = auth.authenticate(username=username,password=password)
|
user = auth.authenticate(username=username, password=password)
|
||||||
if user:
|
if user:
|
||||||
auth.login(request, user)
|
auth.login(request, user)
|
||||||
return JsonResponse({'code':1, 'url':'/api/work'})
|
return JsonResponse({'code': 1, 'url': '/api/work'})
|
||||||
else:
|
else:
|
||||||
return JsonResponse({'code':0, 'msg':'帐号或密码错误!'})
|
return JsonResponse({'code': 0, 'msg': _('帐号或密码错误!')})
|
||||||
|
|
||||||
|
|
||||||
def user_register(request):
|
def user_register(request):
|
||||||
info = ''
|
info = ''
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render(request, 'reg.html')
|
return render(request, 'reg.html')
|
||||||
|
ALLOW_REGISTRATION = settings.ALLOW_REGISTRATION
|
||||||
result = {
|
result = {
|
||||||
'code':0,
|
'code': 0,
|
||||||
'msg':''
|
'msg': ''
|
||||||
}
|
}
|
||||||
|
if not ALLOW_REGISTRATION:
|
||||||
|
result['msg'] = _('当前未开放注册,请联系管理员!')
|
||||||
|
return JsonResponse(result)
|
||||||
|
|
||||||
username = request.POST.get('user', '')
|
username = request.POST.get('user', '')
|
||||||
password1 = request.POST.get('pwd', '')
|
password1 = request.POST.get('pwd', '')
|
||||||
|
|
||||||
if len(username) <= 3:
|
if len(username) <= 3:
|
||||||
info = '用户名不得小于3位'
|
info = _('用户名不得小于3位')
|
||||||
result['msg'] = info
|
result['msg'] = info
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
if len(password1)<8 or len(password1)>20:
|
if len(password1) < 8 or len(password1) > 20:
|
||||||
info = '密码长度不符合要求, 应在8~20位。'
|
info = _('密码长度不符合要求, 应在8~20位。')
|
||||||
result['msg'] = info
|
result['msg'] = info
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
user = UserProfile.objects.filter(Q(username=username)).first()
|
user = UserProfile.objects.filter(Q(username=username)).first()
|
||||||
if user:
|
if user:
|
||||||
info = '用户名已存在。'
|
info = _('用户名已存在。')
|
||||||
result['msg'] = info
|
result['msg'] = info
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
user = UserProfile(
|
user = UserProfile(
|
||||||
username=username,
|
username=username,
|
||||||
password=make_password(password1),
|
password=make_password(password1),
|
||||||
is_admin = True if UserProfile.objects.count()==0 else False,
|
is_admin=True if UserProfile.objects.count() == 0 else False,
|
||||||
is_superuser = True if UserProfile.objects.count()==0 else False,
|
is_superuser=True if UserProfile.objects.count() == 0 else False,
|
||||||
is_active = True
|
is_active=True
|
||||||
)
|
)
|
||||||
user.save()
|
user.save()
|
||||||
result['msg'] = info
|
result['msg'] = info
|
||||||
result['code'] = 1
|
result['code'] = 1
|
||||||
return JsonResponse(result)
|
return JsonResponse(result)
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url='/api/user_action?action=login')
|
@login_required(login_url='/api/user_action?action=login')
|
||||||
def user_logout(request):
|
def user_logout(request):
|
||||||
info = ''
|
# info=''
|
||||||
auth.logout(request)
|
auth.logout(request)
|
||||||
return HttpResponseRedirect('/api/user_action?action=login')
|
return HttpResponseRedirect('/api/user_action?action=login')
|
||||||
|
|
||||||
|
|
||||||
def get_single_info(uid):
|
def get_single_info(uid):
|
||||||
peers = RustDeskPeer.objects.filter(Q(uid=uid))
|
peers = RustDeskPeer.objects.filter(Q(uid=uid))
|
||||||
rids = [x.rid for x in peers]
|
rids = [x.rid for x in peers]
|
||||||
peers = {x.rid:model_to_dict(x) for x in peers}
|
peers = {x.rid: model_to_dict(x) for x in peers}
|
||||||
#print(peers)
|
# print(peers)
|
||||||
devices = RustDesDevice.objects.filter(rid__in=rids)
|
devices = RustDesDevice.objects.filter(rid__in=rids)
|
||||||
devices = {x.rid:x for x in devices}
|
devices = {x.rid: x for x in devices}
|
||||||
|
now = datetime.datetime.now()
|
||||||
for rid, device in devices.items():
|
for rid, device in devices.items():
|
||||||
peers[rid]['create_time'] = device.create_time.strftime('%Y-%m-%d')
|
peers[rid]['create_time'] = device.create_time.strftime('%Y-%m-%d')
|
||||||
peers[rid]['update_time'] = device.update_time.strftime('%Y-%m-%d')
|
peers[rid]['update_time'] = device.update_time.strftime('%Y-%m-%d %H:%M')
|
||||||
peers[rid]['version'] = device.version
|
peers[rid]['version'] = device.version
|
||||||
peers[rid]['memory'] = device.memory
|
peers[rid]['memory'] = device.memory
|
||||||
peers[rid]['cpu'] = device.cpu
|
peers[rid]['cpu'] = device.cpu
|
||||||
peers[rid]['os'] = device.os
|
peers[rid]['os'] = device.os
|
||||||
|
peers[rid]['status'] = _('在线') if (now - device.update_time).seconds <= 120 else _('离线')
|
||||||
|
|
||||||
for rid in peers.keys():
|
for rid in peers.keys():
|
||||||
peers[rid]['has_rhash'] = '是' if len(peers[rid]['rhash'])>1 else '否'
|
peers[rid]['has_rhash'] = _('是') if len(peers[rid]['rhash']) > 1 else _('否')
|
||||||
|
|
||||||
|
return [v for k, v in peers.items()]
|
||||||
|
|
||||||
return [v for k,v in peers.items()]
|
|
||||||
|
|
||||||
def get_all_info():
|
def get_all_info():
|
||||||
devices = RustDesDevice.objects.all()
|
devices = RustDesDevice.objects.all()
|
||||||
peers = RustDeskPeer.objects.all()
|
peers = RustDeskPeer.objects.all()
|
||||||
devices = {x.rid:model_to_dict2(x) for x in devices}
|
devices = {x.rid: model_to_dict2(x) for x in devices}
|
||||||
|
now = datetime.datetime.now()
|
||||||
for peer in peers:
|
for peer in peers:
|
||||||
user = UserProfile.objects.filter(Q(id=peer.uid)).first()
|
user = UserProfile.objects.filter(Q(id=peer.uid)).first()
|
||||||
device = devices.get(peer.rid, None)
|
device = devices.get(peer.rid, None)
|
||||||
if device:
|
if device:
|
||||||
devices[peer.rid]['rust_user'] = user.username
|
devices[peer.rid]['rust_user'] = user.username
|
||||||
return [v for k,v in devices.items()]
|
|
||||||
|
for rid in devices.keys():
|
||||||
|
if not devices[rid].get('rust_user', ''):
|
||||||
|
devices[rid]['rust_user'] = _('未登录')
|
||||||
|
for k, v in devices.items():
|
||||||
|
devices[k]['status'] = _('在线') if (now - datetime.datetime.strptime(v['update_time'], '%Y-%m-%d %H:%M')).seconds <= 120 else _('离线')
|
||||||
|
return [v for k, v in devices.items()]
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url='/api/user_action?action=login')
|
@login_required(login_url='/api/user_action?action=login')
|
||||||
def work(request):
|
def work(request):
|
||||||
|
|
||||||
username = request.user
|
username = request.user
|
||||||
u = UserProfile.objects.get(username=username)
|
u = UserProfile.objects.get(username=username)
|
||||||
single_info = get_single_info(u.id)
|
|
||||||
|
show_type = request.GET.get('show_type', '')
|
||||||
|
show_all = True if show_type == 'admin' and u.is_admin else False
|
||||||
|
paginator = Paginator(get_all_info(), 15) if show_type == 'admin' and u.is_admin else Paginator(get_single_info(u.id), 15)
|
||||||
|
page_number = request.GET.get('page')
|
||||||
|
page_obj = paginator.get_page(page_number)
|
||||||
|
return render(request, 'show_work.html', {'u': u, 'show_all': show_all, 'page_obj': page_obj})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/api/user_action?action=login')
|
||||||
|
def down_peers(request):
|
||||||
|
username = request.user
|
||||||
|
u = UserProfile.objects.get(username=username)
|
||||||
|
|
||||||
|
if not u.is_admin:
|
||||||
|
print(u.is_admin)
|
||||||
|
return HttpResponseRedirect('/api/work')
|
||||||
|
|
||||||
all_info = get_all_info()
|
all_info = get_all_info()
|
||||||
print(all_info)
|
f = xlwt.Workbook(encoding='utf-8')
|
||||||
|
sheet1 = f.add_sheet(_(u'设备信息表'), cell_overwrite_ok=True)
|
||||||
|
all_fields = [x.name for x in RustDesDevice._meta.get_fields()]
|
||||||
|
all_fields.append('rust_user')
|
||||||
|
for i, one in enumerate(all_info):
|
||||||
|
for j, name in enumerate(all_fields):
|
||||||
|
if i == 0:
|
||||||
|
# 写入列名
|
||||||
|
sheet1.write(i, j, name)
|
||||||
|
sheet1.write(i + 1, j, one.get(name, '-'))
|
||||||
|
|
||||||
return render(request, 'show_work.html', {'single_info':single_info, 'all_info':all_info, 'u':u})
|
sio = BytesIO()
|
||||||
|
f.save(sio)
|
||||||
|
sio.seek(0)
|
||||||
|
response = HttpResponse(sio.getvalue(), content_type='application/vnd.ms-excel')
|
||||||
|
response['Content-Disposition'] = 'attachment; filename=DeviceInfo.xls'
|
||||||
|
response.write(sio.getvalue())
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
def check_sharelink_expired(sharelink):
|
def check_sharelink_expired(sharelink):
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
if sharelink.create_time > now:
|
if sharelink.create_time > now:
|
||||||
return False
|
return False
|
||||||
if (now - sharelink.create_time).seconds <15 * 60:
|
if (now - sharelink.create_time).seconds < 15 * 60:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
sharelink.is_expired = True
|
sharelink.is_expired = True
|
||||||
@ -241,19 +297,18 @@ def share(request):
|
|||||||
peers = RustDeskPeer.objects.filter(Q(uid=request.user.id))
|
peers = RustDeskPeer.objects.filter(Q(uid=request.user.id))
|
||||||
sharelinks = ShareLink.objects.filter(Q(uid=request.user.id) & Q(is_used=False) & Q(is_expired=False))
|
sharelinks = ShareLink.objects.filter(Q(uid=request.user.id) & Q(is_used=False) & Q(is_expired=False))
|
||||||
|
|
||||||
|
|
||||||
# 省资源:处理已过期请求,不主动定时任务轮询请求,在任意地方请求时,检查是否过期,过期则保存。
|
# 省资源:处理已过期请求,不主动定时任务轮询请求,在任意地方请求时,检查是否过期,过期则保存。
|
||||||
now = datetime.datetime.now()
|
# now = datetime.datetime.now()
|
||||||
for sl in sharelinks:
|
for sl in sharelinks:
|
||||||
check_sharelink_expired(sl)
|
check_sharelink_expired(sl)
|
||||||
sharelinks = ShareLink.objects.filter(Q(uid=request.user.id) & Q(is_used=False) & Q(is_expired=False))
|
sharelinks = ShareLink.objects.filter(Q(uid=request.user.id) & Q(is_used=False) & Q(is_expired=False))
|
||||||
peers = [{'id':ix+1, 'name':f'{p.rid}|{p.alias}'} for ix, p in enumerate(peers)]
|
peers = [{'id': ix + 1, 'name': f'{p.rid}|{p.alias}'} for ix, p in enumerate(peers)]
|
||||||
sharelinks = [{'shash':s.shash, 'is_used':s.is_used, 'is_expired':s.is_expired, 'create_time':s.create_time, 'peers':s.peers} for ix, s in enumerate(sharelinks)]
|
sharelinks = [{'shash': s.shash, 'is_used': s.is_used, 'is_expired': s.is_expired, 'create_time': s.create_time, 'peers': s.peers} for ix, s in enumerate(sharelinks)]
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
url = request.build_absolute_uri()
|
url = request.build_absolute_uri()
|
||||||
if url.endswith('share'):
|
if url.endswith('share'):
|
||||||
return render(request, 'share.html', {'peers':peers, 'sharelinks':sharelinks})
|
return render(request, 'share.html', {'peers': peers, 'sharelinks': sharelinks})
|
||||||
else:
|
else:
|
||||||
shash = url.split('/')[-1]
|
shash = url.split('/')[-1]
|
||||||
sharelink = ShareLink.objects.filter(Q(shash=shash))
|
sharelink = ShareLink.objects.filter(Q(shash=shash))
|
||||||
@ -275,20 +330,20 @@ def share(request):
|
|||||||
# 自己的peers若重叠,需要跳过
|
# 自己的peers若重叠,需要跳过
|
||||||
peers_self_ids = [x.rid for x in RustDeskPeer.objects.filter(Q(uid=request.user.id))]
|
peers_self_ids = [x.rid for x in RustDeskPeer.objects.filter(Q(uid=request.user.id))]
|
||||||
peers_share = RustDeskPeer.objects.filter(Q(rid__in=peers) & Q(uid=sharelink.uid))
|
peers_share = RustDeskPeer.objects.filter(Q(rid__in=peers) & Q(uid=sharelink.uid))
|
||||||
peers_share_ids = [x.rid for x in peers_share]
|
# peers_share_ids = [x.rid for x in peers_share]
|
||||||
|
|
||||||
for peer in peers_share:
|
for peer in peers_share:
|
||||||
if peer.rid in peers_self_ids:
|
if peer.rid in peers_self_ids:
|
||||||
continue
|
continue
|
||||||
#peer = RustDeskPeer.objects.get(rid=peer.rid)
|
# peer = RustDeskPeer.objects.get(rid=peer.rid)
|
||||||
peer_f = RustDeskPeer.objects.filter(Q(rid=peer.rid) & Q(uid=sharelink.uid))
|
peer_f = RustDeskPeer.objects.filter(Q(rid=peer.rid) & Q(uid=sharelink.uid))
|
||||||
if not peer_f:
|
if not peer_f:
|
||||||
msg += f"{peer.rid}已存在,"
|
msg += f"{peer.rid}已存在,"
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if len(peer_f) > 1:
|
if len(peer_f) > 1:
|
||||||
msg += f'{peer.rid}存在多个,已经跳过。 '
|
msg += f'{peer.rid}存在多个,已经跳过。 '
|
||||||
continue
|
continue
|
||||||
peer = peer_f[0]
|
peer = peer_f[0]
|
||||||
peer.id = None
|
peer.id = None
|
||||||
peer.uid = request.user.id
|
peer.uid = request.user.id
|
||||||
@ -297,21 +352,99 @@ def share(request):
|
|||||||
|
|
||||||
msg += '已被成功获取。'
|
msg += '已被成功获取。'
|
||||||
|
|
||||||
return render(request, 'msg.html', {'title':msg, 'msg':msg})
|
title = _(title)
|
||||||
|
msg = _(msg)
|
||||||
|
return render(request, 'msg.html', {'title': msg, 'msg': msg})
|
||||||
else:
|
else:
|
||||||
data = request.POST.get('data', '[]')
|
data = request.POST.get('data', '[]')
|
||||||
|
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
if not data:
|
if not data:
|
||||||
return JsonResponse({'code':0, 'msg':'数据为空。'})
|
return JsonResponse({'code': 0, 'msg': _('数据为空。')})
|
||||||
rustdesk_ids = [x['title'].split('|')[0] for x in data]
|
rustdesk_ids = [x['title'].split('|')[0] for x in data]
|
||||||
rustdesk_ids = ','.join(rustdesk_ids)
|
rustdesk_ids = ','.join(rustdesk_ids)
|
||||||
sharelink = ShareLink(
|
sharelink = ShareLink(
|
||||||
uid=request.user.id,
|
uid=request.user.id,
|
||||||
shash = getStrMd5(str(time.time())+salt),
|
shash=getStrMd5(str(time.time()) + salt),
|
||||||
peers=rustdesk_ids,
|
peers=rustdesk_ids,
|
||||||
)
|
)
|
||||||
sharelink.save()
|
sharelink.save()
|
||||||
|
|
||||||
return JsonResponse({'code':1, 'shash':sharelink.shash})
|
return JsonResponse({'code': 1, 'shash': sharelink.shash})
|
||||||
|
|
||||||
|
|
||||||
|
def get_conn_log():
|
||||||
|
logs = ConnLog.objects.all()
|
||||||
|
logs = {x.id: model_to_dict(x) for x in logs}
|
||||||
|
|
||||||
|
for k, v in logs.items():
|
||||||
|
try:
|
||||||
|
peer = RustDeskPeer.objects.get(rid=v['rid'])
|
||||||
|
logs[k]['alias'] = peer.alias
|
||||||
|
except: # noqa
|
||||||
|
logs[k]['alias'] = _('UNKNOWN')
|
||||||
|
try:
|
||||||
|
peer = RustDeskPeer.objects.get(rid=v['from_id'])
|
||||||
|
logs[k]['from_alias'] = peer.alias
|
||||||
|
except: # noqa
|
||||||
|
logs[k]['from_alias'] = _('UNKNOWN')
|
||||||
|
# from_zone = tz.tzutc()
|
||||||
|
# to_zone = tz.tzlocal()
|
||||||
|
# utc = logs[k]['logged_at']
|
||||||
|
# utc = utc.replace(tzinfo=from_zone)
|
||||||
|
# logs[k]['logged_at'] = utc.astimezone(to_zone)
|
||||||
|
try:
|
||||||
|
duration = round((logs[k]['conn_end'] - logs[k]['conn_start']).total_seconds())
|
||||||
|
m, s = divmod(duration, 60)
|
||||||
|
h, m = divmod(m, 60)
|
||||||
|
# d, h = divmod(h, 24)
|
||||||
|
logs[k]['duration'] = f'{h:02d}:{m:02d}:{s:02d}'
|
||||||
|
except: # noqa
|
||||||
|
logs[k]['duration'] = -1
|
||||||
|
|
||||||
|
sorted_logs = sorted(logs.items(), key=lambda x: x[1]['conn_start'], reverse=True)
|
||||||
|
new_ordered_dict = {}
|
||||||
|
for key, alog in sorted_logs:
|
||||||
|
new_ordered_dict[key] = alog
|
||||||
|
|
||||||
|
return [v for k, v in new_ordered_dict.items()]
|
||||||
|
|
||||||
|
|
||||||
|
def get_file_log():
|
||||||
|
logs = FileLog.objects.all()
|
||||||
|
logs = {x.id: model_to_dict(x) for x in logs}
|
||||||
|
|
||||||
|
for k, v in logs.items():
|
||||||
|
try:
|
||||||
|
peer_remote = RustDeskPeer.objects.get(rid=v['remote_id'])
|
||||||
|
logs[k]['remote_alias'] = peer_remote.alias
|
||||||
|
except: # noqa
|
||||||
|
logs[k]['remote_alias'] = _('UNKNOWN')
|
||||||
|
try:
|
||||||
|
peer_user = RustDeskPeer.objects.get(rid=v['user_id'])
|
||||||
|
logs[k]['user_alias'] = peer_user.alias
|
||||||
|
except: # noqa
|
||||||
|
logs[k]['user_alias'] = _('UNKNOWN')
|
||||||
|
|
||||||
|
sorted_logs = sorted(logs.items(), key=lambda x: x[1]['logged_at'], reverse=True)
|
||||||
|
new_ordered_dict = {}
|
||||||
|
for key, alog in sorted_logs:
|
||||||
|
new_ordered_dict[key] = alog
|
||||||
|
|
||||||
|
return [v for k, v in new_ordered_dict.items()]
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/api/user_action?action=login')
|
||||||
|
def conn_log(request):
|
||||||
|
paginator = Paginator(get_conn_log(), 20)
|
||||||
|
page_number = request.GET.get('page')
|
||||||
|
page_obj = paginator.get_page(page_number)
|
||||||
|
return render(request, 'show_conn_log.html', {'page_obj': page_obj})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required(login_url='/api/user_action?action=login')
|
||||||
|
def file_log(request):
|
||||||
|
paginator = Paginator(get_file_log(), 20)
|
||||||
|
page_number = request.GET.get('page')
|
||||||
|
page_obj = paginator.get_page(page_number)
|
||||||
|
return render(request, 'show_file_log.html', {'page_obj': page_obj})
|
||||||
|
|||||||
BIN
db.sqlite3_bak
BIN
db.sqlite3_bak
Binary file not shown.
BIN
db/db.sqlite3
BIN
db/db.sqlite3
Binary file not shown.
BIN
images/compose_demo.png
Normal file
BIN
images/compose_demo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 459 KiB After Width: | Height: | Size: 343 KiB |
BIN
images/key_activate.png
Normal file
BIN
images/key_activate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
BIN
locale/en/LC_MESSAGES/django.mo
Normal file
BIN
locale/en/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
592
locale/en/LC_MESSAGES/django.po
Normal file
592
locale/en/LC_MESSAGES/django.po
Normal file
@ -0,0 +1,592 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2024-05-14 10:44+0800\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:14 .\api\front_locale.py:28
|
||||||
|
msgid "密码"
|
||||||
|
msgstr "Password"
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:15
|
||||||
|
msgid "再次输入密码"
|
||||||
|
msgstr "Re-enter password"
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:26
|
||||||
|
msgid "密码校验失败,两次密码不一致。"
|
||||||
|
msgstr "Password verification failed, passwords do not match."
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:44
|
||||||
|
msgid "密码Hash值"
|
||||||
|
msgstr "Password Hash Value"
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:75
|
||||||
|
msgid "基本信息"
|
||||||
|
msgstr "Basic Information"
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:100
|
||||||
|
msgid "RustDesk自建Web"
|
||||||
|
msgstr "RustDesk Self-Hosted Web"
|
||||||
|
|
||||||
|
#: .\api\admin_user.py:101
|
||||||
|
msgid "未定义"
|
||||||
|
msgstr "Undefined"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:4 .\api\templates\base.html:42
|
||||||
|
msgid "管理后台"
|
||||||
|
msgstr "Admin Panel"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:5
|
||||||
|
msgid "ID列表"
|
||||||
|
msgstr "ID List"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:6
|
||||||
|
msgid "分享机器"
|
||||||
|
msgstr "Share Machine"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:7
|
||||||
|
msgid "这么简易的东西,忘记密码这功能就没必要了吧。"
|
||||||
|
msgstr ""
|
||||||
|
"For such a simple thing, the forgot password feature is unnecessary, right?"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:8
|
||||||
|
msgid "立即注册"
|
||||||
|
msgstr "Register Now"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:9
|
||||||
|
msgid "创建时间"
|
||||||
|
msgstr "Creation Time"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:10
|
||||||
|
msgid "注册成功,请前往登录页登录。"
|
||||||
|
msgstr "Registration successful, please go to the login page to login."
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:11
|
||||||
|
msgid "注册日期"
|
||||||
|
msgstr "Registration Date"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:12
|
||||||
|
msgid ""
|
||||||
|
"2、所分享的机器,被分享人享有相同的权限,如果机器设置了保存密码,被分享人也可"
|
||||||
|
"以直接连接。"
|
||||||
|
msgstr ""
|
||||||
|
"2. The shared machine grants the same permissions to the recipient. If the "
|
||||||
|
"machine is set to save password, the recipient can also connect directly."
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:13
|
||||||
|
msgid "导出xlsx"
|
||||||
|
msgstr "Export as xlsx"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:14
|
||||||
|
msgid "生成分享链接"
|
||||||
|
msgstr "Generate Share Link"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:15
|
||||||
|
msgid "请输入8~20位密码。可以包含字母、数字和特殊字符。"
|
||||||
|
msgstr ""
|
||||||
|
"Please enter a password of 8~20 characters. It can contain letters, numbers, "
|
||||||
|
"and special characters."
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:16
|
||||||
|
msgid "尾页"
|
||||||
|
msgstr "Last Page"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:17
|
||||||
|
msgid "请确认密码"
|
||||||
|
msgstr "Please confirm password"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:18
|
||||||
|
msgid "注册"
|
||||||
|
msgstr "Register"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:19 .\api\models_work.py:73
|
||||||
|
msgid "内存"
|
||||||
|
msgstr "Memory"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:20 .\api\templates\base.html:31
|
||||||
|
msgid "首页"
|
||||||
|
msgstr "Home"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:21 .\api\templates\base.html:37
|
||||||
|
msgid "网页控制"
|
||||||
|
msgstr "Web Control"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:22
|
||||||
|
msgid "注册时间"
|
||||||
|
msgstr "Registration Time"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:23
|
||||||
|
msgid "链接地址"
|
||||||
|
msgstr "Link Address"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:24
|
||||||
|
msgid "请输入密码"
|
||||||
|
msgstr "Please enter password"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:25 .\api\models_work.py:50 .\api\models_work.py:76
|
||||||
|
msgid "系统用户名"
|
||||||
|
msgstr "System Username"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:26
|
||||||
|
msgid "状态"
|
||||||
|
msgstr "Status"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:27
|
||||||
|
msgid "已有账号?立即登录"
|
||||||
|
msgstr "Already have an account? Login now"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:29 .\api\models_work.py:52
|
||||||
|
msgid "别名"
|
||||||
|
msgstr "Alias"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:30
|
||||||
|
msgid "上一页"
|
||||||
|
msgstr "Previous Page"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:31
|
||||||
|
msgid "更新时间"
|
||||||
|
msgstr "Update Time"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:32
|
||||||
|
msgid "综合屏"
|
||||||
|
msgstr "Comprehensive Screen"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:33 .\api\models_work.py:53
|
||||||
|
msgid "平台"
|
||||||
|
msgstr "Platform"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:34
|
||||||
|
msgid "全部用户"
|
||||||
|
msgstr "All Users"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:35
|
||||||
|
msgid "注册页"
|
||||||
|
msgstr "Registration Page"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:36
|
||||||
|
msgid "分享机器给其他用户"
|
||||||
|
msgstr "Share machine with other users"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:37 .\api\templates\base.html:33
|
||||||
|
msgid "所有设备"
|
||||||
|
msgstr "All Devices"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:38
|
||||||
|
msgid "连接密码"
|
||||||
|
msgstr "Connection Password"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:39
|
||||||
|
msgid "设备统计"
|
||||||
|
msgstr "Device Statistics"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:40
|
||||||
|
msgid "所属用户"
|
||||||
|
msgstr "Belongs to User"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:41 .\api\templates\base.html:36
|
||||||
|
msgid "分享"
|
||||||
|
msgstr "Share"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:42
|
||||||
|
msgid "请输入用户名"
|
||||||
|
msgstr "Please enter username"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:43
|
||||||
|
msgid "1、链接有效期为15分钟,切勿随意分享给他人。"
|
||||||
|
msgstr ""
|
||||||
|
"1. The link is valid for 15 minutes. Do not share it with others casually."
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:44
|
||||||
|
msgid "CPU"
|
||||||
|
msgstr "CPU"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:45 .\api\models_work.py:49 .\api\models_work.py:70
|
||||||
|
msgid "客户端ID"
|
||||||
|
msgstr "Client ID"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:46
|
||||||
|
msgid "下一页"
|
||||||
|
msgstr "Next Page"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:47
|
||||||
|
msgid "登录"
|
||||||
|
msgstr "Login"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:48 .\api\templates\base.html:45
|
||||||
|
msgid "退出"
|
||||||
|
msgstr "Logout"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:49
|
||||||
|
msgid "请将要分享的机器调整到右侧"
|
||||||
|
msgstr "Please adjust the machines to be shared to the right"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:50
|
||||||
|
msgid "成功!如需分享,请复制以下链接给其他人:<br>"
|
||||||
|
msgstr ""
|
||||||
|
"Success! If you need to share, please copy the following link to others:<br>"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:51
|
||||||
|
msgid "忘记密码?"
|
||||||
|
msgstr "Forgot Password?"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:52
|
||||||
|
msgid "计算机名"
|
||||||
|
msgstr "Computer Name"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:53
|
||||||
|
msgid "两次输入密码不一致!"
|
||||||
|
msgstr "Passwords do not match!"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:54
|
||||||
|
msgid "页码"
|
||||||
|
msgstr "Page Number"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:55
|
||||||
|
msgid "版本"
|
||||||
|
msgstr "Version"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:56 .\api\models_user.py:32 .\api\models_work.py:9
|
||||||
|
msgid "用户名"
|
||||||
|
msgstr "Username"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:57
|
||||||
|
msgid ""
|
||||||
|
"3、为保障安全,链接有效期为15分钟、链接仅有效1次。链接一旦被(非分享人的登录"
|
||||||
|
"用户)访问,分享生效,后续访问链接失效。"
|
||||||
|
msgstr ""
|
||||||
|
"3. For security reasons, the link is valid for 15 minutes and only valid "
|
||||||
|
"once. Once the link is accessed by a user (other than the sharing person), "
|
||||||
|
"the sharing becomes effective, and subsequent access to the link will be "
|
||||||
|
"invalid."
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:58
|
||||||
|
msgid "系统"
|
||||||
|
msgstr "System"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:59
|
||||||
|
msgid "我的机器"
|
||||||
|
msgstr "My Machine"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:60
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "基本信息"
|
||||||
|
msgid "信息"
|
||||||
|
msgstr "Basic Information"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:61
|
||||||
|
msgid "远程ID"
|
||||||
|
msgstr "Remote ID"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:62
|
||||||
|
msgid "远程别名"
|
||||||
|
msgstr "Remote Alias"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:63 .\api\models_work.py:11 .\api\models_work.py:48
|
||||||
|
#: .\api\models_work.py:126
|
||||||
|
msgid "用户ID"
|
||||||
|
msgstr "User ID"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:64
|
||||||
|
msgid "用户别名"
|
||||||
|
msgstr "User Alias"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:65
|
||||||
|
msgid "用户IP"
|
||||||
|
msgstr "User IP"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:66
|
||||||
|
msgid "文件大小"
|
||||||
|
msgstr "Filesize"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:67
|
||||||
|
msgid "发送/接受"
|
||||||
|
msgstr "Sent/Received"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:68
|
||||||
|
msgid "记录于"
|
||||||
|
msgstr "Logged At"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:69
|
||||||
|
msgid "连接开始时间"
|
||||||
|
msgstr "Connection Start Time\t"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:70
|
||||||
|
msgid "连接结束时间"
|
||||||
|
msgstr "Connection End Time"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:71
|
||||||
|
msgid "时长"
|
||||||
|
msgstr "Duration"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:72 .\api\templates\base.html:40
|
||||||
|
msgid "连接日志"
|
||||||
|
msgstr "Connection Log"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:73 .\api\templates\base.html:41
|
||||||
|
msgid "文件传输日志"
|
||||||
|
msgstr "File Transfer Log"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:74
|
||||||
|
msgid "页码 #"
|
||||||
|
msgstr "Page #"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:75
|
||||||
|
msgid "下一页 #"
|
||||||
|
msgstr "Next #"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:76
|
||||||
|
msgid "上一页 #"
|
||||||
|
msgstr "Previous #"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:77
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "上一页"
|
||||||
|
msgid "第一页"
|
||||||
|
msgstr "First"
|
||||||
|
|
||||||
|
#: .\api\front_locale.py:78
|
||||||
|
#, fuzzy
|
||||||
|
#| msgid "上一页"
|
||||||
|
msgid "上页"
|
||||||
|
msgstr "Previous Page"
|
||||||
|
|
||||||
|
#: .\api\models_user.py:40
|
||||||
|
msgid "登录信息:"
|
||||||
|
msgstr "Login Information:"
|
||||||
|
|
||||||
|
#: .\api\models_user.py:42
|
||||||
|
msgid "是否激活"
|
||||||
|
msgstr "Is Active"
|
||||||
|
|
||||||
|
#: .\api\models_user.py:43
|
||||||
|
msgid "是否管理员"
|
||||||
|
msgstr "Is Administrator"
|
||||||
|
|
||||||
|
#: .\api\models_user.py:82
|
||||||
|
msgid "用户"
|
||||||
|
msgstr "User"
|
||||||
|
|
||||||
|
#: .\api\models_user.py:83
|
||||||
|
msgid "用户列表"
|
||||||
|
msgstr "User List"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:10
|
||||||
|
msgid "RustDesk ID"
|
||||||
|
msgstr "RustDesk ID"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:12
|
||||||
|
msgid "uuid"
|
||||||
|
msgstr "UUID"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:13
|
||||||
|
msgid "access_token"
|
||||||
|
msgstr "Access Token"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:14
|
||||||
|
msgid "登录时间"
|
||||||
|
msgstr "Login Time"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:19
|
||||||
|
msgid "Token列表"
|
||||||
|
msgstr "Token List"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:30
|
||||||
|
msgid "所属用户ID"
|
||||||
|
msgstr "Belongs to User ID"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:31
|
||||||
|
msgid "标签名称"
|
||||||
|
msgstr "Tag Name"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:32
|
||||||
|
msgid "标签颜色"
|
||||||
|
msgstr "Tag Color"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:37
|
||||||
|
msgid "Tags列表"
|
||||||
|
msgstr "Tags List"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:51
|
||||||
|
msgid "操作系统名"
|
||||||
|
msgstr "Operating System Name"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:54
|
||||||
|
msgid "标签"
|
||||||
|
msgstr "Tag"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:55
|
||||||
|
msgid "设备链接密码"
|
||||||
|
msgstr "Device Connection Password"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:60
|
||||||
|
msgid "Peers列表"
|
||||||
|
msgstr "Peers List"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:72
|
||||||
|
msgid "主机名"
|
||||||
|
msgstr "Hostname"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:74
|
||||||
|
msgid "操作系统"
|
||||||
|
msgstr "Operating System"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:77
|
||||||
|
msgid "客户端版本"
|
||||||
|
msgstr "Client Version"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:78
|
||||||
|
msgid "设备注册时间"
|
||||||
|
msgstr "Device Registration Time"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:83
|
||||||
|
msgid "设备"
|
||||||
|
msgstr "Device"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:84
|
||||||
|
msgid "设备列表"
|
||||||
|
msgstr "Device List"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:127
|
||||||
|
msgid "链接Key"
|
||||||
|
msgstr "Link Key"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:128
|
||||||
|
msgid "机器ID列表"
|
||||||
|
msgstr "Machine ID List"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:129
|
||||||
|
msgid "是否使用"
|
||||||
|
msgstr "Is Used"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:130
|
||||||
|
msgid "是否过期"
|
||||||
|
msgstr "Is Expired"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:131
|
||||||
|
msgid "生成时间"
|
||||||
|
msgstr "Generation Time"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:137
|
||||||
|
msgid "分享链接"
|
||||||
|
msgstr "Share Link"
|
||||||
|
|
||||||
|
#: .\api\models_work.py:138
|
||||||
|
msgid "链接列表"
|
||||||
|
msgstr "Link List"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:20
|
||||||
|
msgid "请求方式错误!请使用POST方式。"
|
||||||
|
msgstr "Request method error! Please use the POST method."
|
||||||
|
|
||||||
|
#: .\api\views_api.py:34
|
||||||
|
msgid "帐号或密码错误!请重试,多次重试后将被锁定IP!"
|
||||||
|
msgstr ""
|
||||||
|
"Account or password error! Please retry. After multiple retries, the IP will "
|
||||||
|
"be locked!"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:72
|
||||||
|
msgid "请求方式错误!"
|
||||||
|
msgstr "Request method error!"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:80
|
||||||
|
msgid "异常请求!"
|
||||||
|
msgstr "Abnormal request!"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:93 .\api\views_api.py:213
|
||||||
|
msgid "错误的提交方式!"
|
||||||
|
msgstr "Incorrect submission method!"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:121
|
||||||
|
msgid "拉取列表错误!"
|
||||||
|
msgstr "Error fetching list!"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:200
|
||||||
|
msgid "更新地址簿有误"
|
||||||
|
msgstr "Error updating address book"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:247 .\api\views_front.py:207 .\api\views_front.py:226
|
||||||
|
msgid "在线"
|
||||||
|
msgstr "Online"
|
||||||
|
|
||||||
|
#: .\api\views_api.py:308
|
||||||
|
msgid "好的"
|
||||||
|
msgstr "Okay"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:50
|
||||||
|
msgid "model_to_dict接收的参数必须是模型对象"
|
||||||
|
msgstr "The parameter received by model_to_dict must be a model object"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:55
|
||||||
|
#, python-brace-format
|
||||||
|
msgid "model_to_dict,要替换成{replace_field}字段已经存在了"
|
||||||
|
msgstr ""
|
||||||
|
"model_to_dict, the field to be replaced with {replace_field} already exists"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:60
|
||||||
|
#, python-brace-format
|
||||||
|
msgid "model_to_dict,要新增默认值,但字段{default_key}已经存在了"
|
||||||
|
msgstr ""
|
||||||
|
"model_to_dict, to add default values, but the field {default_key} already "
|
||||||
|
"exists"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:134
|
||||||
|
msgid "出了点问题,未获取用户名或密码。"
|
||||||
|
msgstr "There was a problem, username or password not obtained."
|
||||||
|
|
||||||
|
#: .\api\views_front.py:141
|
||||||
|
msgid "帐号或密码错误!"
|
||||||
|
msgstr "Account or password error!"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:153
|
||||||
|
msgid "当前未开放注册,请联系管理员!"
|
||||||
|
msgstr "Registration is currently not open, please contact the administrator!"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:160
|
||||||
|
msgid "用户名不得小于3位"
|
||||||
|
msgstr "Username must be at least 3 characters"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:165
|
||||||
|
msgid "密码长度不符合要求, 应在8~20位。"
|
||||||
|
msgstr ""
|
||||||
|
"Password length does not meet requirements, should be between 8~20 "
|
||||||
|
"characters."
|
||||||
|
|
||||||
|
#: .\api\views_front.py:171
|
||||||
|
msgid "用户名已存在。"
|
||||||
|
msgstr "Username already exists."
|
||||||
|
|
||||||
|
#: .\api\views_front.py:207 .\api\views_front.py:226
|
||||||
|
msgid "离线"
|
||||||
|
msgstr "Offline"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:210
|
||||||
|
msgid "是"
|
||||||
|
msgstr "Yes"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:210
|
||||||
|
msgid "否"
|
||||||
|
msgstr "No"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:252
|
||||||
|
msgid "设备信息表"
|
||||||
|
msgstr "Device Information Table"
|
||||||
|
|
||||||
|
#: .\api\views_front.py:351
|
||||||
|
msgid "数据为空。"
|
||||||
|
msgstr "Data is empty."
|
||||||
|
|
||||||
|
#: .\api\views_front.py:373 .\api\views_front.py:378 .\api\views_front.py:409
|
||||||
|
#: .\api\views_front.py:414
|
||||||
|
msgid "UNKNOWN"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#~ msgid "未知"
|
||||||
|
#~ msgstr "UNKNOWN"
|
||||||
@ -1 +1,3 @@
|
|||||||
django
|
django
|
||||||
|
xlwt
|
||||||
|
mysqlclient
|
||||||
2
run.sh
2
run.sh
@ -7,4 +7,6 @@ if [ ! -e "./db/db.sqlite3" ]; then
|
|||||||
echo "首次运行,初始化数据库"
|
echo "首次运行,初始化数据库"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
python manage.py makemigrations
|
||||||
|
python manage.py migrate
|
||||||
python manage.py runserver $HOST:21114;
|
python manage.py runserver $HOST:21114;
|
||||||
|
|||||||
@ -30,7 +30,23 @@ ID_SERVER = os.environ.get("ID_SERVER", '')
|
|||||||
DEBUG = os.environ.get("DEBUG", False)
|
DEBUG = os.environ.get("DEBUG", False)
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||||
ALLOWED_HOSTS = ["*"]
|
ALLOWED_HOSTS = ["*"]
|
||||||
AUTH_USER_MODEL = 'api.UserProfile' #AppName.自定义user
|
AUTH_USER_MODEL = 'api.UserProfile' # AppName.自定义user
|
||||||
|
|
||||||
|
ALLOW_REGISTRATION = os.environ.get("ALLOW_REGISTRATION", "True") # 是否允许注册, True为允许,False为不允许
|
||||||
|
ALLOW_REGISTRATION = True if ALLOW_REGISTRATION.lower() == 'true' else False
|
||||||
|
|
||||||
|
|
||||||
|
# ==========数据库配置 开始=====================
|
||||||
|
DATABASE_TYPE = os.environ.get("DATABASE_TYPE", 'SQLITE')
|
||||||
|
MYSQL_DBNAME = os.environ.get("MYSQL_DBNAME", '-')
|
||||||
|
MYSQL_HOST = os.environ.get("MYSQL_HOST", '127.0.0.1')
|
||||||
|
MYSQL_USER = os.environ.get("MYSQL_USER", '-')
|
||||||
|
MYSQL_PASSWORD = os.environ.get("MYSQL_PASSWORD", '-')
|
||||||
|
MYSQL_PORT = os.environ.get("MYSQL_PORT", '3306')
|
||||||
|
# ==========数据库配置 结束=====================
|
||||||
|
|
||||||
|
LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", 'zh-hans')
|
||||||
|
# #LANGUAGE_CODE = os.environ.get("LANGUAGE_CODE", 'en')
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
@ -48,8 +64,9 @@ INSTALLED_APPS = [
|
|||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
#'django.middleware.csrf.CsrfViewMiddleware', # 取消post的验证。
|
# 'django.middleware.csrf.CsrfViewMiddleware', # 取消post的验证。
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
@ -80,13 +97,26 @@ WSGI_APPLICATION = 'rustdesk_server_api.wsgi.application'
|
|||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
||||||
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': BASE_DIR / 'db/db.sqlite3',
|
'NAME': BASE_DIR / 'db/db.sqlite3',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if DATABASE_TYPE == 'MYSQL' and MYSQL_DBNAME != '-' and MYSQL_USER != '-' and MYSQL_PASSWORD != '-':
|
||||||
|
# 简单通过数据库名、账密信息过滤下,防止用户未配置mysql却使用mysql
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
'NAME': MYSQL_DBNAME, # 数据库名
|
||||||
|
'HOST': MYSQL_HOST, # 数据库服务器IP
|
||||||
|
'USER': MYSQL_USER, # 数据库用户名
|
||||||
|
'PASSWORD': MYSQL_PASSWORD, # 数据库密码
|
||||||
|
'PORT': MYSQL_PORT, # 端口
|
||||||
|
'OPTIONS': {'charset': 'utf8'},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
|
||||||
@ -110,14 +140,15 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/3.1/topics/i18n/
|
# https://docs.djangoproject.com/en/3.1/topics/i18n/
|
||||||
|
|
||||||
LANGUAGE_CODE = 'zh-hans'
|
# LANGUAGE_CODE = 'zh-hans'
|
||||||
|
|
||||||
TIME_ZONE = 'Asia/Shanghai'
|
TIME_ZONE = 'Asia/Shanghai'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
USE_L10N = True
|
USE_L10N = True
|
||||||
|
|
||||||
#USE_TZ = True
|
# USE_TZ = True
|
||||||
USE_TZ = False
|
USE_TZ = False
|
||||||
|
|
||||||
|
|
||||||
@ -130,6 +161,14 @@ if DEBUG:
|
|||||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
|
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
||||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 新增
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 新增
|
||||||
|
|
||||||
|
LANGUAGES = (
|
||||||
|
('zh-hans', '中文简体'),
|
||||||
|
('en', 'English'),
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
LOCALE_PATHS = (
|
||||||
|
os.path.join(BASE_DIR, 'locale'),
|
||||||
|
)
|
||||||
|
|||||||
@ -25,7 +25,10 @@ else:
|
|||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.views import static ##新增
|
from django.views import static ##新增
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path('i18n/', include('django.conf.urls.i18n')),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
url(r'^$', index),
|
url(r'^$', index),
|
||||||
url(r'^api/', include('api.urls')),
|
url(r'^api/', include('api.urls')),
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
65
tutorial/sqlite2mysql.md
Normal file
65
tutorial/sqlite2mysql.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# 默认数据库(sqlite3)转Mysql数据库保姆级教程
|
||||||
|
|
||||||
|
### 本教程尽量保持源码安装与docker安装的通用性。
|
||||||
|
|
||||||
|
1、源码安装(如果采用源码安装的跳过1、2步骤)
|
||||||
|
```
|
||||||
|
# 将代码克隆到本地
|
||||||
|
git clone https://github.com/kingmo888/rustdesk-api-server.git
|
||||||
|
# 进入目录
|
||||||
|
cd rustdesk-api-server
|
||||||
|
# 安装依赖
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
2、覆盖数据库
|
||||||
|
|
||||||
|
全新安装时数据库为默认数据库,请将你正在使用的数据库覆盖到`/db/db.sqlite3`
|
||||||
|
|
||||||
|
3、 从sqlite数据库备份数据
|
||||||
|
|
||||||
|
执行命令:`python manage.py dumpdata > data.json`,将数据导出到根目录下的`data.json`中。
|
||||||
|
|
||||||
|
4、修改数据库配置
|
||||||
|
|
||||||
|
假设新建的mysql空数据库的信息如下:
|
||||||
|
|
||||||
|
| 信息 | 值 |
|
||||||
|
| ------- | ------- |
|
||||||
|
| 数据库服务器IP | 192.168.1.33 |
|
||||||
|
| 数据库名 | rustdesk_api |
|
||||||
|
| 数据库用户名 | myuser |
|
||||||
|
| 数据库密码 | 123456 |
|
||||||
|
| 数据库端口 | 3099 |
|
||||||
|
|
||||||
|
|
||||||
|
在文件`rustdesk_server_api/settings.py`中依次修改如下配置:
|
||||||
|
|
||||||
|
- (1) `DATABASE_TYPE = os.environ.get("DATABASE_TYPE", 'SQLITE')`改为`DATABASE_TYPE = os.environ.get("DATABASE_TYPE", 'MYSQL')`
|
||||||
|
- (2) `MYSQL_HOST = os.environ.get("MYSQL_HOST", '127.0.0.1')`改为`MYSQL_HOST = os.environ.get("MYSQL_HOST", '192.168.1.33')`
|
||||||
|
- (3) `MYSQL_DBNAME = os.environ.get("MYSQL_DBNAME", '-')`改为`MYSQL_DBNAME = os.environ.get("MYSQL_DBNAME", 'rustdesk_api')`
|
||||||
|
- (4) `MYSQL_USER = os.environ.get("MYSQL_USER", '-')`改为`MYSQL_USER = os.environ.get("MYSQL_USER", 'myuser')`
|
||||||
|
- (5) `MYSQL_PASSWORD = os.environ.get("MYSQL_PASSWORD", '-')`改为`MYSQL_PASSWORD = os.environ.get("MYSQL_PASSWORD", '123456')`
|
||||||
|
- (6) `MYSQL_PORT = os.environ.get("MYSQL_PORT", '3306')`改为`MYSQL_PORT = os.environ.get("MYSQL_PORT", '3099')`
|
||||||
|
|
||||||
|
5、使用命令在mysql中创建表
|
||||||
|
|
||||||
|
`python manage.py makemigrations`
|
||||||
|
|
||||||
|
`python manage.py migrate`
|
||||||
|
|
||||||
|
通过mysql数据库管理工具查看数据库表:`django_content_type`, `auth_permission`,如果存在数据,需要将这两个标清空,否则导入备份数据时会出错(提示重复导入数据)。
|
||||||
|
|
||||||
|
6、将备份数据导入mysql
|
||||||
|
|
||||||
|
执行`python manage.py loaddata data.json`
|
||||||
|
|
||||||
|
在加载数据的过程中,最有可能的报错是提示导出的数据文件data.json中编码不是utf-8,需要把data.json文件转为utf-8格式,然后在加载数据到mysql中。
|
||||||
|
|
||||||
|
还有可能会提示其他原数据有问题导致的报错,根据报错提示查看原数据的问题。修改之后再次从sqlite3导出数据,然后导入数据。
|
||||||
|
|
||||||
|
|
||||||
|
7、docker使用
|
||||||
|
|
||||||
|
如果mysql数据库已经配置好,则只需要将环境变量中mysql的部分按要求修改,重启即可。
|
||||||
|
如果未配置mysql数据库,则将`步骤6`中已经配置好的mysql数据库导出,并在你需要的指定位置新建并还原,然后将环境变量中mysql的部分按要求修改,重启即可。
|
||||||
1
version.py
Normal file
1
version.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
APP_VERSION = 'v3.3.16'
|
||||||
Loading…
Reference in New Issue
Block a user