mirror of
https://github.com/planetrenox/inzerosight.git
synced 2026-03-17 03:01:02 +00:00
74 lines
2.5 KiB
JavaScript
74 lines
2.5 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import fs from 'node:fs';
|
|
|
|
const target = process.env.TARGET || 'firefox';
|
|
|
|
export default defineConfig(async () => {
|
|
const plugins = [];
|
|
|
|
if (target !== 'web') {
|
|
const { default: webExtension } = await import('vite-plugin-web-extension');
|
|
plugins.push(
|
|
webExtension({
|
|
manifest: () => {
|
|
const base = {
|
|
name: "in\u00D8sight",
|
|
version: "2.2.0",
|
|
author: "planetrenox@pm.me",
|
|
homepage_url: "https://github.com/planetrenox/inzerosight",
|
|
description: "Communicate undetected in plain sight.",
|
|
icons: { "48": "icon_500.png" },
|
|
};
|
|
|
|
if (target === 'chrome') {
|
|
return {
|
|
...base,
|
|
manifest_version: 3,
|
|
action: {
|
|
default_icon: { "48": "icon_500.png" },
|
|
default_title: "in\u00D8sight",
|
|
default_popup: "index.html",
|
|
},
|
|
};
|
|
}
|
|
|
|
return {
|
|
...base,
|
|
manifest_version: 2,
|
|
browser_action: {
|
|
browser_style: false,
|
|
default_icon: "icon_500.png",
|
|
default_title: "in\u00D8sight",
|
|
default_popup: "index.html",
|
|
},
|
|
content_security_policy: "script-src 'self'; style-src 'self';",
|
|
browser_specific_settings: {
|
|
gecko: {
|
|
id: "{0a73f41c-c59c-404b-9e07-f7392fa830d4}",
|
|
},
|
|
},
|
|
};
|
|
},
|
|
})
|
|
);
|
|
}
|
|
|
|
// Custom plugin to ensure the icon is always copied to the target output directory
|
|
plugins.push({
|
|
name: 'copy-icon',
|
|
writeBundle() {
|
|
if (fs.existsSync('icon_500.png')) {
|
|
fs.copyFileSync('icon_500.png', `dist/${target}/icon_500.png`);
|
|
}
|
|
}
|
|
});
|
|
|
|
return {
|
|
build: {
|
|
outDir: `dist/${target}`,
|
|
emptyOutDir: true,
|
|
},
|
|
plugins,
|
|
};
|
|
});
|