Compare commits
No commits in common. "develop" and "v1.2.13" have entirely different histories.
@ -1,4 +1,10 @@
|
||||
import {DidFailLoadEvent, ipcRenderer, PageFaviconUpdatedEvent, UpdateTargetUrlEvent} from "electron";
|
||||
import {
|
||||
DidFailLoadEvent,
|
||||
ipcRenderer,
|
||||
PageFaviconUpdatedEvent,
|
||||
UpdateTargetUrlEvent,
|
||||
WebviewTag,
|
||||
} from "electron";
|
||||
import Service from "../../src/Service";
|
||||
import {IconProperties, IconSet, SpecialPages} from "../../src/Meta";
|
||||
import Config from "../../src/Config";
|
||||
@ -443,7 +449,6 @@ function loadService(serviceId: number, service: FrontService) {
|
||||
view.setAttribute('enableRemoteModule', 'false');
|
||||
view.setAttribute('partition', 'persist:service_' + service.partition);
|
||||
view.setAttribute('autosize', 'true');
|
||||
view.setAttribute('allowpopups', 'true');
|
||||
if (specialPages) view.setAttribute('src', specialPages.empty);
|
||||
|
||||
// Error handling
|
||||
@ -675,7 +680,7 @@ ipcRenderer.on('fullscreenchange', (e, fullscreen: boolean) => {
|
||||
});
|
||||
|
||||
type FrontService = Service & {
|
||||
view?: Electron.WebviewTag;
|
||||
view?: WebviewTag;
|
||||
viewReady?: boolean;
|
||||
li?: NavigationElement;
|
||||
};
|
||||
|
30
package.json
30
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tabs",
|
||||
"version": "1.3.1",
|
||||
"version": "1.2.13",
|
||||
"description": "Persistent and separate browser tabs in one window.",
|
||||
"author": {
|
||||
"name": "Alice Gaudon",
|
||||
@ -30,23 +30,23 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.6",
|
||||
"@babel/preset-env": "^7.9.6",
|
||||
"@fortawesome/fontawesome-free": "^6.1.0",
|
||||
"@types/node": "^14.6.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
||||
"@typescript-eslint/parser": "^5.15.0",
|
||||
"@fortawesome/fontawesome-free": "^5.13.0",
|
||||
"@types/node": "^14.17.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.3.0",
|
||||
"@typescript-eslint/parser": "^4.3.0",
|
||||
"babel-loader": "^8.1.0",
|
||||
"concurrently": "^7.0.0",
|
||||
"copy-webpack-plugin": "^10.2.4",
|
||||
"css-loader": "^6.3.0",
|
||||
"electron": "^17.1.2",
|
||||
"concurrently": "^6.0.0",
|
||||
"copy-webpack-plugin": "^9.0.0",
|
||||
"css-loader": "^5.0.0",
|
||||
"electron": "^13.0.0",
|
||||
"electron-builder": "^22.11.5",
|
||||
"eslint": "^8.11.0",
|
||||
"image-minimizer-webpack-plugin": "^3.2.3",
|
||||
"imagemin": "^8.0.1",
|
||||
"eslint": "^7.10.0",
|
||||
"file-loader": "^6.0.0",
|
||||
"image-minimizer-webpack-plugin": "^2.2.0",
|
||||
"imagemin-gifsicle": "^7.0.0",
|
||||
"imagemin-mozjpeg": "^10.0.0",
|
||||
"imagemin-mozjpeg": "^9.0.0",
|
||||
"imagemin-pngquant": "^9.0.2",
|
||||
"imagemin-svgo": "^10.0.1",
|
||||
"imagemin-svgo": "^9.0.0",
|
||||
"mini-css-extract-plugin": "^2.1.0",
|
||||
"sass": "^1.32.12",
|
||||
"sass-loader": "^12.1.0",
|
||||
@ -89,6 +89,6 @@
|
||||
"icon": "frontend/images/logo.png",
|
||||
"category": "public.app-category.utilities"
|
||||
},
|
||||
"electronVersion": "15.0.0"
|
||||
"electronVersion": "13.1.6"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {app, dialog, Menu, shell, Tray} from "electron";
|
||||
import {app, Menu, shell, Tray} from "electron";
|
||||
import Meta from "./Meta";
|
||||
import Config from "./Config";
|
||||
import Updater from "./Updater";
|
||||
@ -52,36 +52,16 @@ export default class Application {
|
||||
return this.devMode;
|
||||
}
|
||||
|
||||
public async openExternalLink(url: string): Promise<void> {
|
||||
if (url.startsWith('https://')) {
|
||||
console.log('Opening link', url);
|
||||
await shell.openExternal(url);
|
||||
} else {
|
||||
const {response} = await dialog.showMessageBox({
|
||||
message: 'Are you sure you want to open this link?\n' + url,
|
||||
type: 'question',
|
||||
buttons: ['Cancel', 'Open link'],
|
||||
});
|
||||
|
||||
if (response === 1) {
|
||||
console.log('Opening link', url);
|
||||
await shell.openExternal(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setupElectronTweaks() {
|
||||
// Open external links in default OS browser
|
||||
app.on('web-contents-created', (e, contents) => {
|
||||
if (contents.getType() === 'webview') {
|
||||
console.log('Setting external links to open in default OS browser');
|
||||
contents.setWindowOpenHandler(details => {
|
||||
if (details.url.startsWith(details.referrer.url)) return {action: 'allow'};
|
||||
|
||||
const url = details.url;
|
||||
this.openExternalLink(url)
|
||||
.catch(console.error);
|
||||
return {action: 'deny'};
|
||||
contents.on('new-window', (e, url) => {
|
||||
e.preventDefault();
|
||||
if (url.startsWith('https://')) {
|
||||
shell.openExternal(url).catch(console.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import path from "path";
|
||||
import {clipboard, ContextMenuParams, dialog, ipcMain, Menu, MenuItem, session, webContents} from "electron";
|
||||
import {clipboard, ContextMenuParams, dialog, ipcMain, Menu, MenuItem, session, shell, webContents,} from "electron";
|
||||
import ServiceSettingsWindow from "./ServiceSettingsWindow";
|
||||
import SettingsWindow from "./SettingsWindow";
|
||||
import Application from "../Application";
|
||||
@ -339,8 +339,10 @@ export default class MainWindow extends Window {
|
||||
menu.append(new MenuItem({
|
||||
label: 'Open URL in default browser',
|
||||
click: () => {
|
||||
this.application.openExternalLink(props.linkURL)
|
||||
.catch(console.error);
|
||||
if (props.linkURL.startsWith('https://')) {
|
||||
shell.openExternal(props.linkURL)
|
||||
.catch(console.error);
|
||||
}
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
const path = require('path');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
|
||||
const {extendDefaultPlugins} = require("svgo");
|
||||
const { extendDefaultPlugins } = require("svgo");
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const dev = process.env.NODE_ENV === 'development';
|
||||
@ -46,17 +46,14 @@ const config = {
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)$/i,
|
||||
type: 'asset/resource',
|
||||
generator: {
|
||||
filename: '../fonts/[name][ext]',
|
||||
},
|
||||
use: 'file-loader?name=../fonts/[name].[ext]',
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)$/i,
|
||||
type: 'asset/resource',
|
||||
generator: {
|
||||
filename: '../images/[name][ext]',
|
||||
},
|
||||
use: [
|
||||
'file-loader?name=../images/[name].[ext]',
|
||||
],
|
||||
type: 'asset',
|
||||
},
|
||||
{
|
||||
test: /\.ts$/i,
|
||||
@ -66,14 +63,13 @@ const config = {
|
||||
configFile: 'tsconfig.frontend.json',
|
||||
}
|
||||
},
|
||||
exclude: '/node_modules/',
|
||||
exclude: '/node_modules/'
|
||||
},
|
||||
{
|
||||
test: /\.html$/i,
|
||||
type: 'asset/resource',
|
||||
generator: {
|
||||
filename: '../[name][ext]',
|
||||
},
|
||||
use: [
|
||||
'file-loader?name=../[name].[ext]',
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
@ -87,53 +83,32 @@ const config = {
|
||||
]
|
||||
}),
|
||||
new ImageMinimizerPlugin({
|
||||
minimizer: {
|
||||
implementation: ImageMinimizerPlugin.imageminMinify,
|
||||
options: {
|
||||
// Lossless optimization with custom option
|
||||
// Feel free to experiment with options for better result for you
|
||||
plugins: [
|
||||
["gifsicle", {}],
|
||||
["mozjpeg", {}],
|
||||
["pngquant", {}],
|
||||
// Svgo configuration here https://github.com/svg/svgo#configuration
|
||||
[
|
||||
"svgo",
|
||||
{
|
||||
plugins: extendDefaultPlugins([
|
||||
{
|
||||
name: "removeViewBox",
|
||||
active: false,
|
||||
minimizerOptions: {
|
||||
// Lossless optimization with custom option
|
||||
// Feel free to experiment with options for better result for you
|
||||
plugins: [
|
||||
["gifsicle", {}],
|
||||
["mozjpeg", {}],
|
||||
["pngquant", {}],
|
||||
// Svgo configuration here https://github.com/svg/svgo#configuration
|
||||
[
|
||||
"svgo",
|
||||
{
|
||||
plugins: extendDefaultPlugins([
|
||||
{
|
||||
name: "removeViewBox",
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
name: "addAttributesToSVGElement",
|
||||
params: {
|
||||
attributes: [{ xmlns: "http://www.w3.org/2000/svg" }],
|
||||
},
|
||||
{
|
||||
name: "addAttributesToSVGElement",
|
||||
params: {
|
||||
attributes: [{ xmlns: "http://www.w3.org/2000/svg" }],
|
||||
},
|
||||
},
|
||||
]),
|
||||
},
|
||||
// todo: still not fixed
|
||||
// {
|
||||
// plugins: {
|
||||
// name: 'preset-default',
|
||||
// params: {
|
||||
// overrides: {
|
||||
// removeViewBox: {
|
||||
// active: false,
|
||||
// },
|
||||
// addAttributesToSVGElement: {
|
||||
// params: {
|
||||
// attributes: [{xmlns: "http://www.w3.org/2000/svg"}],
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
],
|
||||
},
|
||||
]),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user