Set primary base url in settings page

This commit is contained in:
LouisLam 2021-10-07 16:30:16 +08:00
parent ed67803af8
commit d08a71ab49

View file

@ -52,9 +52,12 @@
</div> </div>
</div> </div>
<!-- General Settings -->
<h2 class="mt-5 mb-2">{{ $t("General") }}</h2> <h2 class="mt-5 mb-2">{{ $t("General") }}</h2>
<form class="mb-3" @submit.prevent="saveGeneral"> <form class="mb-3" @submit.prevent="saveGeneral">
<div class="mb-3"> <!-- Timezone -->
<div class="mb-4">
<label for="timezone" class="form-label">{{ $t("Timezone") }}</label> <label for="timezone" class="form-label">{{ $t("Timezone") }}</label>
<select id="timezone" v-model="$root.userTimezone" class="form-select"> <select id="timezone" v-model="$root.userTimezone" class="form-select">
<option value="auto"> <option value="auto">
@ -66,7 +69,8 @@
</select> </select>
</div> </div>
<div class="mb-3"> <!-- Search Engine -->
<div class="mb-4">
<label class="form-label">{{ $t("Search Engine Visibility") }}</label> <label class="form-label">{{ $t("Search Engine Visibility") }}</label>
<div class="form-check"> <div class="form-check">
@ -83,7 +87,8 @@
</div> </div>
</div> </div>
<div class="mb-3"> <!-- Entry Page -->
<div class="mb-4">
<label class="form-label">{{ $t("Entry Page") }}</label> <label class="form-label">{{ $t("Entry Page") }}</label>
<div class="form-check"> <div class="form-check">
@ -101,6 +106,19 @@
</div> </div>
</div> </div>
<!-- Primary Base URL -->
<div class="mb-4">
<label class="form-label" for="primaryBaseURL">Primary Base URL</label>
<div class="input-group mb-3">
<input id="primaryBaseURL" v-model="settings.primaryBaseURL" class="form-control" name="primaryBaseURL" placeholder="https://">
<button class="btn btn-outline-primary" type="button" @click="autoGetPrimaryBaseURL">Auto Get</button>
</div>
<div class="form-text">
</div>
</div>
<div> <div>
<button class="btn btn-primary" type="submit"> <button class="btn btn-primary" type="submit">
{{ $t("Save") }} {{ $t("Save") }}
@ -109,6 +127,7 @@
</form> </form>
<template v-if="loaded"> <template v-if="loaded">
<!-- Change Password -->
<template v-if="! settings.disableAuth"> <template v-if="! settings.disableAuth">
<h2 class="mt-5 mb-2">{{ $t("Change Password") }}</h2> <h2 class="mt-5 mb-2">{{ $t("Change Password") }}</h2>
<form class="mb-3" @submit.prevent="savePassword"> <form class="mb-3" @submit.prevent="savePassword">
@ -204,9 +223,11 @@
</template> </template>
</div> </div>
<div class="notification-list col-md-6"> <div class="col-md-6">
<div v-if="$root.isMobile" class="mt-3" /> <div v-if="$root.isMobile" class="mt-3" />
<!-- Notifications -->
<div class="notification-list ">
<h2>{{ $t("Notifications") }}</h2> <h2>{{ $t("Notifications") }}</h2>
<p v-if="$root.notificationList.length === 0"> <p v-if="$root.notificationList.length === 0">
{{ $t("Not available, please setup.") }} {{ $t("Not available, please setup.") }}
@ -225,7 +246,9 @@
<button class="btn btn-primary me-2" type="button" @click="$refs.notificationDialog.show()"> <button class="btn btn-primary me-2" type="button" @click="$refs.notificationDialog.show()">
{{ $t("Setup Notification") }} {{ $t("Setup Notification") }}
</button> </button>
</div>
<!-- Info -->
<h2 class="mt-5">{{ $t("Info") }}</h2> <h2 class="mt-5">{{ $t("Info") }}</h2>
{{ $t("Version") }}: {{ $root.info.version }} <br /> {{ $t("Version") }}: {{ $root.info.version }} <br />
@ -531,6 +554,10 @@ export default {
} }
}); });
}, },
autoGetPrimaryBaseURL() {
this.settings.primaryBaseURL = location.protocol + "//" + location.host;
}
}, },
}; };
</script> </script>