Skip to content

Commit

Permalink
Revert "Added support for rimgo binary releases"
Browse files Browse the repository at this point in the history
This reverts commit b3513f1.
  • Loading branch information
ManeraKai committed Sep 11, 2023
1 parent b3513f1 commit 24ffa0e
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 35 deletions.
24 changes: 24 additions & 0 deletions src-tauri/docker_frontends/teddit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.8"
services:
teddit:
container_name: teddit
image: teddit/teddit:latest
environment:
- DOMAIN=teddit.localhost:8080
- USE_HELMET=true
- USE_HELMET_HSTS=true
- TRUST_PROXY=true
- REDIS_HOST=host.docker.internal
ports:
- "127.0.0.1:10053:8080"
networks:
- teddit_net
healthcheck:
test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://teddit.localhost:8080/about"]
interval: 1m
timeout: 3s
extra_hosts:
- "host.docker.internal:host-gateway"

networks:
teddit_net:
13 changes: 7 additions & 6 deletions src-tauri/frontends.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
"rimgo": {
"name": "Rimgo",
"icon": "rimgo-icon.png",
"download_linux": "https://codeberg.org/rimgo/rimgo/releases/download/v1.2.0/rimgo-linux-amd64.tar.gz",
"filename_linux": "rimgo-linux-amd64.tar.gz",
"command_linux": "./rimgo",
"download_windows": "https://codeberg.org/rimgo/rimgo/releases/download/v1.2.0/rimgo-windows-amd64.zip",
"filename_windows": "rimgo-windows-amd64.zip",
"command_windows": "$APPLOCALDATA\\rimgo\\rimgo.exe",
"command_linux": "./rimgo_linux_x86_64",
"command_windows": "$APPLOCALDATA\\rimgo\\rimgo_windows_x86_64.exe",
"args": [],
"env": [
"ADDRESS=127.0.0.1",
Expand Down Expand Up @@ -97,6 +93,11 @@
"icon": "searxng.png",
"docker": true
},
"teddit": {
"name": "Teddit",
"icon": "teddit.png",
"docker": true
},
"lingva": {
"name": "LingvaTranslate",
"icon": "lingva.png",
Expand Down
24 changes: 10 additions & 14 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"all": true,
"scope": [
"https://github.com/libredirect/frontends_binaries/raw/main/*",
"https://caddyserver.com/api/*",
"https://codeberg.org/*"
"https://caddyserver.com/api/*"
]
},
"process": {
Expand All @@ -31,14 +30,11 @@
},
"fs": {
"all": true,
"scope": {
"allow": [
"$RESOURCE/*",
"$APPLOCALDATA/*",
"$APPLOCALDATA/*/*"
],
"requireLiteralLeadingDot": false
}
"scope": [
"$RESOURCE/*",
"$APPLOCALDATA/*",
"$APPLOCALDATA/caddy/*"
]
},
"os": {
"all": true
Expand All @@ -57,8 +53,8 @@
"args": true
},
{
"name": "./rimgo",
"cmd": "./rimgo",
"name": "./rimgo_linux_x86_64",
"cmd": "./rimgo_linux_x86_64",
"args": true
},
{
Expand Down Expand Up @@ -92,8 +88,8 @@
"args": true
},
{
"name": "$APPLOCALDATA\\rimgo\\rimgo.exe",
"cmd": "$APPLOCALDATA\\rimgo\\rimgo.exe",
"name": "$APPLOCALDATA\\rimgo\\rimgo_windows_x86_64.exe",
"cmd": "$APPLOCALDATA\\rimgo\\rimgo_windows_x86_64.exe",
"args": true
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<h1 id="message"></h1>
</div>
<script>
document.getElementById("message").innerHTML = decodeURIComponent(window.location.hash.substring(1)) + '...'
const message = decodeURIComponent(window.location.hash.substring(1)) + '...'
document.getElementById("message").innerHTML = message
</script>
</body>

Expand Down
25 changes: 11 additions & 14 deletions src/services/binary_frontends.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async function run_frontend(name) {
command = config[name].command_linux
}
const cmd = new shell.Command(command, config[name].args, { cwd: await path.join(await path.appLocalDataDir(), name), env: formatEnv(config[name].env) })
console.log(cmd)
cmd.on('error', error => {
console.error(`command error: "${error}"`)
return 'downloaded'
Expand All @@ -85,28 +86,24 @@ async function run_frontend(name) {
function download_frontend(name) {
return new Promise(async resolve => {
let filename
let url
const dir = name
if (!(await fs.exists(dir, { dir: fs.BaseDirectory.AppLocalData }))) {
await fs.createDir(dir, { dir: fs.BaseDirectory.AppLocalData });
}
if (platform == 'linux') {
filename = config[name].filename_linux ?? `${name}_linux_x86_64.tar.gz`
url = config[name].download_linux ?? `https://github.com/libredirect/frontends_binaries/raw/main/binaries/${filename}`
filename = `${name}_linux_x86_64.tar.gz`
} else if (platform == 'win32') {
filename = config[name].filename_windows ?? `${name}_windows_x86_64.zip`
url = config[name].download_windows ?? `https://github.com/libredirect/frontends_binaries/raw/main/binaries/${filename}`
filename = `${name}_windows_x86_64.zip`
}
const response = await http.fetch(url, { method: 'GET', responseType: http.ResponseType.Binary });
await fs.writeBinaryFile(await path.join(name, filename), new Uint8Array(response.data), { dir: fs.BaseDirectory.AppLocalData });
const response = await http.fetch(
`https://github.com/libredirect/frontends_binaries/raw/main/binaries/${filename}`,
{ method: 'GET', responseType: http.ResponseType.Binary }
);
await fs.writeBinaryFile(filename, new Uint8Array(response.data), { dir: fs.BaseDirectory.AppLocalData });
let extract_cmd
if (platform == 'linux') {
extract_cmd = new shell.Command('tar', ['-xzf', filename], { cwd: await path.join(await path.appLocalDataDir(), name) })
extract_cmd = new shell.Command('tar', ['-xzf', filename], { cwd: await path.appLocalDataDir() })
} else if (platform == 'win32') {
extract_cmd = new shell.Command('tar', ['-xf', filename], { cwd: await path.join(await path.appLocalDataDir(), name) })
extract_cmd = new shell.Command('tar', ['-xf', filename], { cwd: await path.appLocalDataDir() })
}
extract_cmd.on('close', async () => {
await fs.removeFile(await path.join(name, filename), { dir: fs.BaseDirectory.AppLocalData })
await fs.removeFile(filename, { dir: fs.BaseDirectory.AppLocalData })
resolve('downloaded')
});
await extract_cmd.spawn();
Expand Down

0 comments on commit 24ffa0e

Please sign in to comment.