From d2ea1fe7c3f9eedb62dc65efd81abfdd88fd3b7c Mon Sep 17 00:00:00 2001 From: idnc_sk Date: Mon, 17 Feb 2025 08:47:34 +0100 Subject: [PATCH 1/2] sync, codebase to be removed, new api in canvas-server/canvas-synapsd --- package.json | 1 - src/env.js | 82 ---------------------------------------------------- src/main.js | 17 ++++------- 3 files changed, 6 insertions(+), 94 deletions(-) delete mode 100644 src/env.js diff --git a/package.json b/package.json index dcdff93..f4bf96d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "version": "1.2.1", "description": "Context layer on top of your unstructured universe", "main": "src/main.js", - "type": "module", "scripts": { "test": "eslint . --ext .js", "test:fix": "eslint . --ext .js --fix", diff --git a/src/env.js b/src/env.js deleted file mode 100644 index fdd84aa..0000000 --- a/src/env.js +++ /dev/null @@ -1,82 +0,0 @@ -import os from 'os'; -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; -import dotenv from 'dotenv'; - -const APP_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url))); -const isPortable = () => fs.existsSync(path.join(APP_ROOT, 'user', '.portable')); - -// Utils -const createPathConfig = (base, paths) => - Object.fromEntries( - paths.map(([key, subpath]) => [ - key, - process.env[key] || path.join(base, subpath) - ]) - ); - -const getUserHome = () => { - if (isPortable()) { - return path.join(APP_ROOT, 'user'); - } - return path.join( - os.homedir(), - process.platform === 'win32' ? 'Canvas' : '.canvas' - ); -}; - -// Determine user home directory -const USER_HOME = process.env.CANVAS_USER_HOME || getUserHome(); - -// Env path configuration -const config = { - // Runtime settings - CANVAS_APP_ROOT: APP_ROOT, - CANVAS_APP_PORTABLE: isPortable(), - NODE_ENV: process.env.NODE_ENV || 'development', - LOG_LEVEL: process.env.LOG_LEVEL || 'debug', - - /** - * User directories - * - * USER_HOME - * ├── config - * ├── cache - * ├── data - * | ├── index - * | ├── db - * ├── workspaces - * ├── universe - * ├── .workspace.json - * ├── index - * ├── foo - */ - ...createPathConfig(USER_HOME, [ - ['CANVAS_USER_HOME', ''], - ['CANVAS_USER_CONFIG', 'config'], - ['CANVAS_USER_CACHE', 'cache'], - ['CANVAS_USER_DATA', 'data'], - ['CANVAS_USER_WORKSPACES', 'workspaces'] - ]), -}; - -// Load and manage .env file -const envPath = path.join(APP_ROOT, '.env'); -const envResult = dotenv.config({ path: envPath }); - -if (envResult.error || !Object.keys(envResult.parsed || {}).length) { - const envContent = Object.entries(config) - .map(([key, value]) => `${key}="${value}"`) - .join('\n'); - - fs.writeFileSync(envPath, envContent); - dotenv.config({ path: envPath }); -} - -// Ensure all config values are in process.env -Object.entries(config).forEach(([key, value]) => { - process.env[key] = process.env[key] || value; -}); - -export default config; diff --git a/src/main.js b/src/main.js index d98c1ed..b270600 100644 --- a/src/main.js +++ b/src/main.js @@ -2,13 +2,6 @@ * Canvas */ -// Environment variables -const { - APP, - // server, - USER, -} = require("./env.js"); - // Utils const path = require("path"); const debug = require("debug")("canvas"); @@ -32,7 +25,8 @@ const { const socketIO = require("socket.io-client"); // Test -const socket = socketIO.connect("http://138.124.180.38:8000"); +//const socket = socketIO.connect("http://138.124.180.38:8000"); +const socket = socketIO.connect("http://127.0.0.1:8000"); // Import the toolbox module const toolbox = require('./components/toolbox'); @@ -42,15 +36,16 @@ var contextTree; var sessionTree; // Set a few handy runtime variables -app.setName(APP.name); -app.version = APP.version; +//app.setName(APP.name); +//app.version = APP.version; app.isQuitting = false; // Enable default sandboxing app.enableSandbox(); // Lets take care of some electron defaults -const electronHome = path.join(USER.paths.home, "electron"); // Stash electron-generated garbage here +//const electronHome = path.join(USER.paths.home, "electron"); // Stash electron-generated garbage here +const electronHome = "/tmp/test"; app.setPath("appData", path.join(electronHome, "appData")); app.setPath("userData", path.join(electronHome, "userData")); app.setPath("cache", path.join(electronHome, "cache")); From d6b9c3ea3cb5e40a855d54bb9420d5b9f461969f Mon Sep 17 00:00:00 2001 From: idnc_sk Date: Wed, 19 Mar 2025 22:20:08 +0100 Subject: [PATCH 2/2] sync --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 521f6fc..2e50590 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,9 @@ $ cd path/to/Canvas $ yarn install $ yarn start ``` + +## Canvas(the UI element) plugins test-list + +- https://www.rowsncolumns.app/ +- https://konvajs.org/api +- https://pixijs.com/