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.
This commit is contained in:
oasis-bot 2026-10-18 02:52:17 +02:00
parent c332afd6ea
commit a11a730c26

View file

@ -1,21 +1,32 @@
const ALL_MODULES = [ const ALL_MODULES = [
'agenda', 'ai', 'aiNav', 'audios', 'banking', 'blogs', 'bookmarks', 'calendars', 'chats', 'cipher', 'agenda', 'ai', 'aiNav', 'emergencies', 'audios', 'backup', 'banking', 'blogs', 'bookmarks', 'calendars', 'campaigns', 'chats', 'cipher',
'courts', 'dev', 'docs', 'events', 'favorites', 'fediverse', 'feed', 'forum', 'games', 'graphos', 'courts', 'dev', 'docs', 'events', 'favorites', 'fediverse', 'feed', 'files', 'forum', 'games', 'graphos',
'housing', 'images', 'industry', 'invites', 'jobs', 'larp', 'legacy', 'logs', 'maps', 'market', 'housing', 'images', 'industry', 'invites', 'jobs', 'karvan', 'larp', 'logistics', 'logs', 'mailing', 'maps', 'market',
'melody', 'opinions', 'pads', 'parliament', 'pixelia', 'polls', 'projects', 'reports', 'shops', 'melody', 'opinions', 'pads', 'wiki', 'parliament', 'phone', 'pixelia', 'podcasts', 'polls', 'projects', 'reports', 'rooms', 'school', 'shops',
'tags', 'tasks', 'torrents', 'transfers', 'trending', 'tribes', 'videos', 'votes', 'wallet' 'tags', 'tasks', 'torrents', 'transfers', 'trending', 'tribes', 'videos', 'votes', 'wallet'
]; ];
const NETWORK = ['feed', 'blogs', 'tags', 'trending', 'opinions', 'pads', 'forum', 'maps', 'chats']; const NETWORK = ['feed', 'blogs', 'tags', 'trending', 'opinions', 'pads', 'wiki', 'forum', 'maps', 'chats', 'rooms'];
const MEDIA = ['audios', 'bookmarks', 'docs', 'images', 'torrents', 'videos']; const MEDIA = ['audios', 'bookmarks', 'docs', 'files', 'images', 'torrents', 'videos', 'podcasts'];
const OFFICE = ['agenda', 'calendars', 'events', 'tasks', 'reports', 'favorites']; const OFFICE = ['agenda', 'calendars', 'campaigns', 'events', 'tasks', 'reports', 'mailing', 'phone', 'favorites'];
const GOVERNANCE = ['tribes', 'larp', 'votes', 'polls', 'parliament', 'courts', 'logs']; const GOVERNANCE = ['tribes', 'larp', 'votes', 'polls', 'school', 'parliament', 'courts', 'emergencies', 'logs'];
const ECONOMY = ['banking', 'wallet', 'transfers', 'market', 'housing', 'jobs', 'shops', 'industry', 'projects']; 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 = [ const MOBILE_MODULES = [
'agenda', 'favorites', 'wallet', 'tribes', 'larp', 'votes', 'polls', 'events', 'calendars', 'tasks', 'agenda', 'favorites', 'wallet', 'tribes', 'larp', 'votes', 'polls', 'events', 'calendars', 'tasks',
'reports', 'banking', 'market', 'housing', 'jobs', 'shops', 'transfers', 'cipher', 'invites', 'reports', 'banking', 'market', 'housing', 'jobs', 'shops', 'school', 'courts', 'transfers', 'cipher', 'invites',
'games', 'audios', 'bookmarks', 'docs', 'images', ...NETWORK 'games', 'audios', 'bookmarks', 'docs', 'files', 'images', 'torrents', 'emergencies', 'mailing', 'logistics', 'podcasts', 'campaigns', 'karvan', ...NETWORK.filter(m => m !== 'rooms')
]; ];
const WORKFLOWS = [ const WORKFLOWS = [
@ -30,40 +41,42 @@ const WORKFLOWS = [
theme: 'Clear-SNH', theme: 'Clear-SNH',
homePage: 'activity', homePage: 'activity',
modules: [...OFFICE, 'jobs', 'projects', 'industry', 'market', 'shops', 'banking', 'wallet', 'transfers', modules: [...OFFICE, 'jobs', 'projects', 'industry', 'market', 'shops', 'banking', 'wallet', 'transfers',
'forum', 'chats', 'pads', 'feed', 'tags', 'trending', 'docs', 'invites'] 'forum', 'chats', 'rooms', 'pads', 'wiki', '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']
}, },
{ {
key: 'social', key: 'social',
theme: 'Clear-SNH', theme: 'Clear-SNH',
homePage: 'feed', homePage: 'feed',
modules: [...NETWORK, ...MEDIA, 'events', 'calendars', 'agenda', 'favorites', 'games', 'pixelia', modules: [...NETWORK, ...MEDIA, 'events', 'calendars', 'agenda', 'favorites', 'phone', 'games', 'pixelia',
'melody', 'tribes', 'fediverse', 'invites', 'polls'] 'melody', 'tribes', 'fediverse', 'invites', 'polls', 'school', 'emergencies']
}, },
{ {
key: 'business', key: 'business',
theme: 'Dark-SNH', theme: 'Dark-SNH',
homePage: 'activity', 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', key: 'night',
theme: 'Matrix-SNH', theme: 'Matrix-SNH',
homePage: 'feed', homePage: 'feed',
modules: ['feed', 'blogs', 'opinions', 'chats', 'forum', 'tags', 'trending', 'audios', 'videos', modules: ['feed', 'blogs', 'opinions', 'chats', 'rooms', 'forum', 'tags', 'trending', 'audios', 'videos',
'images', 'bookmarks', 'melody', 'games', 'pixelia', 'favorites'] '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', key: 'mobile',
@ -75,6 +88,9 @@ const WORKFLOWS = [
const WORKFLOW_KEYS = WORKFLOWS.map(w => w.key); 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 getWorkflow = (key) => WORKFLOWS.find(w => w.key === String(key || '')) || null;
const modulesOf = (workflow) => { const modulesOf = (workflow) => {
@ -87,18 +103,44 @@ const currentWorkflow = (config) => {
const theme = (config && config.themes && config.themes.current) || ''; const theme = (config && config.themes && config.themes.current) || '';
return WORKFLOW_KEYS.find(key => { return WORKFLOW_KEYS.find(key => {
const w = getWorkflow(key); const w = getWorkflow(key);
if (theme !== w.theme) return false; if (theme !== themeOf(w)) return false;
const on = new Set(modulesOf(w)); const on = new Set(modulesOf(w));
return ALL_MODULES.every(m => (modules[`${m}Mod`] === 'on') === on.has(m)); return ALL_MODULES.every(m => (modules[`${m}Mod`] === 'on') === on.has(m));
}) || null; }) || 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 = { module.exports = {
ALL_MODULES, ALL_MODULES,
MOBILE_MODULES, MOBILE_MODULES,
PRESETS,
WORKFLOWS, WORKFLOWS,
WORKFLOW_KEYS, WORKFLOW_KEYS,
getWorkflow, getWorkflow,
modulesOf, modulesOf,
currentWorkflow currentWorkflow,
applyWorkflow,
WIZARD_WORKFLOWS,
wizardWorkflow
}; };