This repository has been archived by the owner on Mar 26, 2023. It is now read-only.
generated from cawa-93/vite-electron-builder
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Переделан внешний вид страницы настроек
- Loading branch information
Showing
7 changed files
with
187 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,8 +71,4 @@ main { | |
flex-grow: 1; | ||
overflow: auto; | ||
} | ||
a { | ||
color: inherit; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<template> | ||
<form | ||
class="card" | ||
@submit.prevent="saveAccessTokenOption" | ||
> | ||
<div class="card-body"> | ||
<p> | ||
Для доступа к видео необходимо подключить ваш аккаунт видео-провайдера | ||
<a | ||
href="https://smotret-anime.online/users/login" | ||
@click.prevent="openExternal" | ||
>Anime.365</a>. | ||
</p> | ||
<label | ||
for="anime365-access-token" | ||
class="form-label" | ||
>Ключ доступа к Anime.365</label> | ||
<input | ||
id="anime365-access-token" | ||
v-model="SmAccessToken" | ||
:disabled="isLoading" | ||
type="password" | ||
class="form-control" | ||
aria-describedby="anime365-access-token-help" | ||
> | ||
<div | ||
id="anime365-access-token-help" | ||
class="form-text" | ||
> | ||
Чтобы получить ключ доступа авторизуйтесь в браузере и | ||
<strong><a | ||
href="https://smotret-anime.online/api/accessToken?app=play-shikimori-online" | ||
@click.prevent="openExternal" | ||
> | ||
перейдите по этой ссылке | ||
</a> | ||
</strong> | ||
</div> | ||
<div class="d-flex flex-row-reverse"> | ||
<button | ||
:disabled="isLoading" | ||
type="submit" | ||
class="btn btn-success" | ||
> | ||
<span | ||
v-if="isLoading" | ||
class="spinner-border spinner-border-sm" | ||
role="status" | ||
aria-hidden="true" | ||
/> | ||
Сохранить | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {defineComponent, ref} from 'vue'; | ||
import {clearAccessToken, getAccessToken, saveAccessToken} from '/@/utils/videoProvider/providers/anime365'; | ||
import {openExternalElement} from '/@/use/openExternal'; | ||
export default defineComponent({ | ||
name: 'OptionAnime365', | ||
setup() { | ||
const SmAccessToken = ref(getAccessToken() || ''); | ||
const isLoading = ref(false); | ||
const saveAccessTokenOption = async () => { | ||
isLoading.value = true; | ||
if (SmAccessToken.value.trim()) { | ||
try { | ||
const access_token = JSON.parse(SmAccessToken.value).data.access_token; | ||
if (access_token) { | ||
saveAccessToken(access_token); | ||
SmAccessToken.value = access_token; | ||
} | ||
} catch (e) { | ||
saveAccessToken(SmAccessToken.value); | ||
} | ||
} else { | ||
SmAccessToken.value = ''; | ||
clearAccessToken(); | ||
} | ||
isLoading.value = false; | ||
}; | ||
return {openExternal: openExternalElement, SmAccessToken, saveAccessTokenOption, isLoading}; | ||
}, | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {useElectron} from '/@/use/electron'; | ||
|
||
|
||
const {openURL} = useElectron(); | ||
export const openExternalElement = (event: MouseEvent) => { | ||
if (!event.target) { | ||
return; | ||
} | ||
|
||
const target = event.target as HTMLAnchorElement; | ||
if (!target.href) { | ||
return; | ||
} | ||
|
||
openURL(target.href); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters