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

Commit cabc6ce

Browse files
committed
Revert "Remove url from sogs.conf"
This reverts commit d5e0ff6.
1 parent d5e0ff6 commit cabc6ce

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

PLUGINS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,13 @@ room = {
226226
Represents current SOGS.
227227

228228
- `pk` — sogs public key in hex string format
229+
- `url` — publicly accessible URL of the sogs
229230

230231
Example:
231232
```js
232233
server = {
233-
pk: 'ac9c872e525a58970df6971655abb944a30b38853442a793b29843d20795e840'
234+
pk: 'ac9c872e525a58970df6971655abb944a30b38853442a793b29843d20795e840',
235+
url: 'http://localhost:3000'
234236
}
235237
```
236238

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Alternatively, [run source code](./CONTRIBUTING.md#running-source-code), it's no
7676

7777
You can use `PORT=1234` and/or `HOSTNAME=192.168.0.1` environmental variables to **override** sogs.conf variables for PORT and HOSTNAME.
7878

79-
It's your job to configure web server to proxy requests to the specified URL. Bunsogs never tries to be an end server for your users. It's recommended to run some kind of reverse proxy, such as nginx, that will point to local bunsogs instance. Don't forget to [increase file size limit from default 1mb](https://stackoverflow.com/questions/28476643/default-nginx-client-max-body-size) if configuring nginx reverse proxy.
79+
It's your job to configure web server to proxy requests to the specified URL. Bunsogs never tries to be an end server for your users. It's recommended to run some kind of reverse proxy, such as nginx, that will point to local bunsogs instance. Make sure you change `url` in sogs.conf config file to your publicly accessible url. Don't forget to [increase file size limit from default 1mb](https://stackoverflow.com/questions/28476643/default-nginx-client-max-body-size) if configuring nginx reverse proxy.
8080

8181
To leave SOGS running, you can use any persisting daemon you like, it can be just a [crontab script](https://phoenixnap.com/kb/crontab-reboot) that starts bunsogs on server restart or Linux's [screen](https://www.howtogeek.com/662422/how-to-use-linuxs-screen-command/) or more complicated [pm2](https://www.npmjs.com/package/pm2) (for example use `pm2 start "bun start" --name="My Session Community"` provide any name you like, also run `pm2 startup` to add pm2 to system autoruns).
8282

sogs.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ port=3000
1818
# Type: string
1919
hostname=localhost
2020

21+
# Publicly accessible URL that bunsogs uses for internal file linking.
22+
# Make sure to set it to your domain if you're using a reverse proxy.
23+
# Type: string
24+
url=http://localhost:3000
2125

2226
# === [Files] ===
2327

src/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export function mapRoom(room: Room) {
371371

372372
export function mapSogs() {
373373
return {
374-
pk: getServerKey().publicKey.toString('hex')
374+
pk: getServerKey().publicKey.toString('hex'),
375+
url: getConfig().url
375376
}
376377
}

src/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ const filesizeRegex = /^(\d+(\.\d)?)(B|KB|MB)$/i
88
const configSchema = z.object({
99
port: z.number().int().min(1).max(65535),
1010
hostname: z.string(),
11+
url: z.string().url().transform(url => {
12+
const trimmed = url.trim()
13+
if (trimmed.endsWith('/')) {
14+
return trimmed.slice(0, -1)
15+
} else {
16+
return trimmed
17+
}
18+
}),
1119
expiry: z.number().int().min(0),
1220
max_size: z.number().int().min(1).max(6000000),
1321
active_threshold: z.number().int().min(1),

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ console.log(
292292
roomsList.length
293293
? `\n Public links to rooms:${
294294
roomsList.map(room => `\n - ${
295-
chalk.bold(`http://${hostname}:${port}/${room.token}?public_key=${keys.publicKey.toString('hex')}`)}`
295+
chalk.bold(`${config.url}/${room.token}?public_key=${keys.publicKey.toString('hex')}`)}`
296296
).join('')
297297
}`
298298
: chalk.bold(' You have no public rooms yet. Create your first room with bunsogs-cli!')

0 commit comments

Comments
 (0)