Skip to content

Commit 923d677

Browse files
committed
OmniTool 1.0.0 Update
1. API updates - Generate jwt token script now takes multiple recipe ids - generateJwtToken script workflowId payload is optional 2. Stability Fixes and Documentation - Moved to stable release v1.0! - Fixed null assertion on recipe export - Updated README.md - Add GitHub Actions for automatic release
1 parent c4034c2 commit 923d677

File tree

13 files changed

+85
-16
lines changed

13 files changed

+85
-16
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Currently supported (v. 0.6.0) :
9494

9595
Currently supported Local APIs:
9696
* LM-studio
97+
* Ollama
9798
* Oobabooga Text Generation UI
9899
* Automatic1111/SD-Next
99100
* Paperless-ng

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "omnitool",
3-
"version": "0.6.3",
3+
"version": "1.0.0",
44
"packageManager": "[email protected]",
55
"private": true,
66
"workspaces": [

Diff for: packages/omni-sdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "omni-sdk",
33
"packageManager": "[email protected]",
4-
"version": "0.6.3",
4+
"version": "1.0.0",
55
"type": "module",
66
"main": "./lib/index.js",
77
"types": "./lib/index.d.ts",

Diff for: packages/omni-server/dist/run.js

+24-2
Original file line numberDiff line numberDiff line change
@@ -7582,6 +7582,7 @@ var loadServerConfig = (defaultFile) => {
75827582
import { exec } from "child_process";
75837583
import os3 from "os";
75847584
import fs8 from "node:fs";
7585+
import assert3 from "node:assert";
75857586

75867587
// src/services/APIService.ts
75877588
import { APIService } from "omni-shared";
@@ -15199,7 +15200,7 @@ var WorkflowIntegration = class extends APIIntegration {
1519915200
}
1520015201
const exportFile = new KVStorage(this, {
1520115202
// @ts-ignore
15202-
dbPath: this.config.tempExportDir ?? this.config.settings.paths?.tmpPath ?? "./data.local/tmp",
15203+
dbPath: this.config.tempExportDir ?? this.config.settings?.paths?.tmpPath ?? "./data.local/tmp",
1520315204
dbName: fileName
1520415205
});
1520515206
await exportFile.init();
@@ -15293,7 +15294,7 @@ var bootstrap = async () => {
1529315294
"--fastifyopt <fastifyopt>",
1529415295
"Advanced Fastify options - JSON Object",
1529515296
JSON.stringify({ bodyLimit: 32 * 1024 * 1024 })
15296-
).option("-p, --port <port>", "Overwrite the listening port", "1688").option("--openBrowser").option("-nx, --noExtensions", "Disable all (non core) extensions").option("-s, --secure <secure>", "Enforce secure connection", false).option("--dburl <url>", "Connection URL to the DB").option("--dbuser <user>", "DB admin user", "[email protected]").option("--viteProxy <url>", "Specify vite debugger URL").option("--autologin", "Autologin user").option("--uncensored", "Disable NSFW protections").option("--flushLogs", "Flush logs to DB").requiredOption("-l, --listen <addr>", "Sets the interface the host listens on");
15297+
).option("-p, --port <port>", "Overwrite the listening port", "1688").option("--openBrowser").option("-nx, --noExtensions", "Disable all (non core) extensions").option("-s, --secure <secure>", "Enforce secure connection", false).option("--dburl <url>", "Connection URL to the DB").option("--dbuser <user>", "DB admin user", "[email protected]").option("--viteProxy <url>", "Specify vite debugger URL").option("--autologin", "Autologin user").option("--uncensored", "Disable NSFW protections").option("--flushLogs", "Flush logs to DB").option("--noupdate", "Disable update checks").option("--createUser <userpass>", "Create a user with the given username and password in the format username:password").requiredOption("-l, --listen <addr>", "Sets the interface the host listens on");
1529715298
program.action((options) => {
1529815299
omnilog.setCustomLevel("emittery", options.emittery ? OmniLogLevels.verbose : OmniLogLevels.silent);
1529915300
omnilog.level = options.verbose ? OmniLogLevels.verbose : Number.parseInt(options.loglevel);
@@ -15453,6 +15454,9 @@ var boot = async (options) => {
1545315454
await server.start();
1545415455
omnilog.status_success(`Server has started and is ready to accept connections on ${listenOn.origin}`);
1545515456
omnilog.status_success("Ctrl-C to quit.");
15457+
if (await headlesscommands(server, options)) {
15458+
process.exit(0);
15459+
}
1545615460
if (options.openBrowser) {
1545715461
switch (os3.platform()) {
1545815462
case "win32":
@@ -15464,6 +15468,24 @@ var boot = async (options) => {
1546415468
}
1546515469
}
1546615470
};
15471+
var headlesscommands = async (server, options) => {
15472+
if (options.createUser) {
15473+
omnilog.status_start("--- Running Command - CreateUser -----");
15474+
const authService = server.integrations.get("auth");
15475+
const tokens = options.createUser.split(":");
15476+
assert3(tokens.length === 2, "Invalid username:password format. Expecting format <username:password>");
15477+
omnilog.status_start(`Creating ${tokens[0]}`);
15478+
const existUser = await authService.getUserByUsername(tokens[0]);
15479+
if (existUser !== null) {
15480+
omnilog.status_success(`User ${tokens[0]} already exists`);
15481+
return true;
15482+
}
15483+
const user = await authService.handleRegister(tokens[0], tokens[1]);
15484+
omnilog.status_success(`Created ${user.username} with ID ${user.id}`);
15485+
return true;
15486+
}
15487+
return false;
15488+
};
1546715489
bootstrap().catch((err) => {
1546815490
omnilog.trace();
1546915491
omnilog.error("Caught unhandled exception during bootstrap: ", err);

Diff for: packages/omni-server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "omni-server",
3-
"version": "0.6.3",
3+
"version": "1.0.0",
44
"packageManager": "[email protected]",
55
"main": "./dist/run.js",
66
"engines": {

Diff for: packages/omni-server/scripts/generateJwtToken.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,26 @@ const script = {
2525
// throw new Error('Action not permitted')
2626
// }
2727
// }
28-
const [action, subject, /*workflowId*/, expiresIn] = payload
28+
const [action, subject, expiresIn, ...id] = payload
29+
let conditions
30+
if (id) {
31+
if (Array.isArray(id)) {
32+
conditions = {
33+
id: {
34+
$in: id
35+
}
36+
}
37+
} else {
38+
conditions = {
39+
id
40+
}
41+
}
42+
}
2943
const scopes = [
3044
{
3145
action,
3246
subject,
33-
//conditions: {
34-
// id: workflowId
35-
//}
47+
conditions
3648
}
3749
]
3850

Diff for: packages/omni-server/src/integrations/WorkflowIntegration/WorkflowIntegration.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
type IntegrationsManager,
1919
type User
2020
} from 'omni-shared';
21-
import * as Rete from 'rete';
2221
import { v4 as uuidv4 } from 'uuid';
2322
import { OMNITOOL_DOCUMENT_TYPES, type DBService, type QueryResult } from '../../services/DBService.js';
2423
import { APIIntegration, type IAPIIntegrationConfig } from '../APIIntegration.js';
@@ -402,7 +401,7 @@ class WorkflowIntegration extends APIIntegration {
402401
const exportFile = new KVStorage(this, {
403402

404403
// @ts-ignore
405-
dbPath: this.config.tempExportDir ?? this.config.settings.paths?.tmpPath ?? './data.local/tmp',
404+
dbPath: this.config.tempExportDir ?? this.config.settings?.paths?.tmpPath ?? './data.local/tmp',
406405
dbName: fileName
407406
});
408407
await exportFile.init();

Diff for: packages/omni-server/src/run.ts

+27
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { loadServerConfig, type IServerConfig } from './loadConfig.js';
1515
import { exec } from 'child_process';
1616
import os from 'os';
1717
import fs from 'node:fs';
18+
import assert from 'node:assert';
1819

1920
// Services
2021
import { APIServerService, type IAPIServerServiceConfig } from './services/APIService.js';
@@ -108,6 +109,8 @@ const bootstrap = async (): Promise<void> => {
108109
.option('--autologin', 'Autologin user')
109110
.option('--uncensored', 'Disable NSFW protections')
110111
.option('--flushLogs', 'Flush logs to DB')
112+
.option('--noupdate', 'Disable update checks')
113+
.option('--createUser <userpass>', 'Create a user with the given username and password in the format username:password')
111114
.requiredOption('-l, --listen <addr>', 'Sets the interface the host listens on');
112115

113116
program.action((options) => {
@@ -321,6 +324,11 @@ const boot = async (options: OptionValues) => {
321324
omnilog.status_success(`Server has started and is ready to accept connections on ${listenOn.origin}`);
322325
omnilog.status_success('Ctrl-C to quit.');
323326

327+
// headless commands mode
328+
if (await headlesscommands(server, options)) {
329+
process.exit(0);
330+
}
331+
324332
// open default browser
325333
if (options.openBrowser) {
326334
switch (os.platform()) {
@@ -334,6 +342,25 @@ const boot = async (options: OptionValues) => {
334342
}
335343
};
336344

345+
const headlesscommands = async (server:Server, options: OptionValues) => {
346+
if (options.createUser) {
347+
omnilog.status_start('--- Running Command - CreateUser -----');
348+
const authService = server.integrations.get('auth') as AuthIntegration;
349+
const tokens = options.createUser.split(':');
350+
assert(tokens.length === 2, 'Invalid username:password format. Expecting format <username:password>');
351+
omnilog.status_start(`Creating ${tokens[0]}`);
352+
const existUser = await authService.getUserByUsername(tokens[0]);
353+
if (existUser !== null) {
354+
omnilog.status_success(`User ${tokens[0]} already exists`);
355+
return true;
356+
}
357+
const user = await authService.handleRegister(tokens[0], tokens[1]);
358+
omnilog.status_success(`Created ${user.username} with ID ${user.id}`);
359+
return true;
360+
}
361+
return false;
362+
}
363+
337364
bootstrap().catch((err) => {
338365
omnilog.trace();
339366
omnilog.error('Caught unhandled exception during bootstrap: ', err);

Diff for: packages/omni-shared/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "omni-shared",
33
"packageManager": "[email protected]",
4-
"version": "0.0.1",
4+
"version": "1.0.0",
55
"type": "module",
66
"main": "./lib/index.js",
77
"types": "./lib/index.d.ts",

Diff for: packages/omni-sockets/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "omni-sockets",
33
"packageManager": "[email protected]",
4-
"version": "0.0.1",
4+
"version": "1.0.0",
55
"private": true,
66
"type": "module",
77
"main": "./lib/index.js",

Diff for: packages/omni-ui/omni-client-services/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "omni-client-services",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"packageManager": "[email protected]",
55
"private": true,
66
"type": "module",

Diff for: packages/omni-ui/omni-web/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "omni-web",
33
"private": true,
4-
"version": "0.0.1",
4+
"version": "1.0.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite --host",

Diff for: setup/launcher.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,15 @@ async function run() {
270270
break;
271271
case NodeProcessEnv.production:
272272
server_entry = 'dist/run.js';
273-
await check_for_updates();
273+
// Only check for updates if --noupdate is not present in args
274+
if (!args.includes('--noupdate'))
275+
{
276+
await check_for_updates();
277+
}
278+
else
279+
{
280+
console.log('Skipping update check...');
281+
}
274282
ensure_wasm();
275283
run_production([]);
276284
break;

0 commit comments

Comments
 (0)