commit
This commit is contained in:
parent
39b1e89d94
commit
a143f399e1
|
@ -1,2 +1,3 @@
|
|||
# any-app
|
||||
|
||||
any-app is a FOSS electron application to turn ANY webpage into an APP
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>My Electron App</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1><span style="color: LimeGreen">Error!</span></h1>
|
||||
<p>Looks like you forgot to specify a URL when launching the election app. Please rerun with --url="https://yourURL.com"</p>
|
||||
<p>If you are running this from a shortcut in windows, just add --url="https://yourURL.com" after the "target" command. It should look like this:</p>
|
||||
<img src="target.png">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,65 @@
|
|||
const { app, BrowserWindow, nativeImage } = require('electron');
|
||||
const path = require('path');
|
||||
const axios = require('axios');
|
||||
const argv = require('yargs')
|
||||
.option('url', {
|
||||
alias: 'u',
|
||||
description: 'URL to open',
|
||||
type: 'string',
|
||||
})
|
||||
.argv;
|
||||
|
||||
function createWindow() {
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
},
|
||||
autoHideMenuBar: true,
|
||||
title: 'any-app',
|
||||
});
|
||||
|
||||
const targetUrl = argv.url || `file://${path.join(__dirname, 'index.html')}`;
|
||||
|
||||
mainWindow.loadURL(targetUrl);
|
||||
|
||||
mainWindow.webContents.on('did-finish-load', async () => {
|
||||
try {
|
||||
const faviconUrl = await mainWindow.webContents.executeJavaScript(`
|
||||
(() => {
|
||||
const link = document.querySelector('link[rel~="icon"]');
|
||||
return link ? link.href : '';
|
||||
})()
|
||||
`);
|
||||
if (faviconUrl) {
|
||||
const response = await axios.get(faviconUrl, { responseType: 'arraybuffer' });
|
||||
const icon = nativeImage.createFromBuffer(Buffer.from(response.data, 'binary'));
|
||||
mainWindow.setIcon(icon);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to set favicon:', error);
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
mainWindow.maximize();
|
||||
}
|
||||
|
||||
app.on('ready', createWindow);
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "any-app",
|
||||
"version": "1.0.0",
|
||||
"description": "any-app is a FOSS electron application to turn ANY webpage into an APP",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"package-win": "electron-packager . any-app --platform=win32 --arch=x64 --prune=true --out=release-builds",
|
||||
"package-lin": "electron-packager . any-app --platform=linux --arch=x64 --prune=true --out=release-builds",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "firebadnofire",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/firebadnofire/any-app"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron/packager": "^18.3.2",
|
||||
"electron": "^30.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.2",
|
||||
"yargs": "^17.7.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
pre,code{font-family:Menlo,Monaco,courier new,monospace}pre{padding:.5rem;line-height:1.25;overflow-x:scroll}@media print{*,*:before,*:after{background:0 0!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}a,a:visited{color:#01ff70}a:hover,a:focus,a:active{color:#2ecc40}.retro-no-decoration{text-decoration:none}html{font-size:12px}@media screen and (min-width:32rem) and (max-width:48rem){html{font-size:15px}}@media screen and (min-width:48rem){html{font-size:16px}}body{line-height:1.85}p,.retro-p{font-size:1rem;margin-bottom:1.3rem}h1,.retro-h1,h2,.retro-h2,h3,.retro-h3,h4,.retro-h4{margin:1.414rem 0 .5rem;font-weight:inherit;line-height:1.42}h1,.retro-h1{margin-top:0;font-size:3.998rem}h2,.retro-h2{font-size:2.827rem}h3,.retro-h3{font-size:1.999rem}h4,.retro-h4{font-size:1.414rem}h5,.retro-h5{font-size:1.121rem}h6,.retro-h6{font-size:.88rem}small,.retro-small{font-size:.707em}img,canvas,iframe,video,svg,select,textarea{max-width:100%}html,body{background-color:#222;min-height:100%}html{font-size:18px}body{color:#fafafa;font-family:courier new;line-height:1.45;margin:6rem auto 1rem;max-width:48rem;padding:.25rem}pre{background-color:#333}blockquote{border-left:3px solid #01ff70;padding-left:1rem}
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in New Issue