带阿里标识的版本
This commit is contained in:
@@ -67,8 +67,24 @@
|
||||
|
||||
<table class="ui table selectable definition" v-show="activeSection == 'basic'">
|
||||
<tr>
|
||||
<td class="title">App ID</td>
|
||||
<td><code>{{settings.appId}}</code></td>
|
||||
<td class="title">主集群</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="primaryClusterId" v-model="settings.primaryClusterId">
|
||||
<option :value="0">[不设置]</option>
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<p class="comment httpdns-note">未设置时,按默认主集群处理(当前默认主集群:{{settings.defaultPrimaryClusterName || '-' }})。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">备集群</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="backupClusterId" v-model="settings.backupClusterId">
|
||||
<option :value="0">[不设置]</option>
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
<p class="comment httpdns-note">未设置时,按默认备用集群处理(当前默认备用集群:{{settings.defaultBackupClusterName || '-' }})。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">应用启用</td>
|
||||
@@ -86,14 +102,34 @@
|
||||
</table>
|
||||
|
||||
<table class="ui table selectable definition httpdns-auth-table" v-show="activeSection == 'auth'">
|
||||
<tr>
|
||||
<td class="title">App ID</td>
|
||||
<td>
|
||||
<code>{{settings.appId}}</code>
|
||||
<a href="" class="httpdns-mini-icon" title="复制 App ID" @click.prevent="copySecret(settings.appId, 'App ID')"><i class="copy outline icon"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">主服务域名</td>
|
||||
<td>
|
||||
<code v-if="settings.primaryServiceDomain && settings.primaryServiceDomain.length > 0">{{settings.primaryServiceDomain}}</code>
|
||||
<span class="grey" v-else>未配置</span>
|
||||
<a v-if="settings.primaryServiceDomain && settings.primaryServiceDomain.length > 0" href="" class="httpdns-mini-icon" title="复制主服务域名" @click.prevent="copySecret(settings.primaryServiceDomain, '主服务域名')"><i class="copy outline icon"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">备用服务域名</td>
|
||||
<td>
|
||||
<code v-if="settings.backupServiceDomain && settings.backupServiceDomain.length > 0">{{settings.backupServiceDomain}}</code>
|
||||
<span class="grey" v-else>未配置</span>
|
||||
<a v-if="settings.backupServiceDomain && settings.backupServiceDomain.length > 0" href="" class="httpdns-mini-icon" title="复制备用服务域名" @click.prevent="copySecret(settings.backupServiceDomain, '备用服务域名')"><i class="copy outline icon"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">请求验签</td>
|
||||
<td>
|
||||
<span
|
||||
:class="settings.signEnabled ? 'httpdns-state-on' : 'httpdns-state-off'">{{settings.signEnabled
|
||||
? "已开启" : "已关闭"}}</span>
|
||||
<a href="" class="ui mini button basic" style="margin-left: .8em;"
|
||||
@click.prevent="toggleSignEnabled">{{settings.signEnabled ? "关闭请求验签" : "开启请求验签"}}</a>
|
||||
<span :class="settings.signEnabled ? 'httpdns-state-on' : 'httpdns-state-off'">{{settings.signEnabled ? "已开启" : "已关闭"}}</span>
|
||||
<a href="" class="ui mini button basic" style="margin-left: .8em;" @click.prevent="toggleSignEnabled">{{settings.signEnabled ? "关闭请求验签" : "开启请求验签"}}</a>
|
||||
<p class="comment httpdns-note">打开后,服务端会对请求进行签名校验。</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -102,14 +138,9 @@
|
||||
<td>
|
||||
<div class="httpdns-secret-line">
|
||||
<code>{{signSecretVisible ? settings.signSecretPlain : settings.signSecretMasked}}</code>
|
||||
<a href="" class="httpdns-mini-icon" @click.prevent="signSecretVisible = !signSecretVisible"
|
||||
:title="signSecretVisible ? '隐藏明文' : '查看明文'"><i class="icon"
|
||||
:class="signSecretVisible ? 'eye slash' : 'eye'"></i></a>
|
||||
<a href="" class="httpdns-mini-icon" title="复制加签 Secret"
|
||||
@click.prevent="copySecret(settings.signSecretPlain, '加签 Secret')"><i
|
||||
class="copy outline icon"></i></a>
|
||||
<a href="" class="httpdns-mini-icon" title="重置加签 Secret" @click.prevent="resetSignSecret"><i
|
||||
class="redo icon"></i></a>
|
||||
<a href="" class="httpdns-mini-icon" @click.prevent="signSecretVisible = !signSecretVisible" :title="signSecretVisible ? '隐藏明文' : '查看明文'"><i class="icon" :class="signSecretVisible ? 'eye slash' : 'eye'"></i></a>
|
||||
<a href="" class="httpdns-mini-icon" title="复制加签 Secret" @click.prevent="copySecret(settings.signSecretPlain, '加签 Secret')"><i class="copy outline icon"></i></a>
|
||||
<a href="" class="httpdns-mini-icon" title="重置加签 Secret" @click.prevent="resetSignSecret"><i class="redo icon"></i></a>
|
||||
</div>
|
||||
<p class="comment httpdns-note">最近更新:{{settings.signSecretUpdatedAt}}</p>
|
||||
<p class="comment httpdns-note" v-if="!settings.signEnabled">请求验签已关闭,当前不使用加签 Secret。</p>
|
||||
|
||||
@@ -34,10 +34,13 @@
|
||||
<tr>
|
||||
<td>所属用户</td>
|
||||
<td>
|
||||
<user-selector></user-selector>
|
||||
<select class="ui dropdown auto-width" name="userId">
|
||||
<option value="0">[不设置]</option>
|
||||
<option v-for="user in users" :value="user.id">{{user.fullname}} ({{user.username}})</option>
|
||||
</select>
|
||||
<p class="comment">可以选择当前应用所属的平台用户。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{$layout}
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
|
||||
<div class="ui margin"></div>
|
||||
@@ -26,16 +26,22 @@
|
||||
|
||||
<table class="ui table selectable celled httpdns-apps-table" v-if="apps.length > 0">
|
||||
<colgroup>
|
||||
<col style="width:32%;" />
|
||||
<col style="width:26%;" />
|
||||
<col style="width:20%;" />
|
||||
<col style="width:12%;" />
|
||||
<col style="width:10%;" />
|
||||
<col style="width:11%;" />
|
||||
<col style="width:11%;" />
|
||||
<col style="width:12%;" />
|
||||
<col style="width:8%;" />
|
||||
<col style="width:6%;" />
|
||||
<col style="width:20%;" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>应用名称</th>
|
||||
<th>AppID</th>
|
||||
<th>主集群</th>
|
||||
<th>备用集群</th>
|
||||
<th>用户</th>
|
||||
<th class="center">绑定域名数</th>
|
||||
<th class="center">状态</th>
|
||||
<th>操作</th>
|
||||
@@ -54,6 +60,26 @@
|
||||
<code>{{app.appId}}</code>
|
||||
<copy-icon :text="app.appId"></copy-icon>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="app.primaryCluster != null && app.primaryCluster.id > 0">
|
||||
{{app.primaryCluster.name || ('#' + app.primaryCluster.id)}}
|
||||
<link-icon :href="'/httpdns/clusters/cluster?clusterId=' + app.primaryCluster.id"></link-icon>
|
||||
</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="app.backupCluster != null && app.backupCluster.id > 0">
|
||||
{{app.backupCluster.name || ('#' + app.backupCluster.id)}}
|
||||
<link-icon :href="'/httpdns/clusters/cluster?clusterId=' + app.backupCluster.id"></link-icon>
|
||||
</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="app.user != null && app.user.id > 0">
|
||||
{{app.user.fullname}} ({{app.user.username}})
|
||||
</span>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
<td class="center"><a :href="'/httpdns/apps/domains?appId=' + app.id">{{app.domainCount}}</a></td>
|
||||
<td class="center">
|
||||
<label-on :v-is-on="app.isOn"></label-on>
|
||||
@@ -68,4 +94,4 @@
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<div class="httpdns-sdk-actions">
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/download?platform=android"><i class="icon download"></i> 下载 SDK</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/doc?platform=android"><i class="icon book"></i> 下载文档</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/download?platform=android" @click="downloadSDK('android', $event)"><i class="icon download"></i> 下载 SDK</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/doc?platform=android" @click="downloadDoc('android', $event)"><i class="icon book"></i> 下载文档</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,8 +63,8 @@
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<div class="httpdns-sdk-actions">
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/download?platform=ios"><i class="icon download"></i> 下载 SDK</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/doc?platform=ios"><i class="icon book"></i> 下载文档</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/download?platform=ios" @click="downloadSDK('ios', $event)"><i class="icon download"></i> 下载 SDK</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/doc?platform=ios" @click="downloadDoc('ios', $event)"><i class="icon book"></i> 下载文档</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,8 +77,8 @@
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<div class="httpdns-sdk-actions">
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/download?platform=flutter"><i class="icon download"></i> 下载 SDK</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/doc?platform=flutter"><i class="icon book"></i> 下载文档</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/download?platform=flutter" @click="downloadSDK('flutter', $event)"><i class="icon download"></i> 下载 SDK</a>
|
||||
<a class="ui button compact mini basic" href="/httpdns/apps/sdk/doc?platform=flutter" @click="downloadDoc('flutter', $event)"><i class="icon book"></i> 下载文档</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
123
EdgeAdmin/web/views/@default/httpdns/apps/sdk.js
Normal file
123
EdgeAdmin/web/views/@default/httpdns/apps/sdk.js
Normal file
@@ -0,0 +1,123 @@
|
||||
Tea.context(function () {
|
||||
this.downloadSDK = function (platform, event) {
|
||||
this.checkAndDownload(platform, "sdk", event)
|
||||
}
|
||||
|
||||
this.downloadDoc = function (platform, event) {
|
||||
this.checkAndDownload(platform, "doc", event)
|
||||
}
|
||||
|
||||
this.checkAndDownload = function (platform, type, event) {
|
||||
if (event != null && typeof event.preventDefault == "function") {
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
this.$get("/httpdns/apps/sdk/check")
|
||||
.params({
|
||||
platform: platform,
|
||||
type: type
|
||||
})
|
||||
.success(function (resp) {
|
||||
let data = (resp != null && resp.data != null) ? resp.data : {}
|
||||
if (!data.exists) {
|
||||
teaweb.warn(data.message || "当前暂无可下载文件")
|
||||
return
|
||||
}
|
||||
if (typeof data.url == "string" && data.url.length > 0) {
|
||||
this.downloadByBlob(data.url, platform, type)
|
||||
return
|
||||
}
|
||||
teaweb.warn("下载地址生成失败,请稍后重试")
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
this.downloadByBlob = function (url, platform, type) {
|
||||
let defaultFileName = "httpdns-sdk-" + platform + (type == "doc" ? ".md" : ".zip")
|
||||
|
||||
let xhr = new XMLHttpRequest()
|
||||
xhr.open("GET", url, true)
|
||||
xhr.responseType = "blob"
|
||||
|
||||
xhr.onload = function () {
|
||||
if (xhr.status < 200 || xhr.status >= 300) {
|
||||
teaweb.warn("下载失败(HTTP " + xhr.status + ")")
|
||||
return
|
||||
}
|
||||
if (xhr.status == 204) {
|
||||
teaweb.warn("下载被浏览器扩展或下载工具拦截,请暂时关闭相关扩展后重试")
|
||||
return
|
||||
}
|
||||
|
||||
let contentType = (xhr.getResponseHeader("Content-Type") || "").toLowerCase()
|
||||
if (contentType.indexOf("application/json") >= 0) {
|
||||
let reader = new FileReader()
|
||||
reader.onload = function () {
|
||||
try {
|
||||
let json = JSON.parse(reader.result)
|
||||
teaweb.warn((json && json.message) ? json.message : "下载失败,请稍后重试")
|
||||
} catch (_e) {
|
||||
teaweb.warn("下载失败,请稍后重试")
|
||||
}
|
||||
}
|
||||
reader.readAsText(xhr.response)
|
||||
return
|
||||
}
|
||||
|
||||
let disposition = xhr.getResponseHeader("Content-Disposition") || ""
|
||||
let fileName = xhr.getResponseHeader("X-SDK-Filename") || this.parseFileName(disposition) || defaultFileName
|
||||
if (xhr.response == null || xhr.response.size <= 0) {
|
||||
teaweb.warn("下载文件为空,请检查已上传 SDK 包是否完整")
|
||||
return
|
||||
}
|
||||
this.saveBlob(xhr.response, fileName)
|
||||
}.bind(this)
|
||||
|
||||
xhr.onerror = function () {
|
||||
teaweb.warn("下载失败,请检查网络后重试")
|
||||
}
|
||||
|
||||
xhr.send()
|
||||
}
|
||||
|
||||
this.parseFileName = function (disposition) {
|
||||
if (typeof disposition != "string" || disposition.length == 0) {
|
||||
return ""
|
||||
}
|
||||
|
||||
let utf8Match = disposition.match(/filename\*=UTF-8''([^;]+)/i)
|
||||
if (utf8Match != null && utf8Match.length > 1) {
|
||||
try {
|
||||
return decodeURIComponent(utf8Match[1])
|
||||
} catch (_e) {
|
||||
}
|
||||
}
|
||||
|
||||
let plainMatch = disposition.match(/filename="?([^";]+)"?/i)
|
||||
if (plainMatch != null && plainMatch.length > 1) {
|
||||
return plainMatch[1]
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
this.saveBlob = function (blob, fileName) {
|
||||
if (window.navigator != null && typeof window.navigator.msSaveOrOpenBlob == "function") {
|
||||
window.navigator.msSaveOrOpenBlob(blob, fileName)
|
||||
return
|
||||
}
|
||||
|
||||
let objectURL = window.URL.createObjectURL(blob)
|
||||
let a = document.createElement("a")
|
||||
a.style.display = "none"
|
||||
a.href = objectURL
|
||||
a.download = fileName
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
setTimeout(function () {
|
||||
window.URL.revokeObjectURL(objectURL)
|
||||
if (a.parentNode != null) {
|
||||
a.parentNode.removeChild(a)
|
||||
}
|
||||
}, 30000)
|
||||
}
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
{$layout}
|
||||
{$layout}
|
||||
|
||||
<second-menu>
|
||||
<a class="item" :href="'/httpdns/apps/domains?appId=' + app.id">{{app.name}}</a>
|
||||
@@ -34,7 +34,7 @@
|
||||
<td class="title">版本号 *</td>
|
||||
<td>
|
||||
<input type="text" name="version" v-model="version" maxlength="32"/>
|
||||
<p class="comment">默认 `1.0.0`。同平台上传会覆盖“最新版本”下载内容。</p>
|
||||
<p class="comment">默认 `1.0.0`。同平台+同版本再次上传会覆盖该版本文件。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -90,4 +90,3 @@
|
||||
<div class="ui message" v-else>
|
||||
暂无上传记录。
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Tea.context(function () {
|
||||
Tea.context(function () {
|
||||
this.platform = "android";
|
||||
this.version = this.defaultVersion || "1.0.0";
|
||||
this.isUploading = false;
|
||||
|
||||
Reference in New Issue
Block a user