@cloudron/tegel 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +13 -2
  2. package/opencode.json +17 -0
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import express from 'express';
2
2
  import fs from 'node:fs';
3
+ import crypto from 'node:crypto';
3
4
  import session from 'express-session';
4
5
  import FileStoreFactory from 'session-file-store';
5
6
  import lastMile from '@cloudron/connect-lastmile';
6
7
  import { HttpError } from '@cloudron/connect-lastmile';
7
8
  import * as oidc from './src/oidc.js';
8
9
 
9
- export async function createExpressApp({ sessionSecret = 'changeme', oidcConfig }) {
10
+ export async function createExpressApp({ oidcConfig, jsonBodySizeLimit = '25mb' }) {
10
11
  await oidc.initOIDC(oidcConfig);
11
12
 
12
13
  const app = express();
@@ -15,10 +16,20 @@ export async function createExpressApp({ sessionSecret = 'changeme', oidcConfig
15
16
  app.set('json spaces', 2);
16
17
  app.set('query parser', 'simple');
17
18
 
18
- app.use(express.json());
19
+ app.use(express.json({ limit: jsonBodySizeLimit }));
19
20
 
20
21
  const FileStore = FileStoreFactory(session);
21
22
  const sessionStorePath = process.env.CLOUDRON ? '/app/data/.session.store' : '/tmp/session.store';
23
+ const sessionSecretFile = process.env.CLOUDRON ? '/app/data/.session.secret' : '/tmp/.session.secret';
24
+
25
+ let sessionSecret;
26
+ if (!fs.existsSync(sessionSecretFile)) {
27
+ sessionSecret = crypto.randomBytes(64).toString('hex');
28
+ fs.writeFileSync(sessionSecretFile, sessionSecret, { mode: 0o600 });
29
+ } else {
30
+ sessionSecret = fs.readFileSync(sessionSecretFile, 'utf8').trim();
31
+ }
32
+
22
33
  fs.mkdirSync(sessionStorePath, { recursive: true });
23
34
 
24
35
  app.use(session({
package/opencode.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "provider": {
4
+ "ollama": {
5
+ "npm": "@ai-sdk/openai-compatible",
6
+ "name": "Ollama (local)",
7
+ "options": {
8
+ "baseURL": "http://209.38.98.50:11434/v1"
9
+ },
10
+ "models": {
11
+ "gpt-oss:120b": {
12
+ "name": "gpt-oss:120b"
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudron/tegel",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "license": "GPL-2.0",
6
6
  "author": "Cloudron Developers",