Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
progzone122 committed Jul 17, 2022
1 parent f96d55a commit c7334f8
Show file tree
Hide file tree
Showing 9 changed files with 10,835 additions and 23 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"bootstrap-icons": "^1.8.3",
"bootstrap-vue": "^2.22.0",
"cheerio": "^1.0.0-rc.12",
"copy-paste": "^1.3.0",
"discord-rpc": "^4.0.1",
"jquery": "^3.6.0",
"localforage": "^1.10.0",
Expand Down
2 changes: 2 additions & 0 deletions src/main/BrowserWinHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default class BrowserWinHandler {
webSecurity: false, // disable on dev to allow loading local resources
nodeIntegration: true, // allow loading modules via the require () function
contextIsolation: false, // https://github.com/electron/electron/issues/18037#issuecomment-806320028
enableRemoteModule: true,
enableremotemodule: true
}
}
)
Expand Down
39 changes: 36 additions & 3 deletions src/main/settings.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import getAppDataPath from 'appdata-path'
export function getAppData(){
import { getAllKeys, getOneEntry, setEntry } from './indexedDB.js'
const ncp = require("copy-paste");
export const getAppData = () => {
return getAppDataPath().replaceAll('\\', '/') + '/AniShip';
}
export function getAnimeVostServer(){
export const getAnimeVostServer = () => {
const servers = localStorage.getItem('animevost_server');
if (servers !== null) {
return servers;
Expand All @@ -11,7 +13,7 @@ export function getAnimeVostServer(){
return "api.animetop.info";
}
}
export function getDefaultVoicer(){
export const getDefaultVoicer = () => {
const voicer = localStorage.getItem('voicer');
if (voicer !== null) {
return voicer;
Expand All @@ -20,3 +22,34 @@ export function getDefaultVoicer(){
return "animevost";
}
}
export const importDatabase = () => {
const database = JSON.parse(ncp.paste());
console.log(database);
for(let i in database.favorites.animevost){
setEntry('favorites', 'animevost', String(i), database.favorites.animevost[i]);
}
for(let i in database.favorites.anilibria){
setEntry('favorites', 'anilibria', String(i), database.favorites.anilibria[i]);
}
return "Успешный импорт бэкапа базы данных";
}
export const exportDatabase = async () => {
let database = {
version: process.env.npm_package_version,
favorites: {
animevost: {},
anilibria: {}
}
};
let value;
const animevost_keys = await getAllKeys('favorites', 'animevost');
const anilibria_keys = await getAllKeys('favorites', 'anilibria');
for(let i in animevost_keys){
database.favorites.animevost[String(animevost_keys[i])] = await getOneEntry('favorites', 'animevost', String(animevost_keys[i]));
}
for(let i in anilibria_keys){
database.favorites.anilibria[String(anilibria_keys[i])] = await getOneEntry('favorites', 'anilibria', String(anilibria_keys[i]));
}
ncp.copy(JSON.stringify(database));
return "Бэкап успешно скопирован в буфер обмена";
}
13 changes: 6 additions & 7 deletions src/renderer/components/LeftMenu.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ul class="left-menu">
<div class="voicer">
<div class="block" :style="{ 'background-image': 'url(' + voicer_buttonImg + ')' }" @click="voicer_list = !voicer_list" />
<b-icon class="block" icon="bullseye" @click="voicer_list = !voicer_list" style="width: 1.4em;"></b-icon>
</div>
<transition name="fade">
<div v-if="voicer_list" class="voicer-list">
Expand Down Expand Up @@ -36,10 +36,10 @@ export default {
created() {
switch(this.voicer){
case "animevost":
this.voicer_buttonImg = '/_nuxt/src/renderer/assets/voicers/animevost.png';
this.voicer_buttonImg = '~assets/voicers/animevost.png';
break;
case "anilibria":
this.voicer_buttonImg = '/_nuxt/src/renderer/assets/voicers/anilibria.png';
this.voicer_buttonImg = '~assets/voicers/anilibria.png';
break;
}
},
Expand Down Expand Up @@ -88,10 +88,10 @@ export default {
this.voicer = v;
switch(this.voicer){
case "animevost":
this.voicer_buttonImg = '../../static/voicers/animevost.png';
this.voicer_buttonImg = '~assets/voicers/animevost.png';
break;
case "anilibria":
this.voicer_buttonImg = '../../static/voicers/anilibria.png';
this.voicer_buttonImg = '~assets/voicers/anilibria.png';
break;
}
localStorage.setItem('voicer', v);
Expand Down Expand Up @@ -126,7 +126,7 @@ export default {
.left-menu a:hover {
border-radius: 0 0.5em 0.5em 0;
}
.left-menu a svg {
svg {
font-size: 1.6em;
color: white;
}
Expand All @@ -142,7 +142,6 @@ export default {
border-radius: 1.5em;
margin-left: 0.5em;
background-size: cover;
background-color: white;
cursor: pointer;
}
.voicer-list{
Expand Down
17 changes: 15 additions & 2 deletions src/renderer/pages/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
</div>
<!-- -->
<p style="font-weight: 600; margin-top: 1em;">Локальная база данных</p>
<button type="button" class="btn btn-dark" @click="clearDatabase();">Очистить базу данных</button>
<div style="display: flex; flex-wrap: wrap; gap: 0.5em;">
<button type="button" class="btn btn-dark" @click="clearDatabase();">Очистить базу данных</button>
<button type="button" class="btn btn-dark" @click="importDatabase();">Импорт базы данных</button>
<button type="button" class="btn btn-dark" @click="exportDatabase();">Экспорт базы данных</button>
</div>

<p style="font-weight: 600; margin-top: 1em;">Обновления</p>
<button type="button" class="btn btn-dark" onclick="window.open('https://github.com/progzone122/AniShip', '_blank')">Открыть GitHub репозиторий</button>
<!-- -->
Expand Down Expand Up @@ -49,6 +54,7 @@
</template>
<script>
import { setEntry, getOneEntry, getAllKeys, removeEntry, clearStore } from '../../main/indexedDB.js'
import { exportDatabase, importDatabase } from '../../main/settings.js'
export default {
name: 'Settings',
data(){
Expand All @@ -58,7 +64,7 @@ export default {
animevost_server: localStorage.getItem('animevost_server')
}
},
mounted() {
async mounted() {
// this.videocdn_token = this.config.tokens.videocdn;
},
methods: {
Expand All @@ -73,6 +79,13 @@ export default {
clearDatabase(){
clearStore("favorites", "animevost");
clearStore("favorites", "anilibria");
alert("База данных успешно очищена");
},
importDatabase(){
alert(importDatabase());
},
async exportDatabase(){
alert(await exportDatabase());
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/renderer/pages/WatchAnime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
class="btn btn-dark"
@click="
setQuality('720p');
startSeries(selectSeries);
"
>
Animevost 720p
Expand All @@ -108,7 +107,6 @@
class="btn btn-dark"
@click="
setQuality('480p');
startSeries(selectSeries);
"
>
Animevost 480p
Expand Down Expand Up @@ -250,6 +248,7 @@ export default {
if (this.player === "animevost") {
this.director = this.info.director;
this.series = seriesFromTitle(this.name);
console.log(this.series);
this.banner = this.info.urlImagePreview;
this.description = this.info.description.replaceAll("<br />", "\n");
this.ratingAnimevost = titleRatingAnimevost(this.info);
Expand Down Expand Up @@ -292,7 +291,7 @@ export default {
}
}
//Списки избранного
this.title = getOneEntry('favorites', this.main_params.voicer, String(this.main_params.id));
this.title = await getOneEntry('favorites', this.main_params.voicer, String(this.main_params.id));
console.log(this.title);
// if (this.title !== null) {
// this.lastSeries = this.title[this.main_params.id].lastSeries; //<-- Временно закоменчено, функционал работает не стабильно
Expand Down Expand Up @@ -566,10 +565,14 @@ header {
width: 100%;
margin-bottom: 1em;
}
</style>
<style>
#player ul {
background-color: #212529;
padding: 1em;
}
#dropdown1{
width: 100%;
}
</style>
<style>
</style>
12 changes: 7 additions & 5 deletions src/renderer/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
v-if="filter == 'new' && voicer !== 'anilibria'"
id="loadanimes"
class="block"
@click="getMoreTitles(filter)"
@click="getMoreTitles()"
>
<div
class="image"
Expand Down Expand Up @@ -152,11 +152,13 @@ export default {
return d.substr(0, 200) + '...'
}
},
getMoreTitles () {
this.page = this.page + 1
const titles2 = loadTitles(this.filter, this.page).data
async getMoreTitles () {
this.page = this.page + 1;
let titles2 = await loadTitles(this.filter, this.page);
titles2 = titles2.data;
console.log(titles2);
for (const i in titles2) {
this.titles.push(titles2[i])
this.titles.push(titles2[i]);
}
}
}
Expand Down
Loading

0 comments on commit c7334f8

Please sign in to comment.