Skip to content

Commit

Permalink
Merge pull request #34
Browse files Browse the repository at this point in the history
Player volume fix, linux icon fix, visual flash befare main page loaded fix
  • Loading branch information
pavloniym committed May 17, 2022
2 parents cdca4f3 + 87c8ae9 commit 23ef7e8
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 34 deletions.
13 changes: 8 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Application base variables
NODE_ENV=development

# Sentry.io path
SENTRY_DSN=
SENTRY_DSN=https://d8578edf8458ce06fbc5bb76a58c5ca4@example.ingest.sentry.io/1234567

# Yandex
YANDEX_TRACKING_ID=
YANDEX_TRACKING_ID=1234567890

# Adds urls, comma separated
ADS_URLS=

# VK application ID
VK_APP_ID=
VK_APP_ID=5315207

# Api endpoint url
# Static endpoint url
API_ENDPOINT_URL=
STATIC_ENDPOINT_URL
API_ENDPOINT_URL=https://www.anilibria.tv/
STATIC_ENDPOINT_URL=https://www.anilibria.tv/
41 changes: 28 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
# AniLibrix

> Anilibria desktop app
#### Build Setup
### Сборка и запуск

> Требуемая верси Node.JS - **14.18.0**
>
> На других версиях (особенно выше) могут быть проблемы с сборкой нативных модулей
Перед запуском не забудьте скопировать и отредактировать пример `.env` файла:

``` bash
cp .env.example .env
```

``` bash
# install dependencies
npm install
# Установка и сборка зависимостей
yarn install

# serve with hot reload at localhost:9080
npm run dev
# Запуск с горячей перезагрузкой на localhost:9080
yarn run serve

# build electron application for production
npm run build
# Сборка production версии
yarn run build

# Запуск ESLint --fix для JS/Vue файлов и компонентов в `src/`
yarn run lint:fix

# lint all JS/Vue component files in `src/`
npm run lint
# Сборка под все платформы
yarn run release

```
# Сборка под MacOS
yarn run release:mac

---
# Сборка под Windows
yarn run release:win

This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
# Сборка под Linux
yarn run release:lin
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://anilibria.tv"
},
"description": "AniLibrix - AniLibria desktop app",
"license": null,
"license": "MIT",
"main": "./dist/electron/main.js",
"repository": {
"type": "git",
Expand Down
20 changes: 12 additions & 8 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,19 @@ app.on('ready', async () => {
Main.createWindow({title: meta.name}).loadUrl();
Torrent.createWindow({title: `${meta.name} Torrent`}).loadUrl();

require('@electron/remote/main').enable(Main.getWindow().webContents);
require('@electron/remote/main').enable(Torrent.getWindow().webContents);
const mainWindow = Main.getWindow()
const torrentWindow = Torrent.getWindow()

// Main window close event
Main.getWindow().on('close', () => app.quit());
require('@electron/remote/main').enable(mainWindow.webContents);
require('@electron/remote/main').enable(torrentWindow.webContents);

mainWindow
// Auto update
.once('ready-to-show', () => {
mainWindow.show()
autoUpdater.checkForUpdatesAndNotify()
})
.on('close', () => app.quit()); // Main window close event

// Create menu
// Create tray icon
Expand All @@ -82,10 +90,6 @@ app.on('ready', async () => {
appHandlers(); // App handlers
torrentHandlers(); // Torrent handler
//downloadHandlers(); // Download handlers

// Auto update
Main.getWindow().once('ready-to-show', () => autoUpdater.checkForUpdatesAndNotify());

});


Expand Down
13 changes: 8 additions & 5 deletions src/main/utils/windows/appWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ export default class Window {
* @return this
*/
loadUrl() {
if (this.getWindow() && this.getWindowUrl()) {
this.getWindow().loadURL(this.getWindowUrl());
const window = this.getWindow()
const windowUrl = this.getWindowUrl()

if (window && windowUrl) {
window.loadURL(windowUrl);
}

return this;
Expand All @@ -73,9 +76,9 @@ export default class Window {
* @param payload
*/
sendToWindow(channel, payload) {
if (this.getWindow()) {

this.getWindow().webContents.send(channel, payload);
const window = this.getWindow()
if (window) {
window.webContents.send(channel, payload);

if (process.env.NODE_ENV === 'development') {
console.log({channel, payload})
Expand Down
11 changes: 10 additions & 1 deletion src/main/utils/windows/appWindowMain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Window from './appWindow'
import * as path from 'path'

class MainWindow extends Window {

Expand All @@ -15,14 +16,22 @@ class MainWindow extends Window {
const minWidth = 820;
const minHeight = 520;

const iconsPath = path.join(__dirname, '../../build/icons/app');
const icons = {
win32: 'anilibria.ico',
darwin: 'anilibria.icns',
linux: '256x256.png'
}

return {
height,
width,
minWidth,
minHeight,
show: true,
show: false,
frame: false,
darkTheme: true,
icon: path.join(iconsPath, icons[process.platform]),
titleBarStyle: 'hiddenInset',
useContentSize: true,
webPreferences: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@
this.player.on('playing', () => this.is_playing = true);
this.player.on('pause', () => this.is_playing = false);
// Fixing unknown bug with muted: true after plyer createing
// TODO: Maybe solve this problem in the best way in the future
this.player.on('playing', () => {
if (this.player.volume > 0 && this.player.config.muted) {
console.log('Fix muted:', this.player.volume, this.player.config.muted)
document.querySelector('video').muted = false
}
});
// Handler buffering events
this.player.on('waiting', () => this.is_buffering = true);
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/proxies/BaseProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default class BaseProxy {
const headers = {};

// Set header user agent
headers.UserAgent = `${meta.name}/${version}`;
headers['user-agent'] = `${meta.name}/${version}`;

// Set header session
// Set session in cookies
Expand Down

0 comments on commit 23ef7e8

Please sign in to comment.