From a11a730c2618baee942416eb745120713b66dca9 Mon Sep 17 00:00:00 2001 From: oasis-bot Date: Sun, 18 Oct 2026 02:52:17 +0200 Subject: [PATCH] workflows: activistas con lo justo para organizarse Chats, Karvan, pads, foro, imagenes, videos, wiki y blogs, mas feed, invitaciones y copia de seguridad. Karvan entra en la lista de modulos para que los workflows lo enciendan y apaguen como al resto. En movil un workflow cambia los modulos y no el tema: se queda OasisMobile. --- src/models/workflows_model.js | 106 ++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 32 deletions(-) diff --git a/src/models/workflows_model.js b/src/models/workflows_model.js index 19c258c..781b90e 100644 --- a/src/models/workflows_model.js +++ b/src/models/workflows_model.js @@ -1,21 +1,32 @@ const ALL_MODULES = [ - 'agenda', 'ai', 'aiNav', 'audios', 'banking', 'blogs', 'bookmarks', 'calendars', 'chats', 'cipher', - 'courts', 'dev', 'docs', 'events', 'favorites', 'fediverse', 'feed', 'forum', 'games', 'graphos', - 'housing', 'images', 'industry', 'invites', 'jobs', 'larp', 'legacy', 'logs', 'maps', 'market', - 'melody', 'opinions', 'pads', 'parliament', 'pixelia', 'polls', 'projects', 'reports', 'shops', + 'agenda', 'ai', 'aiNav', 'emergencies', 'audios', 'backup', 'banking', 'blogs', 'bookmarks', 'calendars', 'campaigns', 'chats', 'cipher', + 'courts', 'dev', 'docs', 'events', 'favorites', 'fediverse', 'feed', 'files', 'forum', 'games', 'graphos', + 'housing', 'images', 'industry', 'invites', 'jobs', 'karvan', 'larp', 'logistics', 'logs', 'mailing', 'maps', 'market', + 'melody', 'opinions', 'pads', 'wiki', 'parliament', 'phone', 'pixelia', 'podcasts', 'polls', 'projects', 'reports', 'rooms', 'school', 'shops', 'tags', 'tasks', 'torrents', 'transfers', 'trending', 'tribes', 'videos', 'votes', 'wallet' ]; -const NETWORK = ['feed', 'blogs', 'tags', 'trending', 'opinions', 'pads', 'forum', 'maps', 'chats']; -const MEDIA = ['audios', 'bookmarks', 'docs', 'images', 'torrents', 'videos']; -const OFFICE = ['agenda', 'calendars', 'events', 'tasks', 'reports', 'favorites']; -const GOVERNANCE = ['tribes', 'larp', 'votes', 'polls', 'parliament', 'courts', 'logs']; -const ECONOMY = ['banking', 'wallet', 'transfers', 'market', 'housing', 'jobs', 'shops', 'industry', 'projects']; +const NETWORK = ['feed', 'blogs', 'tags', 'trending', 'opinions', 'pads', 'wiki', 'forum', 'maps', 'chats', 'rooms']; +const MEDIA = ['audios', 'bookmarks', 'docs', 'files', 'images', 'torrents', 'videos', 'podcasts']; +const OFFICE = ['agenda', 'calendars', 'campaigns', 'events', 'tasks', 'reports', 'mailing', 'phone', 'favorites']; +const GOVERNANCE = ['tribes', 'larp', 'votes', 'polls', 'school', 'parliament', 'courts', 'emergencies', 'logs']; +const ECONOMY = ['banking', 'wallet', 'transfers', 'market', 'logistics', 'housing', 'jobs', 'shops', 'industry', 'projects']; + +const PRESET_BASE = ['backup', 'invites', 'favorites', 'tags', 'trending', 'cipher']; +const PRESETS = { + minimal: ['feed', 'forum', 'games', 'images', 'videos', 'audios', 'bookmarks', 'tags', 'trending', 'blogs', 'polls', 'opinions', 'cipher', 'backup'], + social: ['agenda', 'emergencies', 'audios', 'bookmarks', 'calendars', 'campaigns', 'chats', 'cipher', 'courts', 'docs', 'events', 'favorites', 'fediverse', 'feed', 'forum', 'games', 'images', 'invites', 'larp', 'backup', 'logs', 'mailing', 'phone', 'maps', 'blogs', 'polls', 'opinions', 'pads', 'wiki', 'parliament', 'pixelia', 'podcasts', 'melody', 'projects', 'reports', 'rooms', 'school', 'tags', 'tasks', 'trending', 'tribes', 'videos', 'votes'], + economy: ['agenda', 'emergencies', 'audios', 'bookmarks', 'calendars', 'campaigns', 'chats', 'cipher', 'courts', 'docs', 'events', 'favorites', 'fediverse', 'feed', 'forum', 'games', 'images', 'invites', 'larp', 'backup', 'logs', 'mailing', 'phone', 'maps', 'blogs', 'polls', 'opinions', 'pads', 'wiki', 'parliament', 'pixelia', 'podcasts', 'melody', 'projects', 'reports', 'rooms', 'tags', 'tasks', 'trending', 'tribes', 'videos', 'votes', 'banking', 'wallet', 'transfers', 'market', 'housing', 'jobs', 'shops', 'industry', 'school', 'logistics'], + office: [...new Set([...OFFICE, 'votes', 'polls', 'projects', 'docs', 'pads', 'wiki', 'tribes', 'chats', 'rooms', 'feed', ...PRESET_BASE])], + library: [...new Set([...MEDIA, 'feed', ...PRESET_BASE])], + mobile: null, + full: null +}; const MOBILE_MODULES = [ 'agenda', 'favorites', 'wallet', 'tribes', 'larp', 'votes', 'polls', 'events', 'calendars', 'tasks', - 'reports', 'banking', 'market', 'housing', 'jobs', 'shops', 'transfers', 'cipher', 'invites', - 'games', 'audios', 'bookmarks', 'docs', 'images', ...NETWORK + 'reports', 'banking', 'market', 'housing', 'jobs', 'shops', 'school', 'courts', 'transfers', 'cipher', 'invites', + 'games', 'audios', 'bookmarks', 'docs', 'files', 'images', 'torrents', 'emergencies', 'mailing', 'logistics', 'podcasts', 'campaigns', 'karvan', ...NETWORK.filter(m => m !== 'rooms') ]; const WORKFLOWS = [ @@ -30,40 +41,42 @@ const WORKFLOWS = [ theme: 'Clear-SNH', homePage: 'activity', modules: [...OFFICE, 'jobs', 'projects', 'industry', 'market', 'shops', 'banking', 'wallet', 'transfers', - 'forum', 'chats', 'pads', 'feed', 'tags', 'trending', 'docs', 'invites'] - }, - { - key: 'ruling', - theme: 'Purple-SNH', - homePage: 'activity', - modules: [...GOVERNANCE, ...OFFICE, 'forum', 'pads', 'chats', 'feed', 'blogs', 'opinions', 'tags', 'trending', 'docs', 'invites'] - }, - { - key: 'politics', - theme: 'Dark-SNH', - homePage: 'trending', - modules: ['parliament', 'courts', 'votes', 'polls', 'reports', 'logs', 'forum', 'opinions', 'blogs', - 'feed', 'tags', 'trending', 'pads', 'chats', 'fediverse', 'tribes', 'events', 'agenda'] + 'forum', 'chats', 'rooms', 'pads', 'wiki', 'feed', 'tags', 'trending', 'docs', 'invites'] }, { key: 'social', theme: 'Clear-SNH', homePage: 'feed', - modules: [...NETWORK, ...MEDIA, 'events', 'calendars', 'agenda', 'favorites', 'games', 'pixelia', - 'melody', 'tribes', 'fediverse', 'invites', 'polls'] + modules: [...NETWORK, ...MEDIA, 'events', 'calendars', 'agenda', 'favorites', 'phone', 'games', 'pixelia', + 'melody', 'tribes', 'fediverse', 'invites', 'polls', 'school', 'emergencies'] }, { key: 'business', theme: 'Dark-SNH', homePage: 'activity', - modules: [...ECONOMY, ...OFFICE, 'forum', 'chats', 'pads', 'docs', 'feed', 'tags', 'trending', 'invites', 'cipher'] + modules: [...ECONOMY, ...OFFICE, 'forum', 'chats', 'rooms', 'pads', 'wiki', 'emergencies', 'docs', 'feed', 'tags', 'trending', 'invites', 'cipher'] }, { key: 'night', theme: 'Matrix-SNH', homePage: 'feed', - modules: ['feed', 'blogs', 'opinions', 'chats', 'forum', 'tags', 'trending', 'audios', 'videos', - 'images', 'bookmarks', 'melody', 'games', 'pixelia', 'favorites'] + modules: ['feed', 'blogs', 'opinions', 'chats', 'rooms', 'forum', 'tags', 'trending', 'audios', 'videos', + 'images', 'bookmarks', 'melody', 'games', 'pixelia', 'favorites', 'school'] + }, + { + key: 'kids', + theme: 'Clear-SNH', + homePage: 'activity', + modules: ['school', 'games', 'pixelia', 'melody', 'images', 'audios', 'videos', 'docs', 'bookmarks', + 'agenda', 'calendars', 'events', 'tasks', 'favorites', 'feed', 'blogs', 'chats', 'pads', 'maps', + 'tags', 'trending', 'tribes', 'larp', 'polls', 'opinions', 'invites'] + }, + { + // lo justo para organizarse: hablar, escribir juntos y compartir lo que pasa + key: 'activists', + theme: 'Purple-SNH', + homePage: 'activity', + modules: ['chats', 'karvan', 'pads', 'forum', 'images', 'videos', 'wiki', 'blogs', 'feed', 'invites', 'backup'] }, { key: 'mobile', @@ -75,6 +88,9 @@ const WORKFLOWS = [ const WORKFLOW_KEYS = WORKFLOWS.map(w => w.key); +const isMobile = () => process.env.OASIS_MOBILE === '1'; +const themeOf = (workflow) => (isMobile() ? 'OasisMobile' : workflow.theme); + const getWorkflow = (key) => WORKFLOWS.find(w => w.key === String(key || '')) || null; const modulesOf = (workflow) => { @@ -87,18 +103,44 @@ const currentWorkflow = (config) => { const theme = (config && config.themes && config.themes.current) || ''; return WORKFLOW_KEYS.find(key => { const w = getWorkflow(key); - if (theme !== w.theme) return false; + if (theme !== themeOf(w)) return false; const on = new Set(modulesOf(w)); return ALL_MODULES.every(m => (modules[`${m}Mod`] === 'on') === on.has(m)); }) || null; }; +const applyWorkflow = (cfg, workflow) => { + const enabled = new Set(modulesOf(workflow)); + cfg.modules = cfg.modules || {}; + ALL_MODULES.forEach(mod => { cfg.modules[`${mod}Mod`] = enabled.has(mod) ? 'on' : 'off'; }); + if (workflow.theme) cfg.themes = { ...(cfg.themes || {}), current: themeOf(workflow) }; + if (workflow.homePage) cfg.homePage = workflow.homePage; + return cfg; +}; + +const FULL_WORKFLOW = { key: 'full', modules: ALL_MODULES }; + +const WIZARD_WORKFLOWS = ['full', 'social', 'activists', 'kids', 'night', 'jobs', 'business', 'mobile']; + +const wizardWorkflow = (key) => { + const k = String(key || ''); + if (!WIZARD_WORKFLOWS.includes(k)) return null; + return k === 'full' ? FULL_WORKFLOW : getWorkflow(k); +}; + +PRESETS.mobile = MOBILE_MODULES; +PRESETS.full = ALL_MODULES; + module.exports = { ALL_MODULES, MOBILE_MODULES, + PRESETS, WORKFLOWS, WORKFLOW_KEYS, getWorkflow, modulesOf, - currentWorkflow + currentWorkflow, + applyWorkflow, + WIZARD_WORKFLOWS, + wizardWorkflow };