Add Deep Link support

This commit is contained in:
Yukino Song
2024-08-30 12:52:50 +08:00
parent f58c1eabdb
commit d416886999
5 changed files with 20 additions and 8 deletions

View File

@@ -19,11 +19,11 @@
<div class="mb-2">
<label for="usernameInput" class="form-label">{{ $t('_common.username') }}</label>
<input type="text" class="form-control" id="usernameInput" autocomplete="username"
v-model="passwordData.username" />
v-model="passwordData.username" required autofocus/>
</div>
<div class="mb-4">
<label for="passwordInput" class="form-label">{{ $t('_common.password') }}</label>
<input type="password" class="form-control" id="passwordInput" autocomplete="new-password"
<input type="password" class="form-control" id="passwordInput" autocomplete="password"
v-model="passwordData.password" required />
</div>
<button type="submit" class="btn btn-primary w-100 mb-2" v-bind:disabled="loading">
@@ -35,7 +35,6 @@
</div>
</form>
</div>
</div>
</div>
</main>
</body>

View File

@@ -121,6 +121,14 @@
this.otpStatus = 'warning'
resetOTPTimeout = null
}, 3 * 60 * 1000)
if (['localhost', '127.0.0.1', '[::1]'].indexOf(location.hostname) < 0) {
setTimeout(() => {
if (window.confirm(this.i18n.t('pin.otp_pair_now'))) {
window.open(`art://${location.hostname}:${parseInt(location.port, 10) - 1}?pin=${this.otp}&passphrase=${this.passphrase}`);
}
}, 0)
}
})
}
}

View File

@@ -380,7 +380,8 @@
"otp_expired": "EXPIRED",
"otp_expired_msg": "OTP expired. Please request a new one.",
"otp_success": "PIN request success, the PIN is available within 3 minutes.",
"otp_msg": "OTP pairing is only available for Artemis clients. Please use legacy pairing method for other clients."
"otp_msg": "OTP pairing is only available for Artemis clients. Please use legacy pairing method for other clients.",
"otp_pair_now": "PIN generated successfully, do you want to pair now?"
},
"resource_card": {
"github_discussions": "GitHub Discussions",
@@ -407,6 +408,7 @@
"quit_apollo_desc": "Exit Apollo. This will terminate any running sessions.",
"quit_apollo_success": "Apollo has exited.",
"quit_apollo_success_ongoing": "Apollo is quitting...",
"quit_apollo_confirm": "Do you really want to quit Apollo? You'll not be able to start Apollo again if you have no other methods to operate your computer.",
"troubleshooting": "Troubleshooting",
"unpair_all": "Unpair All",
"unpair_all_error": "Error while unpairing",

View File

@@ -381,7 +381,8 @@
"otp_expired": "已过期",
"otp_expired_msg": "口令已过期,请重新请求。",
"otp_success": "一次性 PIN 请求成功3分钟内有效。",
"otp_msg": "一次性口令目前仅支持 Artemis 客户端使用。其他客户端请使用传统配对方式。"
"otp_msg": "一次性口令目前仅支持 Artemis 客户端使用。其他客户端请使用传统配对方式。",
"otp_pair_now": "PIN 请求成功,是否一键配对?"
},
"resource_card": {
"github_discussions": "Github 讨论区",
@@ -406,8 +407,9 @@
"restart_apollo_success": "Apollo 正在重启",
"quit_apollo": "退出 Apollo",
"quit_apollo_desc": "停止运行 Apollo。这将会终止任何正在进行的会话。",
"quit_apollo_success": "Apollo has exited.",
"quit_apollo_success_ongoing": "Apollo is quitting...",
"quit_apollo_success": "Apollo 已成功退出。",
"quit_apollo_success_ongoing": "Apollo 正在退出...",
"quit_apollo_confirm": "确定要退出 Apollo 吗?如果没有其他操作方式,你将无法再次启动 Apollo。",
"troubleshooting": "故障排除",
"unpair_all": "全部取消配对",
"unpair_all_error": "取消配对时出错",

View File

@@ -155,6 +155,7 @@
components: {
Navbar
},
inject: ['i18n'],
data() {
return {
clients: [],
@@ -279,7 +280,7 @@
});
},
quit() {
if (window.confirm("Do you really want to quit Apollo? You'll not be able to start Apollo again if you have no other methods to operate your computer.")) {
if (window.confirm(this.i18n.t('troubleshooting.quit_apollo_confirm'))) {
this.serverQuitting = true;
fetch("/api/quit", {
credentials: 'include',