-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
176 additions
and
78 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
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 |
---|---|---|
@@ -1,32 +1,45 @@ | ||
const Path = require('path'); | ||
const Chalk = require('chalk'); | ||
const FileSystem = require('fs'); | ||
const Vite = require('vite'); | ||
const compileTs = require('./private/tsc'); | ||
const Path = require("path"); | ||
const Chalk = require("chalk"); | ||
const FileSystem = require("fs"); | ||
const Vite = require("vite"); | ||
const compileTs = require("./private/tsc"); | ||
|
||
function buildRenderer() { | ||
return Vite.build({ | ||
configFile: Path.join(__dirname, '..', 'vite.config.js'), | ||
base: './', | ||
mode: 'production' | ||
}); | ||
return Vite.build({ | ||
configFile: Path.join(__dirname, "..", "vite.config.js"), | ||
base: "./", | ||
mode: "production", | ||
}); | ||
} | ||
|
||
function copyStaticFiles() { | ||
copy("static"); | ||
} | ||
|
||
function copy(path) { | ||
FileSystem.cpSync( | ||
Path.join(__dirname, "..", "src", "main", path), | ||
Path.join(__dirname, "..", "build", "main", path), | ||
{ recursive: true } | ||
); | ||
} | ||
|
||
function buildMain() { | ||
const mainPath = Path.join(__dirname, '..', 'src', 'main'); | ||
return compileTs(mainPath); | ||
const mainPath = Path.join(__dirname, "..", "src", "main"); | ||
return compileTs(mainPath); | ||
} | ||
|
||
FileSystem.rmSync(Path.join(__dirname, '..', 'build'), { | ||
recursive: true, | ||
force: true, | ||
}) | ||
FileSystem.rmSync(Path.join(__dirname, "..", "build"), { | ||
recursive: true, | ||
force: true, | ||
}); | ||
|
||
console.log(Chalk.blueBright('Transpiling renderer & main...')); | ||
console.log(Chalk.blueBright("Transpiling renderer & main...")); | ||
|
||
Promise.allSettled([ | ||
buildRenderer(), | ||
buildMain(), | ||
]).then(() => { | ||
console.log(Chalk.greenBright('Renderer & main successfully transpiled! (ready to be built with electron-builder)')); | ||
Promise.allSettled([buildRenderer(), buildMain(), copyStaticFiles()]).then(() => { | ||
console.log( | ||
Chalk.greenBright( | ||
"Renderer & main successfully transpiled! (ready to be built with electron-builder)" | ||
) | ||
); | ||
}); |
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,40 @@ | ||
import { Menu, MenuItem, MenuItemConstructorOptions, shell } from "electron"; | ||
|
||
export default function () { | ||
const template: Array<MenuItemConstructorOptions | MenuItem> = [ | ||
{ | ||
label: "Reload", | ||
submenu: [{ role: "reload" }, { role: "forceReload" }], | ||
}, | ||
{ | ||
label: "View", | ||
submenu: [ | ||
{ role: "resetZoom" }, | ||
{ role: "zoomIn" }, | ||
{ role: "zoomOut" }, | ||
{ role: "quit" }, | ||
], | ||
}, | ||
{ | ||
label: "Help", | ||
submenu: [ | ||
{ | ||
label: "Support", | ||
click: () => { | ||
shell.openExternal("https://github.com/sponsors/rizkhal"); | ||
}, | ||
}, | ||
{ | ||
label: "Contact", | ||
click: () => { | ||
shell.openExternal("https://t.me/rizkhal"); | ||
}, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
let menu = Menu.buildFromTemplate(template); | ||
|
||
Menu.setApplicationMenu(menu); | ||
} |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,32 @@ | ||
import f from "wretch"; | ||
import { defineStore } from "pinia"; | ||
import { LoginCredentials } from "../typings"; | ||
|
||
const BASE_URL = import.meta.env.VITE_ANIFLIX_API_URL; | ||
|
||
type Login = { | ||
errors?: string; | ||
loading: boolean; | ||
}; | ||
|
||
export const useAuth = defineStore("auth", { | ||
state: (): Login => ({ | ||
errors: undefined, | ||
loading: false, | ||
}), | ||
actions: { | ||
async login(model: LoginCredentials): Promise<void> { | ||
this.loading = true; | ||
return f(`${BASE_URL}/api/auth/login`) | ||
.post(model) | ||
.badRequest((err) => { | ||
const { message } = JSON.parse(err.message); | ||
this.errors = message; | ||
}) | ||
.json(({ user, token }) => { | ||
localStorage.setItem("user", JSON.stringify(user)); | ||
localStorage.setItem("token", JSON.stringify(token)); | ||
}); | ||
}, | ||
}, | ||
}); |
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,12 @@ | ||
import { defineStore } from "pinia"; | ||
|
||
export const useWelcome = defineStore("welcome", { | ||
state: () => ({ | ||
isShow: false, | ||
}), | ||
actions: { | ||
show(show: boolean) { | ||
this.isShow = show; | ||
}, | ||
}, | ||
}); |