mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 07:10:09 +01:00
Translating to zh-cn is done
This commit is contained in:
parent
c269e46892
commit
21672f99d1
@ -1599,13 +1599,10 @@ def API_addWireguardConfiguration():
|
|||||||
@app.route(f'{APP_PREFIX}/api/toggleWireguardConfiguration/')
|
@app.route(f'{APP_PREFIX}/api/toggleWireguardConfiguration/')
|
||||||
def API_toggleWireguardConfiguration():
|
def API_toggleWireguardConfiguration():
|
||||||
configurationName = request.args.get('configurationName')
|
configurationName = request.args.get('configurationName')
|
||||||
|
|
||||||
if configurationName is None or len(
|
if configurationName is None or len(
|
||||||
configurationName) == 0 or configurationName not in WireguardConfigurations.keys():
|
configurationName) == 0 or configurationName not in WireguardConfigurations.keys():
|
||||||
return ResponseObject(False, "Please provide a valid configuration name")
|
return ResponseObject(False, "Please provide a valid configuration name")
|
||||||
|
|
||||||
toggleStatus, msg = WireguardConfigurations[configurationName].toggleConfiguration()
|
toggleStatus, msg = WireguardConfigurations[configurationName].toggleConfiguration()
|
||||||
|
|
||||||
return ResponseObject(toggleStatus, msg, WireguardConfigurations[configurationName].Status)
|
return ResponseObject(toggleStatus, msg, WireguardConfigurations[configurationName].Status)
|
||||||
|
|
||||||
|
|
||||||
@ -1638,7 +1635,7 @@ def API_updateDashboardConfigurationItem():
|
|||||||
def API_getDashboardAPIKeys():
|
def API_getDashboardAPIKeys():
|
||||||
if DashboardConfig.GetConfig('Server', 'dashboard_api_key'):
|
if DashboardConfig.GetConfig('Server', 'dashboard_api_key'):
|
||||||
return ResponseObject(data=DashboardConfig.DashboardAPIKeys)
|
return ResponseObject(data=DashboardConfig.DashboardAPIKeys)
|
||||||
return ResponseObject(False, "Dashboard API Keys function is disabled")
|
return ResponseObject(False, "WGDashboard API Keys function is disabled")
|
||||||
|
|
||||||
@app.route(f'{APP_PREFIX}/api/newDashboardAPIKey', methods=['POST'])
|
@app.route(f'{APP_PREFIX}/api/newDashboardAPIKey', methods=['POST'])
|
||||||
def API_newDashboardAPIKey():
|
def API_newDashboardAPIKey():
|
||||||
@ -1704,7 +1701,7 @@ def API_deletePeers(configName: str) -> ResponseObject:
|
|||||||
peers = data['peers']
|
peers = data['peers']
|
||||||
if configName in WireguardConfigurations.keys():
|
if configName in WireguardConfigurations.keys():
|
||||||
if len(peers) == 0:
|
if len(peers) == 0:
|
||||||
return ResponseObject(False, "Please specify more than one peer")
|
return ResponseObject(False, "Please specify one or more peers")
|
||||||
configuration = WireguardConfigurations.get(configName)
|
configuration = WireguardConfigurations.get(configName)
|
||||||
return configuration.deletePeers(peers)
|
return configuration.deletePeers(peers)
|
||||||
|
|
||||||
@ -1717,7 +1714,7 @@ def API_restrictPeers(configName: str) -> ResponseObject:
|
|||||||
peers = data['peers']
|
peers = data['peers']
|
||||||
if configName in WireguardConfigurations.keys():
|
if configName in WireguardConfigurations.keys():
|
||||||
if len(peers) == 0:
|
if len(peers) == 0:
|
||||||
return ResponseObject(False, "Please specify more than one peer")
|
return ResponseObject(False, "Please specify one or more peers")
|
||||||
configuration = WireguardConfigurations.get(configName)
|
configuration = WireguardConfigurations.get(configName)
|
||||||
return configuration.restrictPeers(peers)
|
return configuration.restrictPeers(peers)
|
||||||
return ResponseObject(False, "Configuration does not exist")
|
return ResponseObject(False, "Configuration does not exist")
|
||||||
@ -1729,7 +1726,7 @@ def API_sharePeer_create():
|
|||||||
Peer = data.get('Peer')
|
Peer = data.get('Peer')
|
||||||
ExpireDate = data.get('ExpireDate')
|
ExpireDate = data.get('ExpireDate')
|
||||||
if Configuration is None or Peer is None:
|
if Configuration is None or Peer is None:
|
||||||
return ResponseObject(False, "Please specify configuration and peer")
|
return ResponseObject(False, "Please specify configuration and peers")
|
||||||
activeLink = AllPeerShareLinks.getLink(Configuration, Peer)
|
activeLink = AllPeerShareLinks.getLink(Configuration, Peer)
|
||||||
if len(activeLink) > 0:
|
if len(activeLink) > 0:
|
||||||
return ResponseObject(False, "This peer is already sharing, please stop sharing first.")
|
return ResponseObject(False, "This peer is already sharing, please stop sharing first.")
|
||||||
@ -1782,7 +1779,7 @@ def API_allowAccessPeers(configName: str) -> ResponseObject:
|
|||||||
peers = data['peers']
|
peers = data['peers']
|
||||||
if configName in WireguardConfigurations.keys():
|
if configName in WireguardConfigurations.keys():
|
||||||
if len(peers) == 0:
|
if len(peers) == 0:
|
||||||
return ResponseObject(False, "Please specify more than one peer")
|
return ResponseObject(False, "Please specify one or more peers")
|
||||||
configuration = WireguardConfigurations.get(configName)
|
configuration = WireguardConfigurations.get(configName)
|
||||||
return configuration.allowAccessPeers(peers)
|
return configuration.allowAccessPeers(peers)
|
||||||
return ResponseObject(False, "Configuration does not exist")
|
return ResponseObject(False, "Configuration does not exist")
|
||||||
@ -1865,18 +1862,18 @@ def API_addPeers(configName):
|
|||||||
def API_downloadPeer(configName):
|
def API_downloadPeer(configName):
|
||||||
data = request.args
|
data = request.args
|
||||||
if configName not in WireguardConfigurations.keys():
|
if configName not in WireguardConfigurations.keys():
|
||||||
return ResponseObject(False, "Configuration or peer does not exist")
|
return ResponseObject(False, "Configuration does not exist")
|
||||||
configuration = WireguardConfigurations[configName]
|
configuration = WireguardConfigurations[configName]
|
||||||
peerFound, peer = configuration.searchPeer(data['id'])
|
peerFound, peer = configuration.searchPeer(data['id'])
|
||||||
if len(data['id']) == 0 or not peerFound:
|
if len(data['id']) == 0 or not peerFound:
|
||||||
return ResponseObject(False, "Configuration or peer does not exist")
|
return ResponseObject(False, "Peer does not exist")
|
||||||
return ResponseObject(data=peer.downloadPeer())
|
return ResponseObject(data=peer.downloadPeer())
|
||||||
|
|
||||||
|
|
||||||
@app.route(f"{APP_PREFIX}/api/downloadAllPeers/<configName>")
|
@app.route(f"{APP_PREFIX}/api/downloadAllPeers/<configName>")
|
||||||
def API_downloadAllPeers(configName):
|
def API_downloadAllPeers(configName):
|
||||||
if configName not in WireguardConfigurations.keys():
|
if configName not in WireguardConfigurations.keys():
|
||||||
return ResponseObject(False, "Configuration or peer does not exist")
|
return ResponseObject(False, "Configuration does not exist")
|
||||||
configuration = WireguardConfigurations[configName]
|
configuration = WireguardConfigurations[configName]
|
||||||
peerData = []
|
peerData = []
|
||||||
untitledPeer = 0
|
untitledPeer = 0
|
||||||
@ -1927,7 +1924,7 @@ def API_savePeerScheduleJob():
|
|||||||
configuration = WireguardConfigurations.get(job['Configuration'])
|
configuration = WireguardConfigurations.get(job['Configuration'])
|
||||||
f, fp = configuration.searchPeer(job['Peer'])
|
f, fp = configuration.searchPeer(job['Peer'])
|
||||||
if not f:
|
if not f:
|
||||||
return ResponseObject(False, "Peer does not exist in this configuration")
|
return ResponseObject(False, "Peer does not exist")
|
||||||
|
|
||||||
s, p = AllPeerJobs.saveJob(PeerJob(
|
s, p = AllPeerJobs.saveJob(PeerJob(
|
||||||
job['JobID'], job['Configuration'], job['Peer'], job['Field'], job['Operator'], job['Value'],
|
job['JobID'], job['Configuration'], job['Peer'], job['Field'], job['Operator'], job['Value'],
|
||||||
@ -1947,7 +1944,7 @@ def API_deletePeerScheduleJob():
|
|||||||
configuration = WireguardConfigurations.get(job['Configuration'])
|
configuration = WireguardConfigurations.get(job['Configuration'])
|
||||||
f, fp = configuration.searchPeer(job['Peer'])
|
f, fp = configuration.searchPeer(job['Peer'])
|
||||||
if not f:
|
if not f:
|
||||||
return ResponseObject(False, "Peer does not exist in this configuration")
|
return ResponseObject(False, "Peer does not exist")
|
||||||
|
|
||||||
s, p = AllPeerJobs.deleteJob(PeerJob(
|
s, p = AllPeerJobs.deleteJob(PeerJob(
|
||||||
job['JobID'], job['Configuration'], job['Peer'], job['Field'], job['Operator'], job['Value'],
|
job['JobID'], job['Configuration'], job['Peer'], job['Field'], job['Operator'], job['Value'],
|
||||||
|
@ -29,7 +29,7 @@ export default {
|
|||||||
for(let ip in i){
|
for(let ip in i){
|
||||||
if (!this.store.regexCheckIP(i[ip])){
|
if (!this.store.regexCheckIP(i[ip])){
|
||||||
if (!this.error){
|
if (!this.error){
|
||||||
this.dashboardStore.newMessage("WGDashboard", "DNS is invalid", "danger");
|
this.dashboardStore.newMessage("WGDashboard", "DNS format is incorrect", "danger");
|
||||||
}
|
}
|
||||||
this.error = true;
|
this.error = true;
|
||||||
this.data.DNS = "";
|
this.data.DNS = "";
|
||||||
|
@ -27,7 +27,7 @@ export default {
|
|||||||
for (let ip in i){
|
for (let ip in i){
|
||||||
if (!this.store.checkCIDR(i[ip])){
|
if (!this.store.checkCIDR(i[ip])){
|
||||||
if (!this.error){
|
if (!this.error){
|
||||||
this.dashboardStore.newMessage("WGDashboard", "Endpoint Allowed IP is invalid.", "danger")
|
this.dashboardStore.newMessage("WGDashboard", "Endpoint Allowed IPs format is incorrect", "danger")
|
||||||
}
|
}
|
||||||
this.data.endpoint_allowed_ip = "";
|
this.data.endpoint_allowed_ip = "";
|
||||||
this.error = true;
|
this.error = true;
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
if (window.wireguard.generatePublicKey(this.keypair.privateKey)
|
if (window.wireguard.generatePublicKey(this.keypair.privateKey)
|
||||||
!== this.keypair.publicKey){
|
!== this.keypair.publicKey){
|
||||||
this.error = true;
|
this.error = true;
|
||||||
this.dashboardStore.newMessage("WGDashboard", "Private Key and Public Key does not match.", "danger");
|
this.dashboardStore.newMessage("WGDashboard", "Private key does not match with the public key", "danger");
|
||||||
}else{
|
}else{
|
||||||
this.data.private_key = this.keypair.privateKey
|
this.data.private_key = this.keypair.privateKey
|
||||||
this.data.public_key = this.keypair.publicKey
|
this.data.public_key = this.keypair.publicKey
|
||||||
|
@ -51,7 +51,7 @@ export default {
|
|||||||
}, (res) => {
|
}, (res) => {
|
||||||
if (res.status){
|
if (res.status){
|
||||||
this.edit = false;
|
this.edit = false;
|
||||||
this.store.newMessage("Server", "Job Saved!", "success")
|
this.store.newMessage("Server", "Peer job saved", "success")
|
||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
this.$emit("refresh", res.data[0])
|
this.$emit("refresh", res.data[0])
|
||||||
this.newJob = false;
|
this.newJob = false;
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
this.store.newMessage("Server", res.message, "danger")
|
this.store.newMessage("Server", res.message, "danger")
|
||||||
this.$emit('delete')
|
this.$emit('delete')
|
||||||
}else{
|
}else{
|
||||||
this.store.newMessage("Server", "Job Deleted!", "success")
|
this.store.newMessage("Server", "Peer job deleted", "success")
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -31,7 +31,7 @@ export default {
|
|||||||
}, (res) => {
|
}, (res) => {
|
||||||
if (res.status){
|
if (res.status){
|
||||||
this.dashboardConfigurationStore.newMessage("Server",
|
this.dashboardConfigurationStore.newMessage("Server",
|
||||||
`${this.c.Name} is ${res.data ? 'is on':'is off'}`)
|
`${this.c.Name} ${res.data ? 'is on':'is off'}`)
|
||||||
}else{
|
}else{
|
||||||
this.dashboardConfigurationStore.newMessage("Server",
|
this.dashboardConfigurationStore.newMessage("Server",
|
||||||
res.message, 'danger')
|
res.message, 'danger')
|
||||||
|
@ -34,7 +34,7 @@ export default {
|
|||||||
}else{
|
}else{
|
||||||
this.value = this.store.Configuration.Peers[this.targetData];
|
this.value = this.store.Configuration.Peers[this.targetData];
|
||||||
this.store.newMessage("Server",
|
this.store.newMessage("Server",
|
||||||
`API Keys function is failed ${this.value ? 'enabled':'disabled'}`, "danger")
|
`API Keys function is failed to ${this.value ? 'enabled':'disabled'}`, "danger")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -31,7 +31,7 @@ export default {
|
|||||||
fetchPost('/api/newDashboardAPIKey', this.newKeyData, (res) => {
|
fetchPost('/api/newDashboardAPIKey', this.newKeyData, (res) => {
|
||||||
if (res.status){
|
if (res.status){
|
||||||
this.$emit('created', res.data);
|
this.$emit('created', res.data);
|
||||||
this.store.newMessage("Server", "New API Key created", "success");
|
this.store.newMessage("Server", "API Key created", "success");
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
}else{
|
}else{
|
||||||
this.store.newMessage("Server", res.message, "danger")
|
this.store.newMessage("Server", res.message, "danger")
|
||||||
|
@ -149,7 +149,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
}else{
|
}else{
|
||||||
dashboardConfigurationStore.Redirect = to;
|
dashboardConfigurationStore.Redirect = to;
|
||||||
next("/signin")
|
next("/signin")
|
||||||
dashboardConfigurationStore.newMessage("WGDashboard", "Session Ended", "warning")
|
dashboardConfigurationStore.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning")
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
await dashboardConfigurationStore.getConfiguration()
|
await dashboardConfigurationStore.getConfiguration()
|
||||||
|
@ -37,7 +37,7 @@ export const fetchGet = async (url, params=undefined, callback=undefined) => {
|
|||||||
if (x.status !== 200){
|
if (x.status !== 200){
|
||||||
if (x.status === 401){
|
if (x.status === 401){
|
||||||
|
|
||||||
store.newMessage("WGDashboard", "Session Ended", "warning")
|
store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning")
|
||||||
}
|
}
|
||||||
throw new Error(x.statusText)
|
throw new Error(x.statusText)
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ export const fetchPost = async (url, body, callback) => {
|
|||||||
if (x.status !== 200){
|
if (x.status !== 200){
|
||||||
if (x.status === 401){
|
if (x.status === 401){
|
||||||
|
|
||||||
store.newMessage("WGDashboard", "Session Ended", "warning")
|
store.newMessage("WGDashboard", "Sign in session ended, please sign in again", "warning")
|
||||||
}
|
}
|
||||||
throw new Error(x.statusText)
|
throw new Error(x.statusText)
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,7 @@
|
|||||||
"This peer already exist": "此端点已存在",
|
"This peer already exist": "此端点已存在",
|
||||||
"This IP is not available: (.*)": "此 IP 地址不可用:$1",
|
"This IP is not available: (.*)": "此 IP 地址不可用:$1",
|
||||||
"Configuration does not exist": "此配置不存在",
|
"Configuration does not exist": "此配置不存在",
|
||||||
|
"Peer does not exist": "此端点不存在",
|
||||||
"Please provide a valid configuration name": "请提供一个正确的配置名称",
|
"Please provide a valid configuration name": "请提供一个正确的配置名称",
|
||||||
"Peer saved": "端点保存成功",
|
"Peer saved": "端点保存成功",
|
||||||
"Allowed IPs already taken by another peer": "允许的 IP 地址已被其他端点使用",
|
"Allowed IPs already taken by another peer": "允许的 IP 地址已被其他端点使用",
|
||||||
@ -198,5 +199,26 @@
|
|||||||
"Update peer failed when updating Pre-Shared Key": "更新共享密钥失败",
|
"Update peer failed when updating Pre-Shared Key": "更新共享密钥失败",
|
||||||
"Update peer failed when updating Allowed IPs": "更新允许的 IP 地址失败",
|
"Update peer failed when updating Allowed IPs": "更新允许的 IP 地址失败",
|
||||||
"Update peer failed when saving the configuration": "配置保存端点失败",
|
"Update peer failed when saving the configuration": "配置保存端点失败",
|
||||||
"Peer data usage reset successfully": "端点数据重置成功"
|
"Peer data usage reset successfully": "端点数据重置成功",
|
||||||
|
"Peer download started": "端点文件下载开始",
|
||||||
|
"Please specify one or more peers": "请提供一个或更多端点",
|
||||||
|
"Share link failed to create. Reason: (.*)": "端点分享链接生成失败。原因:$1",
|
||||||
|
"Link expire date updated": "分享链接过期时间更新成功",
|
||||||
|
"Link expire date failed to update. Reason: (.*)": "分享链接过期时间更新失败。原因:$1",
|
||||||
|
"Peer job saved": "端点任务保存成功",
|
||||||
|
"Please specify job": "请提供任务",
|
||||||
|
"Please specify peer and configuration": "请提供配置名称以及端点",
|
||||||
|
"Peer job deleted": "端点任务删除成功",
|
||||||
|
"API Keys function is successfully enabled": "API 秘钥功能开启成功",
|
||||||
|
"API Keys function is successfully disabled": "API 秘钥功能停用成功",
|
||||||
|
"API Keys function is failed to enable": "API 秘钥功能开启失败",
|
||||||
|
"API Keys function is failed to disable": "API 秘钥功能停用失败",
|
||||||
|
"WGDashboard API Keys function is disabled": "WGDashboard 的 API 秘钥功能并未开启",
|
||||||
|
"WireGuard configuration path saved": "WireGuard 配置路径保存成功",
|
||||||
|
"API Key deleted": "API 秘钥删除成功",
|
||||||
|
"API Key created": "API 秘钥创建成功",
|
||||||
|
"Sign in session ended, please sign in again": "登录已过期,请重新登录",
|
||||||
|
"Please specify an IP Address (v4/v6)": "请提供一个 IP 地址 (v4或v6)",
|
||||||
|
"Please provide ipAddress and count": "请提供 ipAddress 和 count",
|
||||||
|
"Please provide ipAddress": "请提供 ipAddress"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user