-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from ThinLiquid:main
✨ feature: add stomp proxy
- Loading branch information
Showing
12 changed files
with
288 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"es6": true | ||
"es6": true, | ||
"node": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* eslint-env browser */ | ||
/* global __uv$config WinBox */ | ||
/* global __uv$config __stomp$config WinBox */ | ||
|
||
import hotkeys from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm'; | ||
|
||
|
@@ -8,9 +8,11 @@ import { _auth } from './scripts/firebase.js'; | |
import Logger from './scripts/logger.js'; | ||
import { registerSW, loadCSS, sleep } from './scripts/utilities.js'; | ||
import config from './scripts/configManager.js'; | ||
import { AppData, SettingsCategory, SettingsInput, SettingsTextarea } from './scripts/classes.js'; | ||
import { AppData, SettingsCategory, SettingsInput, SettingsTextarea, SettingsDropdown } from './scripts/classes.js'; | ||
|
||
import './uv/uv.config.js'; | ||
import './stomp/bootstrapper.js'; | ||
import './stmp/stomp.js'; | ||
|
||
const logger = new Logger(); | ||
|
||
|
@@ -169,6 +171,33 @@ class FlowInstance { | |
window.Flow = new FlowInstance(); | ||
|
||
window.onload = () => { | ||
new SettingsCategory('profile', 'Profile', | ||
new SettingsInput('username', 'Username', '', ''), | ||
new SettingsInput('url', 'Image URL', 'https://mysite.to/image.png', '') | ||
); | ||
|
||
new SettingsCategory('search', 'Browser', | ||
new SettingsInput('url', 'Search Engine URL', 'https://duckduckgo.com', 'https://duckduckgo.com'), | ||
new SettingsTextarea('urls', 'Extension URLs', 'https://mysite.to/script1.js\nhttps://mysite.to/script2.js\nhttps://mysite.to/script3.js', ''), | ||
new SettingsDropdown('proxy', 'Proxy', 'Ultraviolet', ['Ultraviolet', 'STomp']) | ||
); | ||
|
||
new SettingsCategory('theme', 'Theme', | ||
new SettingsInput('url', 'Theme URL', 'https://mysite.to/theme.css', '/builtin/themes/catppuccin-dark.css') | ||
); | ||
|
||
new SettingsCategory('modules', 'Modules/Scripts', | ||
new SettingsTextarea('urls', 'Module URLs', 'https://mysite.to/script1.js\nhttps://mysite.to/script2.js\nhttps://mysite.to/script3.js', '/builtin/modules/battery.js\n/builtin/modules/clock.js\n/builtin/modules/weather.js') | ||
); | ||
switch (config.settings.get('search').proxy) { | ||
case 'STomp': | ||
self.currentProxy = __stomp$config; | ||
break; | ||
case 'Ultraviolet': | ||
self.currentProxy = __uv$config; | ||
break; | ||
} | ||
|
||
window.apps = () => { | ||
return { | ||
'help': new AppData('help', 'Help', 'https://flowos-thinliquid.webapp-store.de/', false), | ||
|
@@ -191,22 +220,4 @@ window.onload = () => { | |
document.head.append(style); | ||
|
||
window.Flow.boot(); | ||
}; | ||
|
||
new SettingsCategory('profile', 'Profile', | ||
new SettingsInput('username', 'Username', '', ''), | ||
new SettingsInput('url', 'Image URL', 'https://mysite.to/image.png', '') | ||
); | ||
|
||
new SettingsCategory('search', 'Browser', | ||
new SettingsInput('url', 'Search Engine URL', 'https://duckduckgo.com', 'https://duckduckgo.com'), | ||
new SettingsTextarea('urls', 'Extension URLs', 'https://mysite.to/script1.js\nhttps://mysite.to/script2.js\nhttps://mysite.to/script3.js', '') | ||
); | ||
|
||
new SettingsCategory('theme', 'Theme', | ||
new SettingsInput('url', 'Theme URL', 'https://mysite.to/theme.css', '/builtin/themes/catppuccin-dark.css') | ||
); | ||
|
||
new SettingsCategory('modules', 'Modules/Scripts', | ||
new SettingsTextarea('urls', 'Module URLs', 'https://mysite.to/script1.js\nhttps://mysite.to/script2.js\nhttps://mysite.to/script3.js', '/builtin/modules/battery.js\n/builtin/modules/clock.js\n/builtin/modules/weather.js') | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-env browser */ | ||
/* global StompBoot */ | ||
|
||
const config = { | ||
bare_server: '/bare/', | ||
directory: '/stomp/', | ||
codec: StompBoot.CODEC_PLAIN | ||
}; | ||
|
||
self.__stomp$config = { | ||
proxyName: 'stomp', | ||
prefix: config.directory, | ||
bare: config.bare_server, | ||
encodeUrl: (i) => boot.html(i).replace('/stomp/', ''), | ||
decodeUrl: (i) => decodeURIComponent(i.replace('process:html:', '')) | ||
}; | ||
|
||
if (location.protocol === 'http:') { | ||
config.loglevel = StompBoot.LOG_TRACE; | ||
} else { | ||
config.loglevel = StompBoot.LOG_ERROR; | ||
} | ||
|
||
const boot = new StompBoot(config); | ||
|
||
boot.ready.catch(error => { | ||
console.error(error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.