From 8c94e188a278efa38ef9087ab7c295668bfab8ec Mon Sep 17 00:00:00 2001 From: SnailDOS Date: Sun, 9 Oct 2022 16:27:29 +0800 Subject: [PATCH 1/5] :tada: Migrate to SnailDOS felv3 --- package.json | 2 +- patches/@snaildos+fel+3.0.0.patch | 14 ++++++++++++++ patches/electron-chrome-extensions+3.9.0.patch | 14 -------------- 3 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 patches/@snaildos+fel+3.0.0.patch delete mode 100644 patches/electron-chrome-extensions+3.9.0.patch diff --git a/package.json b/package.json index 4054a605..0d5b85c5 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "@fortawesome/free-regular-svg-icons": "6.2.0", "@fortawesome/free-solid-svg-icons": "6.2.0", "@fortawesome/react-fontawesome": "0.2.0", - "electron-chrome-extensions": "3.9.0", + "@snaildos/fel": "3.0.0", "node-polyfill-webpack-plugin": "1.1.4", "postinstall-postinstall": "2.1.0", "react-query": "3.34.13", diff --git a/patches/@snaildos+fel+3.0.0.patch b/patches/@snaildos+fel+3.0.0.patch new file mode 100644 index 00000000..e08ad98c --- /dev/null +++ b/patches/@snaildos+fel+3.0.0.patch @@ -0,0 +1,14 @@ +diff --git a/node_modules/@snaildos/fel/dist/index.js b/node_modules/@snaildos/fel/dist/index.js +index 1f98afa..9857051 100644 +--- a/node_modules/@snaildos/fel/dist/index.js ++++ b/node_modules/@snaildos/fel/dist/index.js +@@ -2665,7 +2665,8 @@ class TabsAPI { + this.onRemoved(tabId); + }); + this.onCreated(tabId); +- this.onActivated(tabId); ++ const activeTab = this.ctx.store.getActiveTabFromWebContents(tab) ++ if (activeTab?.id === tabId) this.onActivated(tabId); + debug(`Observing tab[${tabId}][${tab.getType()}] ${tab.getURL()}`); + } + diff --git a/patches/electron-chrome-extensions+3.9.0.patch b/patches/electron-chrome-extensions+3.9.0.patch deleted file mode 100644 index 0bed985d..00000000 --- a/patches/electron-chrome-extensions+3.9.0.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/node_modules/electron-chrome-extensions/dist/index.js b/node_modules/electron-chrome-extensions/dist/index.js -index e21b4d2..019c552 100644 ---- a/node_modules/electron-chrome-extensions/dist/index.js -+++ b/node_modules/electron-chrome-extensions/dist/index.js -@@ -2631,7 +2631,8 @@ class TabsAPI { - this.onRemoved(tabId); - }); - this.onCreated(tabId); -- this.onActivated(tabId); -+ const activeTab = this.ctx.store.getActiveTabFromWebContents(tab) -+ if (activeTab?.id === tabId) this.onActivated(tabId); - debug(`Observing tab[${tabId}][${tab.getType()}] ${tab.getURL()}`); - } - \ No newline at end of file From 36414c3ddabda80b9b1e0da5eaf42c2d700bfafc Mon Sep 17 00:00:00 2001 From: SnailDOS Date: Sun, 9 Oct 2022 16:44:26 +0800 Subject: [PATCH 2/5] Migrate to @snaildos/felv3 --- src/main/sessions-service.ts | 2 +- src/main/windows-service.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/sessions-service.ts b/src/main/sessions-service.ts index cbea3452..ede59b4e 100644 --- a/src/main/sessions-service.ts +++ b/src/main/sessions-service.ts @@ -14,7 +14,7 @@ import { extractZip } from '~/utils/zip'; import { requestPermission } from './dialogs/permissions'; import * as rimraf from 'rimraf'; import { promisify } from 'util'; -import { ElectronChromeExtensions } from 'electron-chrome-extensions'; +import { ElectronChromeExtensions } from '@snaildos/fel'; const rf = promisify(rimraf); diff --git a/src/main/windows-service.ts b/src/main/windows-service.ts index 92dcf035..0cb6da49 100644 --- a/src/main/windows-service.ts +++ b/src/main/windows-service.ts @@ -3,7 +3,7 @@ import { AppWindow } from './windows/app'; import { app, BrowserWindow, ipcMain } from 'electron'; import { SessionsService } from './sessions-service'; -import { ElectronChromeExtensions } from 'electron-chrome-extensions'; +import { ElectronChromeExtensions } from '@snaildos/fel'; export class WindowsService { public list: AppWindow[] = []; @@ -15,14 +15,14 @@ export class WindowsService { constructor(sessions: SessionsService) { if (process.env.ENABLE_EXTENSIONS) { sessions.chromeExtensions = new ElectronChromeExtensions({ - modulePath: `${app.getAppPath()}/node_modules/electron-chrome-extensions`, + modulePath: `${app.getAppPath()}/node_modules/@snaildos/fel`, session: sessions.view, createTab: async (details) => { const win = this.list.find((x) => x.win.id === details.windowId) || this.lastFocused; - if (!win) throw new Error('Window not found'); + if (!win) throw new Error('Window Not Found'); const view = win.viewManager.create(details, false, false); win.webContents.send( 'create-tab', From 4b83ef5af39ae54b1b23e091b773df3b7774aea2 Mon Sep 17 00:00:00 2001 From: SnailDOS Date: Sun, 9 Oct 2022 16:45:11 +0800 Subject: [PATCH 3/5] Deprecate get-tab-zoom --- src/main/windows-service.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main/windows-service.ts b/src/main/windows-service.ts index 0cb6da49..e6394ccc 100644 --- a/src/main/windows-service.ts +++ b/src/main/windows-service.ts @@ -58,17 +58,6 @@ export class WindowsService { }, }); } - - ipcMain.handle('get-tab-zoom-deprecated', (e: any, tabId: number) => { - // const zoom = this.findByBrowserView(tabId).viewManager.views.get(tabId) - // .webContents.zoomFactor; - - const zoom = this.findByBrowserView(tabId).viewManager.views.get(tabId); - view.webContents.zoomFactor; - - alert(zoom); - // return "-10.0"; - }); } public open(incognito = false) { From 4ed33ebef3339576abb3631a7a4028312cbddf78 Mon Sep 17 00:00:00 2001 From: SnailDOS Date: Sun, 9 Oct 2022 17:40:17 +0800 Subject: [PATCH 4/5] :fire: Create Amoled Theme --- src/renderer/constants/themes.ts | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/renderer/constants/themes.ts b/src/renderer/constants/themes.ts index 36798187..b1e2b5f0 100644 --- a/src/renderer/constants/themes.ts +++ b/src/renderer/constants/themes.ts @@ -138,3 +138,37 @@ export const lavTheme: ITheme = { backgroundColor: '#1c1c1c', accentColor: BLUE_500, }; + +export const amoledTheme: ITheme = { + 'titlebar.backgroundColor': '#000000', + 'addressbar.backgroundColor': '#161616', + 'addressbar.textColor': '#fff', + 'toolbar.backgroundColor': '#111111', + 'toolbar.bottomLine.backgroundColor': 'rgba(255, 255, 255, 0.08)', + 'toolbar.lightForeground': true, + 'toolbar.separator.color': '#ffffff', + 'tab.selected.textColor': '#fff', + 'tab.textColor': 'rgba(255, 255, 255, 0.54)', + 'control.backgroundColor': 'rgba(255, 255, 255, 0.1)', + 'control.hover.backgroundColor': 'rgba(255, 255, 255, 0.12)', + 'control.valueColor': '#cfcfcf', + 'control.lightIcon': true, + 'switch.backgroundColor': '#111111', + 'dialog.backgroundColor': '#212121', + 'dialog.separator.color': 'rgba(255, 255, 255, 0.12)', + 'dialog.textColor': '#fff', + 'dialog.lightForeground': true, + 'searchBox.backgroundColor': '#262626', + 'searchBox.lightForeground': true, + 'pages.backgroundColor': '#191818', + 'pages.lightForeground': true, + 'pages.textColor': '#fff', + 'dropdown.backgroundColor': 'rgb(10, 10, 10)', + 'dropdown.backgroundColor.translucent': 'rgb(30, 30, 30, 0.3)', + 'dropdown.separator.color': 'rgba(255, 255, 255, 0.12)', + 'pages.navigationDrawer1.backgroundColor': 'rgba(255, 255, 255, 0.1)', + 'pages.navigationDrawer2.backgroundColor': 'rgba(255, 255, 255, 0.05)', + + backgroundColor: '#000000', + accentColor: BLUE_500, +}; From 9bde6279fbbcfe4f8a52cc727ca6277c68229b21 Mon Sep 17 00:00:00 2001 From: SnailDOS Date: Sun, 30 Oct 2022 01:11:51 +0800 Subject: [PATCH 5/5] :sparkles: Fix Orientation --- package.json | 2 +- .../{@snaildos+fel+3.0.0.patch => @snaildos+fel+3.0.1.patch} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename patches/{@snaildos+fel+3.0.0.patch => @snaildos+fel+3.0.1.patch} (100%) diff --git a/package.json b/package.json index f82f2ccb..e9a0c80d 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "@fortawesome/free-regular-svg-icons": "6.2.0", "@fortawesome/free-solid-svg-icons": "6.2.0", "@fortawesome/react-fontawesome": "0.2.0", - "@snaildos/fel": "3.0.0", + "@snaildos/fel": "3.0.1", "node-polyfill-webpack-plugin": "1.1.4", "postinstall-postinstall": "2.1.0", "react-query": "3.34.13", diff --git a/patches/@snaildos+fel+3.0.0.patch b/patches/@snaildos+fel+3.0.1.patch similarity index 100% rename from patches/@snaildos+fel+3.0.0.patch rename to patches/@snaildos+fel+3.0.1.patch