Compare commits

..

No commits in common. "develop" and "v1.2.11" have entirely different histories.

12 changed files with 2903 additions and 2189 deletions

View File

@ -4,7 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>An error occured</title> <title>An error occured</title>
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
content="style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'"> content="style-src 'self' 'unsafe-inline' https://use.fontawesome.com; font-src 'self' https://use.fontawesome.com; script-src 'self'">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="css/layout.css"> <link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/error.css"> <link rel="stylesheet" href="css/error.css">

View File

@ -4,7 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>An error occured</title> <title>An error occured</title>
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
content="style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'"> content="style-src 'self' 'unsafe-inline' https://use.fontawesome.com; font-src 'self' https://use.fontawesome.com; script-src 'self'">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="css/layout.css"> <link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/error.css"> <link rel="stylesheet" href="css/error.css">

View File

@ -4,7 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Tabs</title> <title>Tabs</title>
<meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self' 'sha256-oPC0l5nxLnJ2LX6qU9Laxa4/cjhuHDRIqdUsBDWYqnw='"> <meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline' https://use.fontawesome.com; font-src 'self' https://use.fontawesome.com; script-src 'self' 'sha256-oPC0l5nxLnJ2LX6qU9Laxa4/cjhuHDRIqdUsBDWYqnw='">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="css/layout.css"> <link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/index.css"> <link rel="stylesheet" href="css/index.css">

View File

@ -1,5 +1,3 @@
@import url('../../node_modules/@fortawesome/fontawesome-free/css/all.css');
* { * {
box-sizing: border-box; box-sizing: border-box;
} }

View File

@ -4,7 +4,10 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Service settings</title> <title>Service settings</title>
<meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self' 'sha256-5gY/z34s5Mtc3YL8GkwZQhzk9LymQIuFUQRVvs7Gh0o='"> <meta http-equiv="Content-Security-Policy" content="style-src 'self' 'unsafe-inline' https://use.fontawesome.com; font-src 'self' https://use.fontawesome.com; script-src 'self' 'sha256-5gY/z34s5Mtc3YL8GkwZQhzk9LymQIuFUQRVvs7Gh0o='">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="css/layout.css"> <link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/service-settings.css"> <link rel="stylesheet" href="css/service-settings.css">

View File

@ -5,7 +5,10 @@
<title>Service settings</title> <title>Service settings</title>
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
content="style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self' 'sha256-UoPUIMX0PZl7cy3YoegZ0EDleSaHxTURPMyK09xsa0E='"> content="style-src 'self' 'unsafe-inline' https://use.fontawesome.com; font-src 'self' https://use.fontawesome.com; script-src 'self' 'sha256-UoPUIMX0PZl7cy3YoegZ0EDleSaHxTURPMyK09xsa0E='">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="css/layout.css"> <link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/service-settings.css"> <link rel="stylesheet" href="css/service-settings.css">

View File

@ -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 Service from "../../src/Service";
import {IconProperties, IconSet, SpecialPages} from "../../src/Meta"; import {IconProperties, IconSet, SpecialPages} from "../../src/Meta";
import Config from "../../src/Config"; import Config from "../../src/Config";
@ -443,7 +449,6 @@ function loadService(serviceId: number, service: FrontService) {
view.setAttribute('enableRemoteModule', 'false'); view.setAttribute('enableRemoteModule', 'false');
view.setAttribute('partition', 'persist:service_' + service.partition); view.setAttribute('partition', 'persist:service_' + service.partition);
view.setAttribute('autosize', 'true'); view.setAttribute('autosize', 'true');
view.setAttribute('allowpopups', 'true');
if (specialPages) view.setAttribute('src', specialPages.empty); if (specialPages) view.setAttribute('src', specialPages.empty);
// Error handling // Error handling
@ -675,7 +680,7 @@ ipcRenderer.on('fullscreenchange', (e, fullscreen: boolean) => {
}); });
type FrontService = Service & { type FrontService = Service & {
view?: Electron.WebviewTag; view?: WebviewTag;
viewReady?: boolean; viewReady?: boolean;
li?: NavigationElement; li?: NavigationElement;
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "tabs", "name": "tabs",
"version": "1.3.1", "version": "1.2.11",
"description": "Persistent and separate browser tabs in one window.", "description": "Persistent and separate browser tabs in one window.",
"author": { "author": {
"name": "Alice Gaudon", "name": "Alice Gaudon",
@ -30,28 +30,27 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.9.6", "@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6", "@babel/preset-env": "^7.9.6",
"@fortawesome/fontawesome-free": "^6.1.0", "@fortawesome/fontawesome-free": "^5.13.0",
"@types/node": "^14.6.2", "@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/eslint-plugin": "^5.15.0", "@typescript-eslint/parser": "^4.3.0",
"@typescript-eslint/parser": "^5.15.0",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"concurrently": "^7.0.0", "concurrently": "^6.0.0",
"copy-webpack-plugin": "^10.2.4", "copy-webpack-plugin": "^8.0.0",
"css-loader": "^6.3.0", "css-loader": "^5.0.0",
"electron": "^17.1.2", "electron": "^12.0.0",
"electron-builder": "^22.11.5", "electron-builder": "^22.4.0",
"eslint": "^8.11.0", "eslint": "^7.10.0",
"image-minimizer-webpack-plugin": "^3.2.3", "file-loader": "^6.0.0",
"imagemin": "^8.0.1", "imagemin": "^7.0.1",
"imagemin-gifsicle": "^7.0.0", "imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^10.0.0", "imagemin-mozjpeg": "^9.0.0",
"imagemin-pngquant": "^9.0.2", "imagemin-pngquant": "^9.0.0",
"imagemin-svgo": "^10.0.1", "imagemin-svgo": "^9.0.0",
"mini-css-extract-plugin": "^2.1.0", "img-loader": "^3.0.1",
"sass": "^1.32.12", "mini-css-extract-plugin": "^1.2.0",
"sass-loader": "^12.1.0", "node-sass": "^5.0.0",
"svgo": "^2.3.1", "sass-loader": "^11.0.0",
"ts-loader": "^9.1.2", "ts-loader": "^8.0.0",
"typescript": "^4.0.2", "typescript": "^4.0.2",
"webpack": "^5.2.0", "webpack": "^5.2.0",
"webpack-cli": "^4.1.0" "webpack-cli": "^4.1.0"
@ -70,7 +69,7 @@
], ],
"linux": { "linux": {
"target": "AppImage", "target": "AppImage",
"icon": "frontend/images/logo.png", "icon": "resources/images/logo.png",
"category": "Utility", "category": "Utility",
"executableName": "tabs", "executableName": "tabs",
"desktop": { "desktop": {
@ -80,15 +79,15 @@
}, },
"win": { "win": {
"target": "nsis", "target": "nsis",
"icon": "frontend/images/logo.png", "icon": "resources/images/logo.png",
"publisherName": "Alice Gaudon", "publisherName": "Alice Gaudon",
"verifyUpdateCodeSignature": "false" "verifyUpdateCodeSignature": "false"
}, },
"mac": { "mac": {
"target": "default", "target": "default",
"icon": "frontend/images/logo.png", "icon": "resources/images/logo.png",
"category": "public.app-category.utilities" "category": "public.app-category.utilities"
}, },
"electronVersion": "15.0.0" "electronVersion": "12.0.4"
} }
} }

View File

@ -1,4 +1,4 @@
import {app, dialog, Menu, shell, Tray} from "electron"; import {app, Menu, shell, Tray} from "electron";
import Meta from "./Meta"; import Meta from "./Meta";
import Config from "./Config"; import Config from "./Config";
import Updater from "./Updater"; import Updater from "./Updater";
@ -52,36 +52,16 @@ export default class Application {
return this.devMode; 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() { private setupElectronTweaks() {
// Open external links in default OS browser // Open external links in default OS browser
app.on('web-contents-created', (e, contents) => { app.on('web-contents-created', (e, contents) => {
if (contents.getType() === 'webview') { if (contents.getType() === 'webview') {
console.log('Setting external links to open in default OS browser'); console.log('Setting external links to open in default OS browser');
contents.setWindowOpenHandler(details => { contents.on('new-window', (e, url) => {
if (details.url.startsWith(details.referrer.url)) return {action: 'allow'}; e.preventDefault();
if (url.startsWith('https://')) {
const url = details.url; shell.openExternal(url).catch(console.error);
this.openExternalLink(url) }
.catch(console.error);
return {action: 'deny'};
}); });
} }
}); });

View File

@ -1,5 +1,13 @@
import path from "path"; 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 ServiceSettingsWindow from "./ServiceSettingsWindow";
import SettingsWindow from "./SettingsWindow"; import SettingsWindow from "./SettingsWindow";
import Application from "../Application"; import Application from "../Application";
@ -339,8 +347,10 @@ export default class MainWindow extends Window {
menu.append(new MenuItem({ menu.append(new MenuItem({
label: 'Open URL in default browser', label: 'Open URL in default browser',
click: () => { click: () => {
this.application.openExternalLink(props.linkURL) if (props.linkURL.startsWith('https://')) {
shell.openExternal(props.linkURL)
.catch(console.error); .catch(console.error);
}
}, },
})); }));
} }
@ -450,9 +460,7 @@ export default class MainWindow extends Window {
): void { ): void {
const service = this.config.services[serviceId]; const service = this.config.services[serviceId];
function getUrlDomain(url: string | undefined) { function getUrlDomain(url: string) {
if (!url) return '';
const matches = url.match(/^https?:\/\/((.+?)\/|(.+))/i); const matches = url.match(/^https?:\/\/((.+?)\/|(.+))/i);
if (matches !== null) { if (matches !== null) {
let domain = matches[1]; let domain = matches[1];

View File

@ -1,7 +1,5 @@
const path = require('path'); const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
const {extendDefaultPlugins} = require("svgo");
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const dev = process.env.NODE_ENV === 'development'; const dev = process.env.NODE_ENV === 'development';
@ -39,6 +37,9 @@ const config = {
use: [ use: [
{ {
loader: MiniCssExtractPlugin.loader, loader: MiniCssExtractPlugin.loader,
options: {
publicPath: '/',
}
}, },
'css-loader', 'css-loader',
'sass-loader', 'sass-loader',
@ -46,17 +47,25 @@ const config = {
}, },
{ {
test: /\.(woff2?|eot|ttf|otf)$/i, test: /\.(woff2?|eot|ttf|otf)$/i,
type: 'asset/resource', use: 'file-loader?name=../fonts/[name].[ext]',
generator: {
filename: '../fonts/[name][ext]',
},
}, },
{ {
test: /\.(png|jpe?g|gif|svg)$/i, test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource', use: [
generator: { 'file-loader?name=../images/[name].[ext]',
filename: '../images/[name][ext]', {
}, loader: 'img-loader',
options: {
enabled: !dev,
plugins: [
require('imagemin-gifsicle')({}),
require('imagemin-mozjpeg')({}),
require('imagemin-pngquant')({}),
require('imagemin-svgo')({}),
]
}
}
]
}, },
{ {
test: /\.ts$/i, test: /\.ts$/i,
@ -66,14 +75,13 @@ const config = {
configFile: 'tsconfig.frontend.json', configFile: 'tsconfig.frontend.json',
} }
}, },
exclude: '/node_modules/', exclude: '/node_modules/'
}, },
{ {
test: /\.html$/i, test: /\.html$/i,
type: 'asset/resource', use: [
generator: { 'file-loader?name=../[name].[ext]',
filename: '../[name][ext]', ]
},
} }
], ],
}, },
@ -86,56 +94,6 @@ const config = {
{from: 'node_modules/@fortawesome/fontawesome-free/svgs', to: '../images/icons'} {from: 'node_modules/@fortawesome/fontawesome-free/svgs', to: '../images/icons'}
] ]
}), }),
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,
},
{
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"}],
// },
// },
// },
// },
// },
// },
],
],
},
},
}),
] ]
}; };

4865
yarn.lock

File diff suppressed because it is too large Load Diff