Skip to content

Commit 895d68c

Browse files
author
Devenor
committed
Reverted dependency additions
1 parent 9dc6a87 commit 895d68c

8 files changed

Lines changed: 24781 additions & 2283 deletions

File tree

package-lock.json

Lines changed: 23182 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"ci": "yarn install --silent --frozen-lockfile"
5555
},
5656
"dependencies": {
57-
"@electron/asar": "^3.2.18",
5857
"@fortawesome/fontawesome-svg-core": "^6.7.2",
5958
"@fortawesome/free-brands-svg-icons": "^6.7.2",
6059
"@fortawesome/free-regular-svg-icons": "^6.7.2",
@@ -64,8 +63,6 @@
6463
"autolinker": "^4.1.0",
6564
"bgutils-js": "^3.1.3",
6665
"electron-context-menu": "^4.0.5",
67-
"i18next": "^24.2.2",
68-
"i18next-fs-backend": "^2.6.0",
6966
"marked": "^15.0.7",
7067
"path-browserify": "^1.0.1",
7168
"portal-vue": "^2.1.7",

src/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const IpcChannels = {
44
DISABLE_PROXY: 'disable-proxy',
55
OPEN_EXTERNAL_LINK: 'open-external-link',
66
GET_SYSTEM_LOCALE: 'get-system-locale',
7-
GET_CURRENT_LOCALE: 'get-current-locale',
87
GET_PICTURES_PATH: 'get-pictures-path',
98
GET_NAVIGATION_HISTORY: 'get-navigation-history',
109
SHOW_SAVE_DIALOG: 'show-save-dialog',

src/main/index.js

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
app, BrowserWindow, dialog, Menu, ipcMain,
33
powerSaveBlocker, screen, session, shell,
44
nativeTheme, net, protocol, clipboard,
5-
Tray
5+
Tray, nativeImage
66
} from 'electron'
77
import path from 'path'
88
import cp from 'child_process'
@@ -17,21 +17,16 @@ import {
1717
} from '../constants'
1818
import * as baseHandlers from '../datastores/handlers/base'
1919
import { extractExpiryTimestamp, ImageCache } from './ImageCache'
20-
import { existsSync, writeFileSync, mkdirSync } from 'fs'
20+
import { existsSync, readFileSync } from 'fs'
2121
import asyncFs from 'fs/promises'
2222
import { promisify } from 'util'
23-
import { brotliDecompress, brotliDecompressSync } from 'zlib'
23+
import { brotliDecompress } from 'zlib'
2424

2525
import contextMenu from 'electron-context-menu'
2626

2727
import packageDetails from '../../package.json'
2828
import { generatePoToken } from './poTokenGenerator'
2929

30-
import os from 'os'
31-
import asar from '@electron/asar'
32-
33-
import i18next from 'i18next'
34-
import Backend from 'i18next-fs-backend'
3530

3631
const brotliDecompressAsync = promisify(brotliDecompress)
3732

@@ -610,10 +605,11 @@ function runApp() {
610605
})
611606

612607
function createTray() {
613-
const iconPath = process.env.NODE_ENV === 'development'
614-
? path.join(__dirname, '..', '..', '_icons', 'iconColor.png')
615-
: asarToTmp(path.join('_icons', 'iconColor.png'))
616-
tray = new Tray(iconPath)
608+
const icon = process.env.NODE_ENV === 'development'
609+
? readFileSync(path.join(__dirname, '..', '..', '_icons', 'iconColor.png'))
610+
: readFileSync(path.join(path.dirname(__dirname), '_icons', 'iconColor.png'))
611+
612+
tray = new Tray(nativeImage.createFromBuffer(icon))
617613
tray.setIgnoreDoubleClickEvents(true)
618614

619615
function click() {
@@ -623,11 +619,11 @@ function runApp() {
623619

624620
const menu = Menu.buildFromTemplate([
625621
{
626-
label: i18next.t('Tray.Show'),
622+
label: 'Show',
627623
click: () => click()
628624
},
629625
{
630-
label: i18next.t('Tray.Quit'),
626+
label: 'Quit',
631627
click: handleQuit
632628
}
633629
])
@@ -640,22 +636,6 @@ function runApp() {
640636
})
641637
}
642638

643-
function asarToTmp(relativePath, brotli = false) {
644-
const tmpFile = path.join(os.tmpdir(), 'freetube', relativePath)
645-
646-
if (existsSync(tmpFile)) {
647-
return tmpFile
648-
} else if (!existsSync(path.dirname(tmpFile))) {
649-
mkdirSync(path.dirname(tmpFile), { recursive: true })
650-
}
651-
652-
const asarFile = asar.extractFile(path.dirname(__dirname), relativePath)
653-
654-
writeFileSync(tmpFile, !brotli ? asarFile : brotliDecompressSync(asarFile))
655-
656-
return tmpFile
657-
}
658-
659639
/**
660640
* @param {string} extension
661641
*/
@@ -935,21 +915,6 @@ function runApp() {
935915
startupUrl = null
936916
})
937917

938-
ipcMain.on(IpcChannels.GET_CURRENT_LOCALE, (_, { targetLocale, fallbackLocale }) => {
939-
i18next.use(Backend).init({
940-
lng: targetLocale,
941-
fallbackLng: fallbackLocale,
942-
backend: {
943-
loadPath: process.env.NODE_ENV === 'development'
944-
? path.join(__dirname, '..', '..', 'static', 'locales', '{{lng}}.yaml')
945-
: asarToTmp(path.join('dist', 'static', 'locales', targetLocale + '.json.br'), true)
946-
},
947-
interpolation: {
948-
escapeValue: false
949-
}
950-
})
951-
})
952-
953918
function relaunch() {
954919
if (process.env.NODE_ENV === 'development') {
955920
app.exit(parseInt(process.env.FREETUBE_RELAUNCH_EXIT_CODE))

src/renderer/store/modules/settings.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ const sideEffectHandlers = {
381381

382382
i18n.locale = targetLocale
383383
await dispatch('getRegionData', targetLocale)
384-
385-
const { ipcRenderer } = require('electron')
386-
ipcRenderer.send(IpcChannels.GET_CURRENT_LOCALE, { targetLocale, fallbackLocale })
387384
},
388385

389386
defaultInvidiousInstance: ({ commit, rootState }, value) => {

static/locales/en-US.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,3 @@ KeyboardShortcutPrompt:
12051205
Last Chapter: Last Chapter
12061206
Next Chapter: Next Chapter
12071207
Skip by Tenths: Skip through video by percentage (3 skips to 30% of duration)
1208-
Tray:
1209-
Show: Show
1210-
Quit: Quit

static/locales/es.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,3 @@ Description:
12381238
Collapse Description: Mostrar menos
12391239
KeyboardShortcutPrompt:
12401240
New Window: Crear una nueva ventana
1241-
Tray:
1242-
Show: Mostrar
1243-
Quit: Salir

0 commit comments

Comments
 (0)