Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 203029f

Browse files
committed
Improved many things
1 parent 1553081 commit 203029f

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

src-tauri/docker_frontends/redis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.8'
22
services:
33
redis:
4-
image: docker.io/_/redis
4+
image: redis
55
restart: unless-stopped
66
ports:
77
- '6379:6379'

src-tauri/frontends.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"args": [
88
"-p",
99
"10041"
10+
],
11+
"env": [
12+
"LIBREDDIT_DEFAULT_USE_HLS=on"
1013
]
1114
},
1215
"rimgo": {

src-tauri/tauri.conf.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@
8181
"name": "chmod",
8282
"cmd": "chmod",
8383
"args": true
84+
},
85+
{
86+
"name": "tar",
87+
"cmd": "tar",
88+
"args": true
8489
}
8590
]
8691
},

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ let frontends_running = {};
1717
else if (platform == "win32") {
1818
await binary_frontends.run_caddy('windows')
1919
}
20-
docker_frontends.run_frontend('redis')
20+
if (isDockerInstalled == 'running'){
21+
await docker_frontends.download_frontend('redis')
22+
await docker_frontends.run_frontend('redis')
23+
}
2124
for (const key in config) {
2225
if (
2326
!(platform == "linux" && config[key].command_linux)

src/services/binary_frontends.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ async function run_caddy(platform) {
3939
}
4040

4141
async function run_frontend(name, command, args, env) {
42-
if (platform == 'linux') {
43-
const cmd = new shell.Command('chmod', ['u+x', command], { cwd: await path.appDataDir(), env: formatEnv(env) })
44-
await cmd.spawn();
45-
}
46-
const cmd = new shell.Command(command, args, { cwd: await path.appDataDir(), env: formatEnv(env) })
42+
const cmd = new shell.Command(command, args, { cwd: await path.join(await path.appDataDir(), name), env: formatEnv(env) })
4743
cmd.on('error', error => {
4844
console.error(`command error: "${error}"`)
4945
return 'downloaded'
@@ -54,24 +50,34 @@ async function run_frontend(name, command, args, env) {
5450
}
5551

5652
async function download_frontend(name) {
57-
const response = await http.fetch(`https://github.com/libredirect/frontends_binaries/raw/main/${name}/${name}_${platform}_x86_64`, {
58-
method: 'GET',
59-
timeout: 30,
60-
responseType: http.ResponseType.Binary
61-
});
62-
await fs.writeBinaryFile(`${name}_${platform}_x86_64`, new Uint8Array(response.data), { dir: fs.BaseDirectory.AppData });
53+
let filename
54+
if (platform == 'linux') {
55+
filename = `${name}_linux_x86_64.tar.gz`
56+
} else if (platform == 'windows') {
57+
filename = `${name}_windows_x86_64.zip`
58+
}
59+
const response = await http.fetch(
60+
`https://github.com/libredirect/frontends_binaries/raw/main/binaries/${filename}`,
61+
{ method: 'GET', responseType: http.ResponseType.Binary }
62+
);
63+
await fs.writeBinaryFile(filename, new Uint8Array(response.data), { dir: fs.BaseDirectory.AppData });
64+
if (platform == 'linux') {
65+
const extract_cmd = new shell.Command('tar', ['-xzf', filename], { cwd: await path.appDataDir() })
66+
await extract_cmd.spawn();
67+
extract_cmd.on('close', async () => await fs.removeFile(filename, { dir: fs.BaseDirectory.AppData }));
68+
}
6369
return 'downloaded'
6470
}
6571

6672
async function check_downloaded(name) {
67-
if (await fs.exists(`${name}_${platform}_x86_64`, { dir: fs.BaseDirectory.AppData })) {
73+
if (await fs.exists(`${name}`, { dir: fs.BaseDirectory.AppData })) {
6874
return 'downloaded'
6975
} else {
7076
return 'not_downloaded'
7177
}
7278
}
7379
async function remove_frontend(name) {
74-
await fs.removeFile(`${name}_${platform}_x86_64`, { dir: fs.BaseDirectory.AppData })
80+
await fs.removeDir(name, { dir: fs.BaseDirectory.AppData, recursive: true })
7581
return 'not_downloaded'
7682
}
7783

0 commit comments

Comments
 (0)