Compare commits
3 Commits
67ac1cd3e7
...
2c813e7f6b
Author | SHA1 | Date |
---|---|---|
Bauke | 2c813e7f6b | |
Bauke | 64fed8ef87 | |
Bauke | d3d65ea050 |
|
@ -0,0 +1,112 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Browser profile directories
|
||||||
|
chromium/
|
||||||
|
firefox/
|
||||||
|
|
||||||
|
# Build output directories
|
||||||
|
build/
|
||||||
|
web-ext-artifacts/
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"stylelint-config-standard-scss"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-descending-specificity": null,
|
||||||
|
"string-quotes": "single"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Re ↩ Nav
|
||||||
|
|
||||||
|
> **Navigation redirects for the masses.**
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
You can install Fangs through the stores linked above, [manually from a file] (see [the Releases page] for ZIP files) or [from source](#development).
|
||||||
|
|
||||||
|
[manually from a file]: https://support.mozilla.org/en-US/kb/find-and-install-add-ons-add-features-to-firefox#w_how-do-i-find-and-install-add-ons
|
||||||
|
[the Releases page]: https://git.bauke.xyz/Holllo/re-nav/releases
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
To build Re-Nav you will need [git](https://git-scm.com), [NodeJS](https://nodejs.org) and [pnpm](https://pnpm.io).
|
||||||
|
|
||||||
|
* Install the dependencies with `pnpm install`.
|
||||||
|
* Start a separate browser with `pnpm start`.
|
||||||
|
* Build the WebExtension for production with `pnpm build`.
|
||||||
|
* Test the code with `pnpm test`.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Distributed under the [AGPL-3.0-or-later](https://spdx.org/licenses/AGPL-3.0-or-later.html) license, see [LICENSE](https://git.bauke.xyz/Holllo/re-nav/src/branch/main/LICENSE) for more information.
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"name": "re-nav",
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"repository": "https://git.bauke.xyz/Holllo/re-nav",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"start": "vite build -m development --watch",
|
||||||
|
"start:chromium": "VITE_BROWSER=chromium pnpm start",
|
||||||
|
"clean": "trash build web-ext-artifacts",
|
||||||
|
"build": "pnpm clean && pnpm build:chromium && pnpm build:firefox && pnpm zip-source",
|
||||||
|
"build:chromium": "VITE_BROWSER=chromium vite build && web-ext build -n re-nav-chromium-{version}.zip -s build/chromium",
|
||||||
|
"build:firefox": "VITE_BROWSER=firefox vite build && web-ext build -n re-nav-firefox-{version}.zip -s build/firefox",
|
||||||
|
"zip-source": "git archive --format zip --output web-ext-artifacts/re-nav-source.zip HEAD",
|
||||||
|
"test": "xo && stylelint 'source/**/*.scss' && tsc"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@holllo/migration-helper": "^0.1.3",
|
||||||
|
"@holllo/preact-components": "^0.2.3",
|
||||||
|
"htm": "^3.1.1",
|
||||||
|
"modern-normalize": "^1.1.0",
|
||||||
|
"preact": "^10.11.0",
|
||||||
|
"webextension-polyfill": "^0.10.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@preact/preset-vite": "^2.4.0",
|
||||||
|
"@types/babel__core": "^7.1.19",
|
||||||
|
"@types/webextension-polyfill": "^0.9.1",
|
||||||
|
"postcss": "^8.4.16",
|
||||||
|
"sass": "^1.55.0",
|
||||||
|
"stylelint": "^14.13.0",
|
||||||
|
"stylelint-config-standard-scss": "^5.0.0",
|
||||||
|
"trash-cli": "^5.0.0",
|
||||||
|
"typescript": "^4.8.4",
|
||||||
|
"vite": "^3.1.4",
|
||||||
|
"vite-plugin-web-extension": "^1.4.4",
|
||||||
|
"web-ext": "^7.2.0",
|
||||||
|
"xo": "^0.52.3"
|
||||||
|
},
|
||||||
|
"xo": {
|
||||||
|
"prettier": true,
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "off",
|
||||||
|
"@typescript-eslint/consistent-type-imports": "off",
|
||||||
|
"n/file-extension-in-import": "off"
|
||||||
|
},
|
||||||
|
"space": true
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,16 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 100 100">
|
||||||
|
<rect fill="#E6DEFF" width="100" height="100" />
|
||||||
|
|
||||||
|
<text
|
||||||
|
fill="#1F1731"
|
||||||
|
font-family="Inter"
|
||||||
|
font-size="75"
|
||||||
|
font-weight="900"
|
||||||
|
x="51"
|
||||||
|
y="75"
|
||||||
|
alignment-baseline="middle"
|
||||||
|
text-anchor="middle"
|
||||||
|
>
|
||||||
|
↩
|
||||||
|
</text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 340 B |
|
@ -0,0 +1,45 @@
|
||||||
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
|
export default function createManifest(
|
||||||
|
target: string,
|
||||||
|
): Record<string, unknown> {
|
||||||
|
const manifest: Record<string, unknown> = {
|
||||||
|
name: 're-nav',
|
||||||
|
description: 'Navigation redirects for the masses.',
|
||||||
|
version: '0.1.0',
|
||||||
|
permissions: ['storage', 'webNavigation'],
|
||||||
|
options_ui: {
|
||||||
|
page: 'options/index.html',
|
||||||
|
open_in_tab: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const icons = {
|
||||||
|
128: 'assets/re-nav.png',
|
||||||
|
};
|
||||||
|
|
||||||
|
manifest.icons = icons;
|
||||||
|
|
||||||
|
const browserAction = {
|
||||||
|
default_icon: icons,
|
||||||
|
};
|
||||||
|
|
||||||
|
const backgroundScript = 'background-scripts/initialize.ts';
|
||||||
|
|
||||||
|
if (target === 'chromium') {
|
||||||
|
manifest.manifest_version = 3;
|
||||||
|
manifest.action = browserAction;
|
||||||
|
manifest.background = {
|
||||||
|
service_worker: backgroundScript,
|
||||||
|
type: 'module',
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
manifest.manifest_version = 2;
|
||||||
|
manifest.browser_action = browserAction;
|
||||||
|
manifest.background = {
|
||||||
|
scripts: [backgroundScript],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return manifest;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
import {html} from 'htm/preact';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
// See Vite documentation for `import.meta.env` usage.
|
||||||
|
// https://vitejs.dev/guide/env-and-mode.html
|
||||||
|
|
||||||
|
interface ImportMeta {
|
||||||
|
readonly env: ImportMetaEnv;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMetaEnv {
|
||||||
|
readonly BASE_URL: string;
|
||||||
|
readonly DEV: boolean;
|
||||||
|
readonly MODE: string;
|
||||||
|
readonly PROD: boolean;
|
||||||
|
readonly VITE_BROWSER: 'chromium' | 'firefox';
|
||||||
|
}
|
||||||
|
|
||||||
|
type HtmComponent = ReturnType<typeof html>;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"lib": [
|
||||||
|
"ESNext"
|
||||||
|
],
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"noEmit": true,
|
||||||
|
"outDir": "build",
|
||||||
|
"strict": true,
|
||||||
|
"target": "ESNext"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"source/**/*.ts",
|
||||||
|
"vite.config.ts"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import process from 'node:process';
|
||||||
|
import url from 'node:url';
|
||||||
|
|
||||||
|
import {defineConfig} from 'vite';
|
||||||
|
|
||||||
|
// Vite Plugins
|
||||||
|
import preactPreset from '@preact/preset-vite';
|
||||||
|
import webExtension from 'vite-plugin-web-extension';
|
||||||
|
|
||||||
|
import createManifest from './source/manifest.js';
|
||||||
|
|
||||||
|
const targetBrowser = process.env.VITE_BROWSER ?? 'firefox';
|
||||||
|
process.env.VITE_BROWSER = targetBrowser;
|
||||||
|
|
||||||
|
const currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
||||||
|
const buildDir = path.join(currentDir, 'build', targetBrowser);
|
||||||
|
const sourceDir = path.join(currentDir, 'source');
|
||||||
|
|
||||||
|
// Create the browser profile if it doesn't already exist.
|
||||||
|
fs.mkdirSync(path.join(currentDir, targetBrowser), {recursive: true});
|
||||||
|
|
||||||
|
const webExtConfig: Record<string, unknown> = {
|
||||||
|
browserConsole: true,
|
||||||
|
chromiumProfile: 'chromium/',
|
||||||
|
firefoxProfile: 'firefox/',
|
||||||
|
keepProfileChanges: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (targetBrowser === 'chromium') {
|
||||||
|
webExtConfig.startUrl = 'chrome://extensions/';
|
||||||
|
webExtConfig.target = 'chromium';
|
||||||
|
} else {
|
||||||
|
webExtConfig.startUrl = 'about:debugging#/runtime/this-firefox';
|
||||||
|
webExtConfig.target = 'firefox-desktop';
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
outDir: buildDir,
|
||||||
|
minify: false,
|
||||||
|
sourcemap: 'inline',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
preactPreset(),
|
||||||
|
// See vite-plugin-web-extension for documentation.
|
||||||
|
// https://github.com/aklinker1/vite-plugin-web-extension
|
||||||
|
webExtension({
|
||||||
|
assets: 'assets',
|
||||||
|
browser: targetBrowser,
|
||||||
|
manifest: () => createManifest(targetBrowser),
|
||||||
|
webExtConfig,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
root: sourceDir,
|
||||||
|
});
|
Loading…
Reference in New Issue