Cross-platform browser based on Chromium.
ElectronとReactを使用したクロスプラットフォーム対応のブラウザ。
Revision | 18437b2909552d41edb092d0d5f5706c8bc0063a (tree) |
---|---|
Time | 2019-06-17 02:24:52 |
Author | Aoichaan0513 <aoichaan0513@gmai...> |
Commiter | Aoichaan0513 |
v2.8.1
・メニューから拡大・縮小に対応
・アプリケーションがすでに開いている場合、新たなインスタンスを開かずに、新しいウィンドウを開くように変更
・ライブラリの追加
・その他バグ・不具合の修正
@@ -16,6 +16,8 @@ const config = require('./Config'); | ||
16 | 16 | const WindowManager = require('./WindowManager'); |
17 | 17 | const windowManager = new WindowManager(); |
18 | 18 | |
19 | +const singleInstance = app.requestSingleInstanceLock(); | |
20 | + | |
19 | 21 | let loginCallback; |
20 | 22 | let mainWindow; |
21 | 23 | let subWindow; |
@@ -34,7 +36,7 @@ getBaseWindow = (width = 1100, height = 680, minWidth = 500, minHeight = 360, x, | ||
34 | 36 | } |
35 | 37 | |
36 | 38 | module.exports = class Application { |
37 | - loadWindow = () => { | |
39 | + loadApplication = () => { | |
38 | 40 | protocol.registerSchemesAsPrivileged([ |
39 | 41 | { scheme: protocolStr, privileges: { standard: true, bypassCSP: true, secure: true } }, |
40 | 42 | { scheme: fileProtocolStr, privileges: { standard: false, bypassCSP: true, secure: true } } |
@@ -59,53 +61,59 @@ module.exports = class Application { | ||
59 | 61 | console.log('Update downloaded.'); |
60 | 62 | }); |
61 | 63 | |
62 | - app.on('ready', () => { | |
63 | - process.env.GOOGLE_API_KEY = config.googleAPIKey; | |
64 | - | |
65 | - app.setAppUserModelId(pkg.flast_package_id); | |
66 | - session.defaultSession.setUserAgent(session.defaultSession.getUserAgent().replace(/ Electron\/[0-9\.]*/g, '')); | |
67 | - | |
68 | - autoUpdater.checkForUpdatesAndNotify(); | |
69 | - Menu.setApplicationMenu(null); | |
70 | - | |
71 | - windowManager.addWindow(); | |
72 | - // this.loadExtension('gmngpagflejjoblmmamaonmnkghjmebh'); | |
73 | - // this.loadExtension('bdiadchoogngocfifcomfeakccmcecee'); | |
74 | - }); | |
75 | - | |
76 | - app.on('window-all-closed', () => { | |
77 | - if (process.platform !== 'darwin') { | |
78 | - app.quit(); | |
79 | - } | |
80 | - }); | |
81 | - | |
82 | - app.on('activate', () => { | |
83 | - }); | |
84 | - | |
85 | - app.on('login', (e, webContents, request, authInfo, callback) => { | |
86 | - e.preventDefault(); | |
87 | - | |
88 | - subWindow = getBaseWindow(320, 230, 320, 230); | |
89 | - // subWindow.setParentWindow(mainWindow); | |
90 | - subWindow.setMovable(false); | |
91 | - subWindow.setResizable(false); | |
92 | - subWindow.setMinimizable(false); | |
93 | - subWindow.setMaximizable(false); | |
94 | - const startUrl = process.env.ELECTRON_START_URL || url.format({ | |
95 | - pathname: path.join(__dirname, '/../build/index.html'), | |
96 | - protocol: 'file:', | |
97 | - slashes: true, | |
98 | - hash: '/authentication', | |
64 | + if (!singleInstance) { | |
65 | + app.quit(); | |
66 | + } else { | |
67 | + app.on('second-instance', (e, line, directory) => { | |
68 | + windowManager.addWindow(); | |
99 | 69 | }); |
100 | 70 | |
101 | - subWindow.loadURL(startUrl); | |
102 | - loginCallback = callback; | |
103 | - }); | |
104 | - | |
105 | - ipcMain.on('authorization', (event, arg) => { | |
106 | - loginCallback(arg.username, arg.password); | |
107 | - subWindow.close(); | |
108 | - }); | |
71 | + app.on('ready', () => { | |
72 | + process.env.GOOGLE_API_KEY = config.googleAPIKey; | |
73 | + | |
74 | + app.setAppUserModelId(pkg.flast_package_id); | |
75 | + session.defaultSession.setUserAgent(session.defaultSession.getUserAgent().replace(/ Electron\/[0-9\.]*/g, '')); | |
76 | + | |
77 | + autoUpdater.checkForUpdatesAndNotify(); | |
78 | + Menu.setApplicationMenu(null); | |
79 | + | |
80 | + windowManager.addWindow(); | |
81 | + }); | |
82 | + | |
83 | + app.on('window-all-closed', () => { | |
84 | + if (process.platform !== 'darwin') { | |
85 | + app.quit(); | |
86 | + } | |
87 | + }); | |
88 | + | |
89 | + app.on('activate', () => { | |
90 | + }); | |
91 | + | |
92 | + app.on('login', (e, webContents, request, authInfo, callback) => { | |
93 | + e.preventDefault(); | |
94 | + | |
95 | + subWindow = getBaseWindow(320, 230, 320, 230); | |
96 | + // subWindow.setParentWindow(mainWindow); | |
97 | + subWindow.setMovable(false); | |
98 | + subWindow.setResizable(false); | |
99 | + subWindow.setMinimizable(false); | |
100 | + subWindow.setMaximizable(false); | |
101 | + const startUrl = process.env.ELECTRON_START_URL || url.format({ | |
102 | + pathname: path.join(__dirname, '/../build/index.html'), | |
103 | + protocol: 'file:', | |
104 | + slashes: true, | |
105 | + hash: '/authentication', | |
106 | + }); | |
107 | + | |
108 | + subWindow.loadURL(startUrl); | |
109 | + loginCallback = callback; | |
110 | + }); | |
111 | + | |
112 | + ipcMain.on('authorization', (event, arg) => { | |
113 | + loginCallback(arg.username, arg.password); | |
114 | + subWindow.close(); | |
115 | + }); | |
116 | + } | |
109 | 117 | } |
110 | 118 | |
111 | 119 | loadExtension = (id) => { |
@@ -114,8 +122,6 @@ module.exports = class Application { | ||
114 | 122 | const versions = fs.readdirSync(`${extensionDir}/${id}`).sort(); |
115 | 123 | const version = versions.pop(); |
116 | 124 | |
117 | - // BrowserWindow.addExtension(`${extensionDir}/${id}/${version}`); | |
118 | - // BrowserWindow.addDevToolsExtension(`${extensionDir}/${id}/${version}`); | |
119 | 125 | extensionsMain.setSession(session.defaultSession); |
120 | 126 | extensionsMain.load(`${extensionDir}/${id}/${version}`); |
121 | 127 | } |
@@ -1,4 +1,4 @@ | ||
1 | 1 | const Application = require('./Application'); |
2 | 2 | |
3 | 3 | global.Application = new Application(); |
4 | -global.Application.loadWindow(); | |
\ No newline at end of file | ||
4 | +global.Application.loadApplication(); | |
\ No newline at end of file |
@@ -389,6 +389,10 @@ module.exports = class WindowManager { | ||
389 | 389 | ipcMain.on('window-add', (e, args) => { |
390 | 390 | this.addWindow(args.isPrivate); |
391 | 391 | }); |
392 | + | |
393 | + ipcMain.on('window-fullScreen', (e, args) => { | |
394 | + this.addWindow(args.isPrivate); | |
395 | + }); | |
392 | 396 | |
393 | 397 | ipcMain.on('window-fixBounds', (e, args) => { |
394 | 398 | this.windows.forEach((value, key) => { |
@@ -568,6 +572,13 @@ module.exports = class WindowManager { | ||
568 | 572 | view.webContents.reloadIgnoringCache(); |
569 | 573 | }); |
570 | 574 | |
575 | + localShortcut.register(window, 'F11', () => { | |
576 | + const window = this.windows.get(id); | |
577 | + | |
578 | + window.setFullScreen(!window.isFullScreen()); | |
579 | + this.fixBounds(id, (floatingWindows.indexOf(id) != -1)); | |
580 | + }) | |
581 | + | |
571 | 582 | this.windows.set(id, window); |
572 | 583 | |
573 | 584 | if (process.argv != undefined) { |
@@ -576,19 +587,26 @@ module.exports = class WindowManager { | ||
576 | 587 | } |
577 | 588 | |
578 | 589 | registerListeners = (id) => { |
579 | - ipcMain.on(`browserview-add-${id}`, (e, args) => { | |
590 | + ipcMain.on(`window-fullScreen-${id}`, (e, args) => { | |
591 | + const window = this.windows.get(id); | |
592 | + | |
593 | + window.setFullScreen(!window.isFullScreen()); | |
594 | + this.fixBounds(id, (floatingWindows.indexOf(id) != -1)); | |
595 | + }); | |
596 | + | |
597 | + ipcMain.on(`browserView-add-${id}`, (e, args) => { | |
580 | 598 | this.addView(id, args.url, args.isActive); |
581 | 599 | }); |
582 | 600 | |
583 | - ipcMain.on(`browserview-remove-${id}`, (e, args) => { | |
601 | + ipcMain.on(`browserView-remove-${id}`, (e, args) => { | |
584 | 602 | this.removeView(id, args.id); |
585 | 603 | }); |
586 | 604 | |
587 | - ipcMain.on(`browserview-select-${id}`, (e, args) => { | |
605 | + ipcMain.on(`browserView-select-${id}`, (e, args) => { | |
588 | 606 | this.selectView(id, args.id); |
589 | 607 | }); |
590 | 608 | |
591 | - ipcMain.on(`browserview-get-${id}`, (e, args) => { | |
609 | + ipcMain.on(`browserView-get-${id}`, (e, args) => { | |
592 | 610 | let datas = []; |
593 | 611 | |
594 | 612 | views[id].map((item) => { |
@@ -596,10 +614,10 @@ module.exports = class WindowManager { | ||
596 | 614 | |
597 | 615 | datas.push({ id: item.view.webContents.id, title: item.view.webContents.getTitle(), url, icon: this.getFavicon(url), color: '#0a84ff', isBookmarked: false }); |
598 | 616 | }); |
599 | - e.sender.send(`browserview-get-${id}`, { views: datas }); | |
617 | + e.sender.send(`browserView-get-${id}`, { views: datas }); | |
600 | 618 | }); |
601 | 619 | |
602 | - ipcMain.on(`browserview-goBack-${id}`, (e, args) => { | |
620 | + ipcMain.on(`browserView-goBack-${id}`, (e, args) => { | |
603 | 621 | views[id].filter(function (view, i) { |
604 | 622 | if (view.view.webContents.id == args.id) { |
605 | 623 | let webContents = views[id][i].view.webContents; |
@@ -609,7 +627,7 @@ module.exports = class WindowManager { | ||
609 | 627 | }); |
610 | 628 | }); |
611 | 629 | |
612 | - ipcMain.on(`browserview-goForward-${id}`, (e, args) => { | |
630 | + ipcMain.on(`browserView-goForward-${id}`, (e, args) => { | |
613 | 631 | views[id].filter(function (view, i) { |
614 | 632 | if (view.view.webContents.id == args.id) { |
615 | 633 | let webContents = views[id][i].view.webContents; |
@@ -619,7 +637,7 @@ module.exports = class WindowManager { | ||
619 | 637 | }); |
620 | 638 | }); |
621 | 639 | |
622 | - ipcMain.on(`browserview-reload-${id}`, (e, args) => { | |
640 | + ipcMain.on(`browserView-reload-${id}`, (e, args) => { | |
623 | 641 | views[id].filter(function (view, i) { |
624 | 642 | if (view.view.webContents.id == args.id) { |
625 | 643 | let webContents = views[id][i].view.webContents; |
@@ -628,7 +646,7 @@ module.exports = class WindowManager { | ||
628 | 646 | }); |
629 | 647 | }); |
630 | 648 | |
631 | - ipcMain.on(`browserview-stop-${id}`, (e, args) => { | |
649 | + ipcMain.on(`browserView-stop-${id}`, (e, args) => { | |
632 | 650 | views[id].filter(function (view, i) { |
633 | 651 | if (view.view.webContents.id == args.id) { |
634 | 652 | let webContents = views[id][i].view.webContents; |
@@ -637,7 +655,7 @@ module.exports = class WindowManager { | ||
637 | 655 | }); |
638 | 656 | }); |
639 | 657 | |
640 | - ipcMain.on(`browserview-goHome-${id}`, (e, args) => { | |
658 | + ipcMain.on(`browserView-goHome-${id}`, (e, args) => { | |
641 | 659 | views[id].filter(function (view, i) { |
642 | 660 | if (view.view.webContents.id == args.id) { |
643 | 661 | let webContents = views[id][i].view.webContents; |
@@ -646,7 +664,7 @@ module.exports = class WindowManager { | ||
646 | 664 | }); |
647 | 665 | }); |
648 | 666 | |
649 | - ipcMain.on(`browserview-loadURL-${id}`, (e, args) => { | |
667 | + ipcMain.on(`browserView-loadURL-${id}`, (e, args) => { | |
650 | 668 | views[id].filter(function (view, i) { |
651 | 669 | if (view.view.webContents.id == args.id) { |
652 | 670 | let webContents = views[id][i].view.webContents; |
@@ -655,7 +673,7 @@ module.exports = class WindowManager { | ||
655 | 673 | }); |
656 | 674 | }); |
657 | 675 | |
658 | - ipcMain.on(`browserview-loadFile-${id}`, (e, args) => { | |
676 | + ipcMain.on(`browserView-loadFile-${id}`, (e, args) => { | |
659 | 677 | views[id].filter(function (view, i) { |
660 | 678 | if (view.view.webContents.id == args.id) { |
661 | 679 | let webContents = views[id][i].view.webContents; |
@@ -664,6 +682,26 @@ module.exports = class WindowManager { | ||
664 | 682 | }); |
665 | 683 | }); |
666 | 684 | |
685 | + ipcMain.on(`browserView-zoomIn-${id}`, (e, args) => { | |
686 | + views[id].filter(function (view, i) { | |
687 | + if (view.view.webContents.id == args.id) { | |
688 | + let webContents = views[id][i].view.webContents; | |
689 | + console.log(webContents.getZoomFactor()); | |
690 | + webContents.setZoomFactor(webContents.getZoomFactor() + 0.1); | |
691 | + } | |
692 | + }); | |
693 | + }); | |
694 | + | |
695 | + ipcMain.on(`browserView-zoomOut-${id}`, (e, args) => { | |
696 | + views[id].filter(function (view, i) { | |
697 | + if (view.view.webContents.id == args.id) { | |
698 | + let webContents = views[id][i].view.webContents; | |
699 | + console.log(webContents.getZoomFactor()); | |
700 | + webContents.setZoomFactor(webContents.getZoomFactor() - 0.1); | |
701 | + } | |
702 | + }); | |
703 | + }); | |
704 | + | |
667 | 705 | ipcMain.on(`data-bookmark-add-${id}`, (e, args) => { |
668 | 706 | views[id].filter((view, i) => { |
669 | 707 | if (view.view.webContents.id == args.id) { |
@@ -715,7 +753,7 @@ module.exports = class WindowManager { | ||
715 | 753 | db.bookmarks.find({ url: view.webContents.getURL(), isPrivate: (String(id).startsWith('private')) }, (err, docs) => { |
716 | 754 | const url = view.webContents.getURL(); |
717 | 755 | |
718 | - window.webContents.send(`browserview-load-${id}`, { id: view.webContents.id, title: view.webContents.getTitle(), url: url, icon: this.getFavicon(url), color: '#0a84ff', isAudioPlaying: !view.webContents.isCurrentlyAudible(), isBookmarked: (docs.length > 0 ? true : false) }); | |
756 | + window.webContents.send(`browserView-load-${id}`, { id: view.webContents.id, title: view.webContents.getTitle(), url: url, icon: this.getFavicon(url), color: '#0a84ff', isAudioPlaying: !view.webContents.isCurrentlyAudible(), isBookmarked: (docs.length > 0 ? true : false) }); | |
719 | 757 | }); |
720 | 758 | } |
721 | 759 |
@@ -878,7 +916,7 @@ module.exports = class WindowManager { | ||
878 | 916 | this.updateNavigationState(windowId, item.view); |
879 | 917 | this.updateViewState(windowId, item.view); |
880 | 918 | |
881 | - window.webContents.send(`browserview-set-${windowId}`, { id: id }); | |
919 | + window.webContents.send(`browserView-set-${windowId}`, { id: id }); | |
882 | 920 | this.fixBounds(windowId, (floatingWindows.indexOf(windowId) != -1)); |
883 | 921 | } |
884 | 922 | }); |
@@ -890,7 +928,7 @@ module.exports = class WindowManager { | ||
890 | 928 | |
891 | 929 | window.setBrowserView(item.view); |
892 | 930 | window.setTitle(`${item.view.webContents.getTitle()} - ${pkg.name}`); |
893 | - window.webContents.send(`browserview-set-${windowId}`, { id: item.id }); | |
931 | + window.webContents.send(`browserView-set-${windowId}`, { id: item.id }); | |
894 | 932 | this.fixBounds(windowId, (floatingWindows.indexOf(windowId) != -1)); |
895 | 933 | } |
896 | 934 |
@@ -902,7 +940,7 @@ module.exports = class WindowManager { | ||
902 | 940 | datas.push({ id: views[windowId][i].view.webContents.id, title: views[windowId][i].view.webContents.getTitle(), url: url, icon: this.getFavicon(url) }); |
903 | 941 | } |
904 | 942 | const window = this.windows.get(windowId); |
905 | - window.webContents.send(`browserview-get-${windowId}`, { views: datas }); | |
943 | + window.webContents.send(`browserView-get-${windowId}`, { views: datas }); | |
906 | 944 | } |
907 | 945 | |
908 | 946 | addTab = (windowId, url = config.get('homePage.defaultPage'), isActive = true) => { |
@@ -919,6 +957,8 @@ module.exports = class WindowManager { | ||
919 | 957 | } |
920 | 958 | }); |
921 | 959 | |
960 | + view.webContents.setVisualZoomLevelLimits(1, 3); | |
961 | + | |
922 | 962 | const window = this.windows.get(windowId); |
923 | 963 | const id = view.webContents.id; |
924 | 964 |
@@ -930,12 +970,12 @@ module.exports = class WindowManager { | ||
930 | 970 | view.webContents.on('did-start-loading', () => { |
931 | 971 | if (view.isDestroyed()) return; |
932 | 972 | |
933 | - window.webContents.send(`browserview-start-loading-${windowId}`, { id: id }); | |
973 | + window.webContents.send(`browserView-start-loading-${windowId}`, { id: id }); | |
934 | 974 | }); |
935 | 975 | view.webContents.on('did-stop-loading', () => { |
936 | 976 | if (view.isDestroyed()) return; |
937 | 977 | |
938 | - window.webContents.send(`browserview-stop-loading-${windowId}`, { id: id }); | |
978 | + window.webContents.send(`browserView-stop-loading-${windowId}`, { id: id }); | |
939 | 979 | }); |
940 | 980 | |
941 | 981 | view.webContents.on('did-start-navigation', (e) => { |
@@ -980,7 +1020,7 @@ module.exports = class WindowManager { | ||
980 | 1020 | viewId = this.getRandString(12); |
981 | 1021 | |
982 | 1022 | this.getCertificate(view.webContents.getURL()).then((certificate) => { |
983 | - window.webContents.send(`browserview-certificate-${windowId}`, { id, certificate }); | |
1023 | + window.webContents.send(`browserView-certificate-${windowId}`, { id, certificate }); | |
984 | 1024 | }); |
985 | 1025 | |
986 | 1026 | window.setTitle(`${view.webContents.getTitle()} - ${pkg.name}`); |
@@ -1027,7 +1067,7 @@ module.exports = class WindowManager { | ||
1027 | 1067 | this.updateViewState(windowId, view); |
1028 | 1068 | this.updateNavigationState(windowId, view); |
1029 | 1069 | |
1030 | - window.webContents.send(`browserview-theme-color-${windowId}`, { id: view.webContents.id, color }); | |
1070 | + window.webContents.send(`browserView-theme-color-${windowId}`, { id: view.webContents.id, color }); | |
1031 | 1071 | }); |
1032 | 1072 | |
1033 | 1073 | view.webContents.on('update-target-url', (e, url) => { |
@@ -1550,7 +1590,7 @@ module.exports = class WindowManager { | ||
1550 | 1590 | views[windowId].push({ id, view, isNotificationBar: false }); |
1551 | 1591 | |
1552 | 1592 | if (isActive) { |
1553 | - window.webContents.send(`browserview-set-${windowId}`, { id: id }); | |
1593 | + window.webContents.send(`browserView-set-${windowId}`, { id: id }); | |
1554 | 1594 | window.setBrowserView(view); |
1555 | 1595 | } |
1556 | 1596 |
@@ -56,11 +56,17 @@ module.exports = { | ||
56 | 56 | newTab: 'New tab', |
57 | 57 | newWindow: 'New window', |
58 | 58 | openPrivateWindow: 'Open Private window', |
59 | + zoom: { | |
60 | + name: 'Zoom', | |
61 | + zoomIn: 'Zoom in', | |
62 | + zoomOut: 'Zoom out', | |
63 | + fullScreen: 'Full Screen' | |
64 | + }, | |
59 | 65 | history: 'History', |
60 | 66 | downloads: 'Downloads', |
61 | 67 | bookmarks: 'Bookmarks', |
62 | 68 | app: { |
63 | - app: 'Application', | |
69 | + name: 'Application', | |
64 | 70 | list: 'App list', |
65 | 71 | store: 'Flast Store', |
66 | 72 | install: 'Install {title}', |
@@ -56,6 +56,12 @@ module.exports = { | ||
56 | 56 | newTab: '新しいタブ', |
57 | 57 | newWindow: '新しいウィンドウ', |
58 | 58 | openPrivateWindow: 'プライベート ウィンドウを開く', |
59 | + zoom: { | |
60 | + name: 'ズーム', | |
61 | + zoomIn: '拡大', | |
62 | + zoomOut: '縮小', | |
63 | + fullScreen: '全画面表示' | |
64 | + }, | |
59 | 65 | history: '履歴', |
60 | 66 | downloads: 'ダウンロード', |
61 | 67 | bookmarks: 'ブックマーク', |
@@ -1,7 +1,7 @@ | ||
1 | 1 | { |
2 | 2 | "name": "Flast", |
3 | 3 | "description": "Cross-platform browser based on Chromium.", |
4 | - "version": "2.7.4", | |
4 | + "version": "2.8.1", | |
5 | 5 | "flast_channel": "Stable", |
6 | 6 | "flast_package_id": "org.aoichaan0513.Flast", |
7 | 7 | "private": true, |
@@ -171,20 +171,20 @@ class BrowserView extends Component { | ||
171 | 171 | }); |
172 | 172 | */ |
173 | 173 | |
174 | - ipcRenderer.on(`browserview-start-loading-${this.props.windowId}`, (e, args) => { | |
174 | + ipcRenderer.on(`browserView-start-loading-${this.props.windowId}`, (e, args) => { | |
175 | 175 | if (args.id === this.props.index) { |
176 | 176 | this.setState({ isLoading: true }); |
177 | 177 | this.blockCount = 0; |
178 | 178 | } |
179 | 179 | }); |
180 | 180 | |
181 | - ipcRenderer.on(`browserview-stop-loading-${this.props.windowId}`, (e, args) => { | |
181 | + ipcRenderer.on(`browserView-stop-loading-${this.props.windowId}`, (e, args) => { | |
182 | 182 | if (args.id === this.props.index) { |
183 | 183 | this.setState({ isLoading: false }); |
184 | 184 | } |
185 | 185 | }); |
186 | 186 | |
187 | - ipcRenderer.on(`browserview-load-${this.props.windowId}`, (e, args) => { | |
187 | + ipcRenderer.on(`browserView-load-${this.props.windowId}`, (e, args) => { | |
188 | 188 | if (args.id === this.props.index) { |
189 | 189 | this.props.updateTab(); |
190 | 190 | this.setState({ viewUrl: args.url, isBookmarked: args.isBookmarked }); |
@@ -193,7 +193,7 @@ class BrowserView extends Component { | ||
193 | 193 | } |
194 | 194 | }); |
195 | 195 | |
196 | - ipcRenderer.on(`browserview-certificate-${this.props.windowId}`, (e, args) => { | |
196 | + ipcRenderer.on(`browserView-certificate-${this.props.windowId}`, (e, args) => { | |
197 | 197 | if (args.id === this.props.index) { |
198 | 198 | this.setState({ certificate: args.certificate }); |
199 | 199 | } |
@@ -211,7 +211,7 @@ class BrowserView extends Component { | ||
211 | 211 | } |
212 | 212 | }); |
213 | 213 | |
214 | - ipcRenderer.on(`browserview-permission-${this.props.windowId}`, (e, args) => { | |
214 | + ipcRenderer.on(`browserView-permission-${this.props.windowId}`, (e, args) => { | |
215 | 215 | if (args.id === this.props.index) { |
216 | 216 | const toolTip = findDOMNode(this.infomationTooltip)._tippy; |
217 | 217 | toolTip.setContent(args.content); |
@@ -240,16 +240,16 @@ class BrowserView extends Component { | ||
240 | 240 | if (this.state.barText.length > 0 || this.state.barText !== '') { |
241 | 241 | this.setState({ isInputed: false }); |
242 | 242 | if (isURL(this.state.barText) && !this.state.barText.includes('://')) { |
243 | - ipcRenderer.send(`browserview-loadURL-${this.props.windowId}`, { id: this.props.index, url: `http://${this.state.barText}` }); | |
243 | + ipcRenderer.send(`browserView-loadURL-${this.props.windowId}`, { id: this.props.index, url: `http://${this.state.barText}` }); | |
244 | 244 | } else if (!this.state.barText.includes('://')) { |
245 | - ipcRenderer.send(`browserview-loadURL-${this.props.windowId}`, { id: this.props.index, url: this.getSearchEngine().url.replace('%s', this.state.barText) }); | |
245 | + ipcRenderer.send(`browserView-loadURL-${this.props.windowId}`, { id: this.props.index, url: this.getSearchEngine().url.replace('%s', this.state.barText) }); | |
246 | 246 | } else { |
247 | 247 | const pattern = /^(file:\/\/\S.*)\S*$/; |
248 | 248 | |
249 | 249 | if (pattern.test(this.state.barText)) { |
250 | - ipcRenderer.send(`browserview-loadFile-${this.props.windowId}`, { id: this.props.index, url: this.state.barText.replace('file:///', '') }); | |
250 | + ipcRenderer.send(`browserView-loadFile-${this.props.windowId}`, { id: this.props.index, url: this.state.barText.replace('file:///', '') }); | |
251 | 251 | } else { |
252 | - ipcRenderer.send(`browserview-loadURL-${this.props.windowId}`, { id: this.props.index, url: this.state.barText }); | |
252 | + ipcRenderer.send(`browserView-loadURL-${this.props.windowId}`, { id: this.props.index, url: this.state.barText }); | |
253 | 253 | } |
254 | 254 | } |
255 | 255 | } else { |
@@ -309,23 +309,23 @@ class BrowserView extends Component { | ||
309 | 309 | } |
310 | 310 | |
311 | 311 | goBack = () => { |
312 | - ipcRenderer.send(`browserview-goBack-${this.props.windowId}`, { id: this.props.index }); | |
312 | + ipcRenderer.send(`browserView-goBack-${this.props.windowId}`, { id: this.props.index }); | |
313 | 313 | } |
314 | 314 | |
315 | 315 | goForward = () => { |
316 | - ipcRenderer.send(`browserview-goForward-${this.props.windowId}`, { id: this.props.index }); | |
316 | + ipcRenderer.send(`browserView-goForward-${this.props.windowId}`, { id: this.props.index }); | |
317 | 317 | } |
318 | 318 | |
319 | 319 | reload = () => { |
320 | 320 | if (!this.state.isLoading) { |
321 | - ipcRenderer.send(`browserview-reload-${this.props.windowId}`, { id: this.props.index }); | |
321 | + ipcRenderer.send(`browserView-reload-${this.props.windowId}`, { id: this.props.index }); | |
322 | 322 | } else { |
323 | - ipcRenderer.send(`browserview-stop-${this.props.windowId}`, { id: this.props.index }); | |
323 | + ipcRenderer.send(`browserView-stop-${this.props.windowId}`, { id: this.props.index }); | |
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | 327 | goHome = () => { |
328 | - ipcRenderer.send(`browserview-goHome-${this.props.windowId}`, { id: this.props.index }); | |
328 | + ipcRenderer.send(`browserView-goHome-${this.props.windowId}`, { id: this.props.index }); | |
329 | 329 | } |
330 | 330 | |
331 | 331 | certificate = () => { |
@@ -370,7 +370,7 @@ class BrowserView extends Component { | ||
370 | 370 | ]); |
371 | 371 | menu.popup({ |
372 | 372 | x: remote.getCurrentWindow().getSize()[0] - 57, |
373 | - y: 65 | |
373 | + y: 67 | |
374 | 374 | }); |
375 | 375 | } |
376 | 376 |
@@ -393,6 +393,29 @@ class BrowserView extends Component { | ||
393 | 393 | }, |
394 | 394 | { type: 'separator' }, |
395 | 395 | { |
396 | + label: lang.window.toolBar.menu.menus.zoom.name, | |
397 | + type: 'submenu', | |
398 | + submenu: [ | |
399 | + { | |
400 | + label: lang.window.toolBar.menu.menus.zoom.zoomIn, | |
401 | + icon: `${app.getAppPath()}/static/zoom_in.png`, | |
402 | + click: () => { ipcRenderer.send(`browserView-zoomIn-${this.props.windowId}`, { id: this.props.index }); } | |
403 | + }, | |
404 | + { | |
405 | + label: lang.window.toolBar.menu.menus.zoom.zoomOut, | |
406 | + icon: `${app.getAppPath()}/static/zoom_out.png`, | |
407 | + click: () => { ipcRenderer.send(`browserView-zoomOut-${this.props.windowId}`, { id: this.props.index }); } | |
408 | + }, | |
409 | + { type: 'separator' }, | |
410 | + { | |
411 | + label: lang.window.toolBar.menu.menus.zoom.fullScreen, | |
412 | + icon: `${app.getAppPath()}/static/fullscreen.png`, | |
413 | + click: () => { ipcRenderer.send(`window-fullScreen-${this.props.windowId}`, {}); } | |
414 | + } | |
415 | + ] | |
416 | + }, | |
417 | + { type: 'separator' }, | |
418 | + { | |
396 | 419 | label: lang.window.toolBar.menu.menus.history, |
397 | 420 | icon: `${app.getAppPath()}/static/history.png`, |
398 | 421 | click: () => { this.props.addTab(`${protocolStr}://history/`); } |
@@ -457,7 +480,7 @@ class BrowserView extends Component { | ||
457 | 480 | ]); |
458 | 481 | menu.popup({ |
459 | 482 | x: remote.getCurrentWindow().getSize()[0] - 24, |
460 | - y: 65 | |
483 | + y: 67 | |
461 | 484 | }); |
462 | 485 | } |
463 | 486 |
@@ -536,11 +559,11 @@ class BrowserWindow extends Component { | ||
536 | 559 | this.addTab(args.url); |
537 | 560 | }); |
538 | 561 | |
539 | - ipcRenderer.on(`browserview-get-${this.props.match.params.windowId}`, (e, args) => { | |
562 | + ipcRenderer.on(`browserView-get-${this.props.match.params.windowId}`, (e, args) => { | |
540 | 563 | this.setState({ tabs: args.views }); |
541 | 564 | }); |
542 | 565 | |
543 | - ipcRenderer.on(`browserview-set-${this.props.match.params.windowId}`, (e, args) => { | |
566 | + ipcRenderer.on(`browserView-set-${this.props.match.params.windowId}`, (e, args) => { | |
544 | 567 | this.setState({ current: args.id }); |
545 | 568 | }); |
546 | 569 | } |
@@ -582,18 +605,18 @@ class BrowserWindow extends Component { | ||
582 | 605 | } |
583 | 606 | |
584 | 607 | getTabs = () => { |
585 | - ipcRenderer.send(`browserview-get-${this.props.match.params.windowId}`, {}); | |
608 | + ipcRenderer.send(`browserView-get-${this.props.match.params.windowId}`, {}); | |
586 | 609 | } |
587 | 610 | |
588 | 611 | addTab = (url = (config.get('homePage.isDefaultHomePage') ? `${protocolStr}://home/` : config.get('homePage.defaultPage'))) => { |
589 | - ipcRenderer.send(`browserview-add-${this.props.match.params.windowId}`, { url, isActive: true }); | |
590 | - ipcRenderer.send(`browserview-get-${this.props.match.params.windowId}`, {}); | |
612 | + ipcRenderer.send(`browserView-add-${this.props.match.params.windowId}`, { url, isActive: true }); | |
613 | + ipcRenderer.send(`browserView-get-${this.props.match.params.windowId}`, {}); | |
591 | 614 | this.setState({ current: this.state.tabs.length }); |
592 | 615 | } |
593 | 616 | |
594 | 617 | removeTab = (i) => { |
595 | - ipcRenderer.send(`browserview-remove-${this.props.match.params.windowId}`, { id: i }); | |
596 | - ipcRenderer.send(`browserview-get-${this.props.match.params.windowId}`, {}); | |
618 | + ipcRenderer.send(`browserView-remove-${this.props.match.params.windowId}`, { id: i }); | |
619 | + ipcRenderer.send(`browserView-get-${this.props.match.params.windowId}`, {}); | |
597 | 620 | |
598 | 621 | this.forceUpdate(); |
599 | 622 | if ((this.state.tabs.length - 1) < 1) { |
@@ -602,7 +625,7 @@ class BrowserWindow extends Component { | ||
602 | 625 | } |
603 | 626 | |
604 | 627 | updateTab = () => { |
605 | - ipcRenderer.send(`browserview-get-${this.props.match.params.windowId}`, {}); | |
628 | + ipcRenderer.send(`browserView-get-${this.props.match.params.windowId}`, {}); | |
606 | 629 | } |
607 | 630 | |
608 | 631 | getForegroundColor = (hexColor) => { |
@@ -662,7 +685,7 @@ class BrowserWindow extends Component { | ||
662 | 685 | <TabContainer ref={ref => { this.tabContainer = ref; }}> |
663 | 686 | {this.state.tabs.map((tab, i) => { |
664 | 687 | return ( |
665 | - <Tab isDarkModeOrPrivateMode={config.get('design.isDarkTheme') || String(this.props.match.params.windowId).startsWith('private')} isActive={tab.id === this.state.current} isFixed={tab.fixed} accentColor={tab.color} onClick={() => { ipcRenderer.send(`browserview-select-${this.props.match.params.windowId}`, { id: tab.id }); this.forceUpdate(); }} onContextMenu={this.handleContextMenu.bind(this, tab.id)}> | |
688 | + <Tab isDarkModeOrPrivateMode={config.get('design.isDarkTheme') || String(this.props.match.params.windowId).startsWith('private')} isActive={tab.id === this.state.current} isFixed={tab.fixed} accentColor={tab.color} onClick={() => { ipcRenderer.send(`browserView-select-${this.props.match.params.windowId}`, { id: tab.id }); this.forceUpdate(); }} onContextMenu={this.handleContextMenu.bind(this, tab.id)}> | |
666 | 689 | <TabIcon src={tab.icon !== undefined ? tab.icon : (config.get('design.isDarkTheme') || String(this.props.match.params.windowId).startsWith('private') ? DarkPublicIcon : LightPublicIcon)} width={18} height={18} /> |
667 | 690 | <TabTitle color={this.getForegroundColor(!config.get('design.isDarkTheme') || !String(this.props.match.params.windowId).startsWith('private') ? (platform.isWin32 || platform.isDarwin ? `#${systemPreferences.getAccentColor()}` : '#353535') : '#353535')} isAudioPlaying={tab.isAudioPlaying} isFixed={tab.fixed} title={tab.title}>{tab.title}</TabTitle> |
668 | 691 | <TabCloseButton isActive={tab.id === this.state.current} isFixed={tab.fixed} isRight={true} src={this.isDarkModeOrPrivateMode.bind(this, LightCloseIcon, DarkCloseIcon)} size={14} title={lang.window.titleBar.tab.close} onClick={() => { this.removeTab(tab.id); this.forceUpdate(); }} /> |
@@ -1,7 +1,7 @@ | ||
1 | 1 | { |
2 | 2 | "name": "Flast", |
3 | 3 | "description": "Cross-platform browser based on Chromium.", |
4 | - "version": "2.7.4", | |
4 | + "version": "2.8.1", | |
5 | 5 | "flast_channel": "Stable", |
6 | 6 | "flast_package_id": "org.aoichaan0513.Flast", |
7 | 7 | "private": true, |