mirror of
https://github.com/HeyPuter/puter.git
synced 2026-01-08 14:10:41 -06:00
Allow relative paths for creating puter s2w workers
This commit is contained in:
committed by
Eric Dubé
parent
050ad0f785
commit
f962a6a838
@@ -34,6 +34,7 @@ const { Eq } = require("../../om/query/query");
|
||||
const { get_app } = require("../../helpers");
|
||||
const { UsernameNotifSelector } = require("../NotificationService");
|
||||
const APIError = require("../../api/APIError");
|
||||
const FSNodeParam = require("../../api/filesystem/FSNodeParam");
|
||||
|
||||
async function readPuterFile(actor, filePath) {
|
||||
try {
|
||||
@@ -189,7 +190,11 @@ class WorkerService extends BaseService {
|
||||
try {
|
||||
workerName = workerName.toLocaleLowerCase(); // just incase
|
||||
if(!(/^[a-zA-Z0-9_]+$/.test(workerName))) return;
|
||||
|
||||
|
||||
filePath = await (await (new FSNodeParam('path')).consolidate({
|
||||
req: { user: Context.get("actor").type.user },
|
||||
getParam: () => filePath,
|
||||
})).get("path");
|
||||
const userData = await getUserInfo(authorization, this.global_config.api_base_url);
|
||||
const actor = Context.get("actor");
|
||||
const es_subdomain = this.services.get('es:subdomain');
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import getAbsolutePathForApp from "./FileSystem/utils/getAbsolutePathForApp.js";
|
||||
|
||||
export class WorkersHandler {
|
||||
|
||||
constructor(authToken) {
|
||||
@@ -10,6 +12,7 @@ export class WorkersHandler {
|
||||
if (!currentWorkers) {
|
||||
currentWorkers = {};
|
||||
}
|
||||
filePath = getAbsolutePathForApp(filePath);
|
||||
|
||||
const driverCall = await puter.drivers.call("workers", "worker-service", "create", { authorization: puter.authToken, filePath, workerName });
|
||||
const driverResult = driverCall.result;
|
||||
|
||||
Reference in New Issue
Block a user