Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangerlach committed Mar 28, 2024
2 parents 26685f6 + acf11d5 commit 616ed3b
Show file tree
Hide file tree
Showing 26 changed files with 1,340 additions and 166 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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]: "
labels: ["bug"]

Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ dist_py38

LICENSE.rst

db/test_db.sqlite3
db/test_db.sqlite3
job2en.py

新建文本文档.txt
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# rustdesk-api-server

## 如果项目有帮到你,给个star不过分吧?

## 请使用客户端最新版本1.2.3

[The English explanation is available by clicking here.](https://github.com/kingmo888/rustdesk-api-server/blob/master/README_EN.md)

<p align="center">
<i>一个 python 实现的 Rustdesk API 接口,支持 WebUI 管理</i>
<br/>
<img src ="https://img.shields.io/badge/Version-1.4.8-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/Version-1.4.9-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/Django-3.2+|4.x-yelow.svg" />
<br/>
Expand Down Expand Up @@ -142,6 +140,7 @@ services:
| `MYSQL_PASSWORD` | 可选,默认 `-` | MYSQL数据库的密码 |
| `MYSQL_PORT` | 可选,默认 `3306` | MYSQL数据库端口 |
| 数据库配置 | -- 结束 -- | 查看【[sqlite3迁移mysql教程](/tutorial/sqlite2mysql.md)】 |
| `LANGUAGE_CODE` | 可选,默认 `zh-hans` | 语言,支持中文(`zh-hans`)、英语(`en`) |

## 使用问题

Expand Down
16 changes: 8 additions & 8 deletions api/admin_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField

from django.utils.translation import gettext as _


class UserCreationForm(forms.ModelForm):
"""A form for creating new users. Includes all the required
fields, plus a repeated password."""
password1 = forms.CharField(label='password', widget=forms.PasswordInput)
password2 = forms.CharField(label='Enter the password again', widget=forms.PasswordInput)
password1 = forms.CharField(label=_('密码'), widget=forms.PasswordInput)
password2 = forms.CharField(label=_('再次输入密码'), widget=forms.PasswordInput)

class Meta:
model = models.UserProfile
Expand All @@ -23,7 +23,7 @@ def clean_password2(self):
password1 = self.cleaned_data.get("password1")
password2 = self.cleaned_data.get("password2")
if password1 and password2 and password1 != password2:
raise forms.ValidationError("The password verification failed, and the passwords were inconsistent.")
raise forms.ValidationError(_("密码校验失败,两次密码不一致。"))
return password2


Expand All @@ -41,7 +41,7 @@ class UserChangeForm(forms.ModelForm):
the user, but replaces the password field with admin's
password hash display field.
"""
password = ReadOnlyPasswordHashField(label=("Password HASH value"), help_text=("<a href=\"../password/\">Click to modify the password</a>."))
password = ReadOnlyPasswordHashField(label=(_("密码Hash值")), help_text=("<a href=\"../password/\">点击修改密码</a>."))
class Meta:
model = models.UserProfile
fields = ('username', 'is_active', 'is_admin')
Expand Down Expand Up @@ -72,7 +72,7 @@ class UserAdmin(BaseUserAdmin):
list_display = ('username', 'rid')
list_filter = ('is_admin', 'is_active')
fieldsets = (
('Basic Information', {'fields': ('username', 'password', 'is_active', 'is_admin', 'rid', 'uuid', 'deviceInfo',)}),
(_('基本信息'), {'fields': ('username', 'password', 'is_active', 'is_admin', 'rid', 'uuid', 'deviceInfo',)}),

)
readonly_fields = ( 'rid', 'uuid')
Expand All @@ -95,5 +95,5 @@ class UserAdmin(BaseUserAdmin):
admin.site.register(models.RustDesDevice, models.RustDesDeviceAdmin)
admin.site.register(models.ShareLink, models.ShareLinkAdmin)
admin.site.unregister(Group)
admin.site.site_header = 'RustDesk Self -built Web'
admin.site.site_title = 'Undefined'
admin.site.site_header = _('RustDesk自建Web')
admin.site.site_title = _('未定义')
60 changes: 60 additions & 0 deletions api/front_locale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from django.utils.translation import gettext as _


_('管理后台')
_('ID列表')
_('分享机器')
_('这么简易的东西,忘记密码这功能就没必要了吧。')
_('立即注册')
_('创建时间')
_('注册成功,请前往登录页登录。')
_('注册日期')
_('2、所分享的机器,被分享人享有相同的权限,如果机器设置了保存密码,被分享人也可以直接连接。')
_('导出xlsx')
_('生成分享链接')
_('请输入8~20位密码。可以包含字母、数字和特殊字符。')
_('尾页')
_('请确认密码')
_('注册')
_('内存')
_('首页')
_('网页控制')
_('注册时间')
_('链接地址')
_('请输入密码')
_('系统用户名')
_('状态')
_('已有账号?立即登录')
_('密码')
_('别名')
_('上一页')
_('更新时间')
_('综合屏')
_('平台')
_('全部用户')
_('注册页')
_('分享机器给其他用户')
_('所有设备')
_('连接密码')
_('设备统计')
_('所属用户')
_('分享')
_('请输入用户名')
_('1、链接有效期为15分钟,切勿随意分享给他人。')
_('CPU')
_('客户端ID')
_('下一页')
_('登录')
_('退出')
_('请将要分享的机器调整到右侧')
_('成功!如需分享,请复制以下链接给其他人:<br>')
_('忘记密码?')
_('计算机名')
_('两次输入密码不一致!')
_('页码')
_('版本')
_('用户名')
_('3、为保障安全,链接有效期为15分钟、链接仅有效1次。链接一旦被(非分享人的登录用户)访问,分享生效,后续访问链接失效。')
_('系统')
_('我的机器')
_('信息')
Loading

0 comments on commit 616ed3b

Please sign in to comment.