Add files via upload

This commit is contained in:
Sam Sneed 2024-06-02 13:29:57 +00:00 committed by GitHub
parent 2d9d9b71ed
commit 63298030d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 413 additions and 2 deletions

View file

@ -1,2 +1,44 @@
# scuregpt
secure/private chatgpt interfacing. powered by electron.
<img src="logo.png" align="right" width="15%"/>
# F-Stopium
A basic web browser in Electron. ***Now with our own, functioning adblocker and privacy redirection technologies!***
Supports compiling via electron packager. Install and run it with:
```bash
npm install --save-dev electron-packager
npm run make
```
Keep in mind you also need a copy of the WINE project and need to be on Linux.
A basic Electron application needs just these files:
- `package.json` - Points to the app's main file and lists its details and dependencies.
- `main.js` - Starts the app and creates a browser window to render HTML. This is the app's **main process**.
- `index.html` - A web page to render. This is the app's **renderer process**.
- `preload.js` - A content script that runs before the renderer process loads.
## To Use
To clone and run this repository you'll need [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:
```bash
# Install dependencies
npm install
# Run the app
npm start
```
## License
[MIT Modified](LICENSE.md)
## Disclaimer
"Insider's Look" builds are outdated and meant for people who are just testing core functionality by default, and aren't interested in changes! If you want changes, compile it or download the new binaries.
## What is Privacy Redirection Technology (PRT)?
This is a simple technology that replaces a bad URL with a more privacy friendly service, when we know that ADs aren't 100% blocked, or just to provide a better UX. TLDR: Clickjacking for good.

30
forge.config.js Normal file
View file

@ -0,0 +1,30 @@
module.exports = {
packagerConfig: {},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
{
name: '@electron-forge/maker-flatpak',
config: {},
},
{
name: 'electron-forge-maker-appimage',
config: {},
},
],
};

27
index.html Normal file
View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'">
<title>F-Stopium</title>
<link href="./styles.css" rel="stylesheet">
</head>
<body>
<div id="navBar">
<button id="nwBtn">📄</button>
<input id="txtUrl" placeholder="Put the website here" name="url" type="text" onkeypress="clickPress(event)" />
<button onclick="go(); return false;" id="goBtn"></button>
<button onclick="stop(); return false;" id="stopBtn">🛑</button>
<button onclick="back(); return false;" id="backBtn">⬅️</button>
<button onclick="forward(); return false;" id="forwardBtn">➡️</button>
</div>
<tab-group new-tab-button="true" sortable="true">
<webview id="foo" autosize plugins disablewebsecurity></webview>
</tab-group>
<script src="node_modules/electron-tabs/dist/electron-tabs.js"></script>
<script type="text/javascript" src="./userscript/userscripts.js"></script>
<script type="text/javascript" src="./config.js"></script>
<script type="text/javascript" src="./libbrowz.js"></script>
</body>
</html>

9
itworks.html Normal file
View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
</head>
<body></body>
</html>

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

135
main.js Normal file
View file

@ -0,0 +1,135 @@
// Modules to control application life and create native browser window
const {app, BrowserWindow, session, ipcMain} = require('electron')
const path = require('path')
const fetch = require("cross-fetch")
const { ElectronChromeExtensions } = require('electron-chrome-extensions')
ipcMain.on('windowmaker', (event, arg) => {
createWindow();
})
function createWindow () {
// Create the browser window.
const extensions = new ElectronChromeExtensions({
session: session.defaultSession
})
const mainWindow = new BrowserWindow({
width: 1000,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webviewTag: true,
devTools: false,
nodeIntegration: true,
sandbox: true,
contextIsolation: true
}
})
mainWindow.removeMenu()
mainWindow.setMinimumSize(640, 480)
const toBlock = [
"*://*.doubleclick.*",
"*://s.innovid.com/*",
"*://partner.googleadservices.com/*",
"*://*.googlesyndication.com/*",
"*://*.google-analytics.com/*",
"*://creative.ak.fbcdn.net/*",
"*://*.adbrite.com/*",
"*://*.exponential.com/*",
"*://*.quantserve.com/*",
"*://*.scorecardresearch.com/*",
"*://*.zedo.com/*",
"*://*.a-ads.com/*",
"*://*.777partner.com/*",
"*://*.77tracking.com/*",
"*://*.abc-ads.com/*",
"*://*.aaxads.com/*",
"*://*.adizio.com/*",
"*://*.adjix.com/*",
"*://*.adjug.com/*",
"*://*.adjuggler.com/*",
"*://*.trafficjunky.net/*",
"*://*.trafficleader.com/*",
"*://*.trafficrouter.io/*",
"*://*.monerominer.rocks/*",
"*://*.2mdn.net/*",
"*.exe",
"*.vbs",
"*://*.googlesyndication.*",
"*pixels*",
"*telemetry*",
"*analytics*",
"*://ads.*.com*",
"*ae/us/audience*",
"*/api/v*/science*",
"*/api/v*/typing*"
]
const regexPatterns = [
"r[0-100]+---sn-.*\.googlevideo\.com$/g",
"r[0-100]+-sn-.*\.googlevideo\.com$/g"
]
function containsAD(url) {
var i;
for (i = 0; i < toBlock.length; i++) {
let regex = toBlock[i].replace(/\*/g, "[^ ]*");
if (url.match(regex)) {
return true;
}
}
for (i = 0; i < regexPatterns.length; i++) {
let regex = regexPatterns[i]
if (url.match(regex)) {
return true;
}
}
return false;
}
session.defaultSession.webRequest.onBeforeRequest((details, callback) => {
if (containsAD(details.url)) {
return callback({cancel: true})
}
return callback({})
})
extensions.addTab(mainWindow.webContents, mainWindow)
// and load the index.html of the app.
mainWindow.loadFile('index.html')
// Open the DevTools.
mainWindow.webContents.openDevTools()
return mainWindow;
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
let x = createWindow()
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

38
package.json Normal file
View file

@ -0,0 +1,38 @@
{
"name": "securegpt",
"version": "1.0.0",
"description": "Secure Electron-based ChatGPT",
"main": "main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "npx electron-packager --platform linux,win32 --arch x64,arm64 ."
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "Sneed Group",
"license": "SPL-R5",
"devDependencies": {
"@electron-forge/cli": "^6.0.5",
"@electron-forge/maker-deb": "^6.0.5",
"@electron-forge/maker-flatpak": "^6.0.5",
"@electron-forge/maker-rpm": "^6.0.5",
"@electron-forge/maker-squirrel": "^6.0.5",
"@electron-forge/maker-zip": "^6.0.5",
"electron": "^30.0.8",
"electron-forge-maker-appimage": "^24.6.3",
"electron-packager": "^17.1.2"
},
"dependencies": {
"cross-fetch": "^3.1.5",
"electron-chrome-extensions": "^3.10.0",
"electron-squirrel-startup": "^1.0.1",
"electron-tabs": "^1.0.1"
}
}

18
preload.js Normal file
View file

@ -0,0 +1,18 @@
/**
* The preload script runs before. It has access to web APIs
* as well as Electron's renderer process modules and some
* polyfilled Node.js functions.
*
* https://www.electronjs.org/docs/latest/tutorial/sandbox
*/
window.addEventListener('DOMContentLoaded', () => {
function clearSiteData(url) {
session.defaultSession.clearStorageData({
storages: ['appcache', 'cookies', 'filesystem', 'indexdb', 'localstorage', 'shadercache', 'websql', 'serviceworkers'],
quotas: ['temporary', 'persistent'],
origins: [url]
}, () => {
console.log(`Site data cleared for ${url}`);
});
}
})

7
renderer.js Normal file
View file

@ -0,0 +1,7 @@
/**
* This file is loaded via the <script> tag in the index.html file and will
* be executed in the renderer process for that window. No Node.js APIs are
* available in this process because `nodeIntegration` is turned off and
* `contextIsolation` is turned on. Use the contextBridge API in `preload.js`
* to expose Node.js functionality from the main process.
*/

105
styles.css Normal file
View file

@ -0,0 +1,105 @@
/* styles.css */
/* Add styles here to customize the appearance of your app */
html {
overflow: hidden;
}
body {
user-select: none;
margin: 0;
padding: 0;
position: fixed;
}
#navbar {
position: fixed;
top: 0;
height: 10%;
width: 100%;
padding: 0;
margin: 0;
}
#nwBtn {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
}
#goBtn {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
}
#backBtn {
background-color: #7a551d;
border: none;
color: white;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
}
#stopBtn {
background-color: #4f1007; /* Red */
border: none;
color: white;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
}
#forwardBtn {
background-color: #01315e; /* Blue */
border: none;
color: white;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
}
#txtUrl {
border: none;
padding: 1% 1%;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1.25rem;
width:69%;
}
html, body {
width: 100%;
height: 100%;
}
webview {
position: absolute;
top: 0;
left: 0;
max-height: 90% !important;
max-width: 100%;
width: 1rem;
height: 90% !important;
display: inline-flex !important;
}