Add administrator-controlled IP project entry redirects
This commit is contained in:
1 parent
1f25bbd1f9
commit
2f93fb023a
13 files changed
+439
-5
No files matched your search
@@ -59,6 +59,23 @@ async function history(p: any) {
|
||||
error.value = (e as Error).message;
|
||||
}
|
||||
}
|
||||
async function configureIpEntry(site: any, enabled: boolean) {
|
||||
const alias = enabled
|
||||
? prompt("设置 IP 入口的项目路径,例如 student-info", site.ip_entry_alias || "")
|
||||
: "";
|
||||
if (alias === null) return;
|
||||
error.value = "";
|
||||
try {
|
||||
const result = await api(`/admin/sites/${site.id}/ip-entry`, {
|
||||
method: "PUT",
|
||||
body: body({ enabled, alias: alias.trim() }),
|
||||
});
|
||||
success.value = result.message;
|
||||
await load();
|
||||
} catch (cause) {
|
||||
error.value = (cause as Error).message;
|
||||
}
|
||||
}
|
||||
onMounted(load);
|
||||
</script>
|
||||
<template>
|
||||
@@ -105,6 +122,7 @@ onMounted(load);
|
||||
}}<small class="block"
|
||||
>{{ p.stack }} · {{ p.services }} 服务</small
|
||||
>
|
||||
<small v-if="p.ip_entry_enabled" class="block">IP 入口 /{{ p.ip_entry_alias }}</small>
|
||||
</td>
|
||||
<td>
|
||||
{{ p.display_name }}<small class="block">{{ p.email }}</small>
|
||||
@@ -151,6 +169,14 @@ onMounted(load);
|
||||
封禁</button
|
||||
><button class="link" @click="history(p)">执行记录</button>
|
||||
</div>
|
||||
<div v-if="store.user?.permissions.includes('hosting:write')" class="table-actions">
|
||||
<button class="link" :disabled="busy" @click="configureIpEntry(p, true)">
|
||||
{{ p.ip_entry_enabled ? "编辑 IP 入口" : "开启 IP 入口" }}
|
||||
</button>
|
||||
<button v-if="p.ip_entry_enabled" class="link danger" :disabled="busy" @click="configureIpEntry(p, false)">
|
||||
关闭 IP 入口
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!sites.length">
|
||||
|
||||
Reference in new issue
Block a user