feat: auto remove https prefix (#31)

zio/stable
三咲智子 Kevin Deng 2022-11-23 17:06:32 +08:00 committed by GitHub
parent cd19d75418
commit 0befc5169b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -1,10 +1,15 @@
<script setup lang="ts">
import { DEFAULT_SERVER } from '~/constants'
const server = ref<string>()
let server = $ref<string>('')
async function oauth() {
location.href = `/api/${server.value || DEFAULT_SERVER}/login`
location.href = `/api/${server || DEFAULT_SERVER}/login`
}
async function handleInput() {
if (server.startsWith('https://'))
server = server.replace('https://', '')
}
</script>
@ -16,7 +21,7 @@ async function oauth() {
<div>Mastodon Server Name</div>
<div flex bg-gray:10 px2 py1 mxa rounded border="~ border" w-80 text-xl items-center>
<span op35 mr1 text-sm>https://</span>
<input v-model="server" :placeholder="DEFAULT_SERVER" outline-none bg-transparent>
<input v-model="server" :placeholder="DEFAULT_SERVER" outline-none bg-transparent @input="handleInput">
</div>
<button btn-solid mxa mt2 @click="oauth()">
Sign in