upstream: integrar 0.9.5 en 34 ficheros mas y portar los modulos nuevos
Segunda tanda. Resueltas por merge de tres vias 15 divergencias que no solapaban, y aplicada la version de 0.9.5 en 19 vistas y modelos donde la rama solo arrastraba codigo antiguo (firmas viejas de renderProductForm, renderJobForm, listTags sin search, y el import sin renderSpreadEditWarning). Se preserva la eliminacion de housing donde la rama lo habia descartado: modules_view, blockchain_view, search_model y tags_model. Modulos nuevos del dev portados: blog, data, gallery, mentions, polls, workflows, comments, recurrence y media_gallery, mas contentPdf, pdfDocument y content_favorites. main_views recupera renderEngagement, spreadsFor y renderSpreadEditWarning, que la rama habia eliminado y que las vistas de 0.9.5 necesitan. Sin ellas polls_view lanzaba TypeError al editar. El overlay de i18n pasa de 15 a 41 claves (46 en castellano): incorpora las 9 que upstream tenia en 0.9.1 y elimino en 0.9.5 mientras nuestro codigo las sigue usando (menuBlogs, spreadHint, chatShareUrl, forumFilterHot, publishBlog...) y las 17 de Karvan, que nunca existieron y tiraban de texto de reserva en ingles; ahora estan traducidas al castellano. Verificado con la app arrancada: declara 0.9.5, 0 claves i18n sin resolver (antes 26), 26 rutas responden 200/302, y la interfaz de la rama sale intacta: 10 categorias y 47 modulos en los hexagonos, topbar con Personal/Community y avatar, 7 accesos rapidos en la barra inferior y 0 etiquetas vacias (antes 1, la de Blogs).
This commit is contained in:
parent
f964e61a1c
commit
82b6c3ae05
43 changed files with 3221 additions and 2416 deletions
|
|
@ -1,9 +1,10 @@
|
|||
const { form, button, div, h2, h3, p, section, select, option, input, br, a, label, span } = require("../server/node_modules/hyperaxe");
|
||||
const { form, button, div, h2, h3, p, section, select, option, input, br, a, label, span, img } = require("../server/node_modules/hyperaxe");
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { getConfig } = require('../configs/config-manager.js');
|
||||
const { template, selectedLanguage, i18n, setLanguage } = require('./main_views');
|
||||
const i18nBase = require("../client/assets/translations/i18n");
|
||||
const { WORKFLOWS, currentWorkflow } = require('../models/workflows_model');
|
||||
|
||||
const snhUrl = "https://wiki.solarnethub.com/socialnet/overview";
|
||||
|
||||
|
|
@ -28,18 +29,37 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
const walletUrl = currentConfig.wallet.url;
|
||||
const walletUser = currentConfig.wallet.user;
|
||||
const walletFee = currentConfig.wallet.fee;
|
||||
const pubId = currentConfig.walletPub?.pubId || '';
|
||||
const currentWish = currentConfig.wish === 'mutuals' ? 'mutuals' : 'whole';
|
||||
const currentPmVisibility = currentConfig.pmVisibility === 'mutuals' ? 'mutuals' : 'whole';
|
||||
|
||||
const themeElements = [
|
||||
option({ value: "Dark-SNH", selected: theme === "Dark-SNH" ? true : undefined }, "Dark-SNH"),
|
||||
option({ value: "Clear-SNH", selected: theme === "Clear-SNH" ? true : undefined }, "Clear-SNH"),
|
||||
option({ value: "Purple-SNH", selected: theme === "Purple-SNH" ? true : undefined }, "Purple-SNH"),
|
||||
option({ value: "Matrix-SNH", selected: theme === "Matrix-SNH" ? true : undefined }, "Matrix-SNH"),
|
||||
option({ value: "OasisMobile", selected: theme === "OasisMobile" ? true : undefined }, "Oasis-Mobile")
|
||||
option({ value: "Dark-SNH", ...(theme === "Dark-SNH" ? true : undefined ? { selected: true } : {})}, "Dark-SNH"),
|
||||
option({ value: "Clear-SNH", ...(theme === "Clear-SNH" ? true : undefined ? { selected: true } : {})}, "Clear-SNH"),
|
||||
option({ value: "Purple-SNH", ...(theme === "Purple-SNH" ? true : undefined ? { selected: true } : {})}, "Purple-SNH"),
|
||||
option({ value: "Matrix-SNH", ...(theme === "Matrix-SNH" ? true : undefined ? { selected: true } : {})}, "Matrix-SNH"),
|
||||
option({ value: "OasisMobile", ...(theme === "OasisMobile" ? true : undefined ? { selected: true } : {})}, "Oasis-Mobile")
|
||||
];
|
||||
|
||||
const activeWorkflow = currentWorkflow(currentConfig) || '';
|
||||
const modOn = (name) => (currentConfig.modules || {})[`${name}Mod`] === 'on';
|
||||
|
||||
const workflowSection = section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.workflowsTitle),
|
||||
p(i18n.workflowsDescription),
|
||||
form(
|
||||
{ action: "/settings/workflow", method: "POST" },
|
||||
select({ name: "workflow" },
|
||||
...WORKFLOWS.map(w => activeWorkflow === w.key
|
||||
? option({ value: w.key, selected: true }, i18n[`workflow_${w.key}`])
|
||||
: option({ value: w.key }, i18n[`workflow_${w.key}`]))
|
||||
),
|
||||
br(), br(),
|
||||
button({ type: "submit" }, i18n.workflowsSet)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
const languageOption = (longName, shortName) => {
|
||||
return shortName === selectedLanguage
|
||||
? option({ value: shortName, selected: true }, longName)
|
||||
|
|
@ -69,19 +89,6 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
updateButton
|
||||
)
|
||||
),
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.theme),
|
||||
p(i18n.themeIntro),
|
||||
form(
|
||||
{ action: "/settings/theme", method: "post" },
|
||||
select({ name: "theme" }, ...themeElements),
|
||||
br(),
|
||||
br(),
|
||||
button({ type: "submit" }, i18n.setTheme)
|
||||
)
|
||||
)
|
||||
),
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.language),
|
||||
|
|
@ -115,19 +122,37 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
{ action: "/settings/ux", method: "POST" },
|
||||
(() => {
|
||||
const aiNavEnabled = currentConfig.modules && currentConfig.modules.aiNavMod === 'on';
|
||||
const opts = [
|
||||
option({ value: "blocks", selected: (currentConfig.ux?.current !== "ainav") ? true : undefined }, i18n.uxModeMenus || "Blocks")
|
||||
];
|
||||
if (aiNavEnabled) {
|
||||
opts.push(option({ value: "ainav", selected: currentConfig.ux?.current === "ainav" ? true : undefined }, i18n.uxModeAINav || "AI"));
|
||||
}
|
||||
return select({ name: "ux" }, ...opts);
|
||||
const chatsEnabled = currentConfig.modules && currentConfig.modules.chatsMod === 'on';
|
||||
const cur = currentConfig.ux?.current === "ainav" ? "ainav" : currentConfig.ux?.current === "chats" ? "chats" : "blocks";
|
||||
const uxCard = (value, title, image) => label({ class: "welcome-ux-option" },
|
||||
input({ type: "radio", name: "ux", value, ...(cur === value ? { checked: true } : {}) }),
|
||||
img({ src: image, class: "welcome-ux-shot", alt: title }),
|
||||
span({ class: "welcome-ux-label" }, title)
|
||||
);
|
||||
return div({ class: "welcome-ux-grid" },
|
||||
uxCard("blocks", i18n.uxModeMenus || "Blocks", "/assets/images/ux-blocks.png"),
|
||||
chatsEnabled ? uxCard("chats", i18n.chatsTitle || "Chats", "/assets/images/ux-chats.png") : null,
|
||||
aiNavEnabled ? uxCard("ainav", i18n.uxModeAINav || "AI", "/assets/images/ux-ainav.png") : null
|
||||
);
|
||||
})(),
|
||||
br(), br(),
|
||||
button({ type: "submit" }, i18n.saveSettings)
|
||||
)
|
||||
)
|
||||
),
|
||||
workflowSection,
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.theme),
|
||||
p(i18n.themeIntro),
|
||||
form(
|
||||
{ action: "/settings/theme", method: "post" },
|
||||
select({ name: "theme" }, ...themeElements),
|
||||
br(),
|
||||
br(),
|
||||
button({ type: "submit" }, i18n.setTheme)
|
||||
)
|
||||
)
|
||||
),
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.homePageTitle),
|
||||
|
|
@ -135,24 +160,58 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
form(
|
||||
{ action: "/settings/home-page", method: "POST" },
|
||||
select({ name: "homePage" },
|
||||
option({ value: "activity", selected: currentConfig.homePage === "activity" ? true : undefined }, i18n.activityTitle),
|
||||
option({ value: "ai", selected: currentConfig.homePage === "ai" ? true : undefined }, i18n.aiTitle),
|
||||
option({ value: "trending", selected: currentConfig.homePage === "trending" ? true : undefined }, i18n.trendingTitle),
|
||||
option({ value: "opinions", selected: currentConfig.homePage === "opinions" ? true : undefined }, i18n.opinionsTitle),
|
||||
option({ value: "forum", selected: currentConfig.homePage === "forum" ? true : undefined }, i18n.forumTitle),
|
||||
option({ value: "feed", selected: currentConfig.homePage === "feed" ? true : undefined }, i18n.feedTitle),
|
||||
option({ value: "mentions", selected: currentConfig.homePage === "mentions" ? true : undefined }, i18n.mentions),
|
||||
option({ value: "inbox", selected: currentConfig.homePage === "inbox" ? true : undefined }, i18n.inbox),
|
||||
option({ value: "agenda", selected: currentConfig.homePage === "agenda" ? true : undefined }, i18n.agendaTitle),
|
||||
option({ value: "favorites", selected: currentConfig.homePage === "favorites" ? true : undefined }, i18n.favoritesTitle),
|
||||
option({ value: "stats", selected: currentConfig.homePage === "stats" ? true : undefined }, i18n.statsTitle),
|
||||
option({ value: "blockexplorer", selected: currentConfig.homePage === "blockexplorer" ? true : undefined }, i18n.blockchain)
|
||||
...[
|
||||
{ value: "activity", label: i18n.activityTitle },
|
||||
{ value: "ai", label: i18n.aiTitle, mod: "ai" },
|
||||
{ value: "trending", label: i18n.trendingTitle, mod: "trending" },
|
||||
{ value: "forum", label: i18n.forumTitle, mod: "forum" },
|
||||
{ value: "feed", label: i18n.feedTitle, mod: "feed" },
|
||||
{ value: "chats", label: i18n.chatsTitle, mod: "chats" },
|
||||
{ value: "inbox", label: i18n.inbox },
|
||||
{ value: "mentions", label: i18n.mentions },
|
||||
{ value: "agenda", label: i18n.agendaTitle, mod: "agenda" },
|
||||
{ value: "market", label: i18n.marketTitle, mod: "market" },
|
||||
{ value: "favorites", label: i18n.favoritesTitle, mod: "favorites" }
|
||||
].filter(o => !o.mod || modOn(o.mod)).map(o => currentConfig.homePage === o.value
|
||||
? option({ value: o.value, selected: true }, o.label)
|
||||
: option({ value: o.value }, o.label))
|
||||
),
|
||||
br(), br(),
|
||||
button({ type: "submit" }, i18n.saveHomePage)
|
||||
)
|
||||
)
|
||||
),
|
||||
modOn('ai') ? section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.aiTitle),
|
||||
p(i18n.aiSettingsDescription),
|
||||
form(
|
||||
{ action: "/settings/ai", method: "POST" },
|
||||
input({
|
||||
type: "text",
|
||||
id: "ai_prompt",
|
||||
name: "ai_prompt",
|
||||
placeholder: aiPrompt,
|
||||
value: aiPrompt,
|
||||
maxlength: "128",
|
||||
required: true
|
||||
}), br(),
|
||||
label({ for: "aiSuggestions", class: "lan-checkbox-label" },
|
||||
input({
|
||||
type: "checkbox",
|
||||
id: "aiSuggestions",
|
||||
name: "ai_suggestions",
|
||||
value: "on",
|
||||
class: "lan-checkbox-input",
|
||||
checked: currentConfig.ai?.suggestions !== false ? true : undefined
|
||||
}),
|
||||
span({ class: "lan-checkbox-text" }, i18n.aiSuggestionsEnable)
|
||||
),
|
||||
br(),
|
||||
button({ type: "submit" }, i18n.saveSettings)
|
||||
)
|
||||
)
|
||||
) : null,
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.ssbLogStream),
|
||||
|
|
@ -221,9 +280,9 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
form(
|
||||
{ action: "/settings/wish", method: "POST" },
|
||||
select({ name: "wish" },
|
||||
option({ value: "whole", selected: currentWish === "whole" ? true : undefined }, i18n.settingsWishWhole),
|
||||
option({ value: "mutuals", selected: currentWish === "mutuals" ? true : undefined }, i18n.settingsWishMutuals),
|
||||
option({ value: "only-lan", selected: currentWish === "only-lan" ? true : undefined }, i18n.settingsWishOnlyLan || "Only LAN")
|
||||
option({ value: "whole", ...(currentWish === "whole" ? true : undefined ? { selected: true } : {})}, i18n.settingsWishWhole),
|
||||
option({ value: "mutuals", ...(currentWish === "mutuals" ? true : undefined ? { selected: true } : {})}, i18n.settingsWishMutuals),
|
||||
option({ value: "only-lan", ...(currentWish === "only-lan" ? true : undefined ? { selected: true } : {})}, i18n.settingsWishOnlyLan || "Only LAN")
|
||||
), br(), br(),
|
||||
button({ type: "submit" }, i18n.saveSettings)
|
||||
)
|
||||
|
|
@ -236,14 +295,14 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
form(
|
||||
{ action: "/settings/pm-visibility", method: "POST" },
|
||||
select({ name: "pmVisibility" },
|
||||
option({ value: "whole", selected: currentPmVisibility === "whole" ? true : undefined }, i18n.settingsPmVisibilityWhole),
|
||||
option({ value: "mutuals", selected: currentPmVisibility === "mutuals" ? true : undefined }, i18n.settingsPmVisibilityMutuals)
|
||||
option({ value: "whole", ...(currentPmVisibility === "whole" ? true : undefined ? { selected: true } : {})}, i18n.settingsPmVisibilityWhole),
|
||||
option({ value: "mutuals", ...(currentPmVisibility === "mutuals" ? true : undefined ? { selected: true } : {})}, i18n.settingsPmVisibilityMutuals)
|
||||
), br(), br(),
|
||||
button({ type: "submit" }, i18n.saveSettings)
|
||||
)
|
||||
)
|
||||
),
|
||||
section(
|
||||
modOn('wallet') ? section(
|
||||
{ id: "wallet" },
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.wallet),
|
||||
|
|
@ -264,45 +323,9 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
button({ type: "submit" }, i18n.walletConfiguration)
|
||||
)
|
||||
)
|
||||
),
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.pubIdTitle || "PUB Wallet"),
|
||||
p(i18n.pubIdDescription || "Set the PUB OASIS ID. This will be used for PUB transactions (including the UBI)."),
|
||||
form(
|
||||
{ action: "/settings/pub-id", method: "POST" },
|
||||
input({
|
||||
type: "text",
|
||||
id: "pub_id",
|
||||
name: "pub_id",
|
||||
value: pubId,
|
||||
placeholder: i18n.pubIdPlaceholder || "@example.ed25519"
|
||||
}), br(),
|
||||
button({ type: "submit" }, i18n.pubIdSave || "Save configuration")
|
||||
)
|
||||
)
|
||||
),
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.aiTitle),
|
||||
p(i18n.aiSettingsDescription),
|
||||
form(
|
||||
{ action: "/settings/ai", method: "POST" },
|
||||
input({
|
||||
type: "text",
|
||||
id: "ai_prompt",
|
||||
name: "ai_prompt",
|
||||
placeholder: aiPrompt,
|
||||
value: aiPrompt,
|
||||
maxlength: "128",
|
||||
required: true
|
||||
}), br(),
|
||||
button({ type: "submit" }, i18n.aiConfiguration)
|
||||
)
|
||||
)
|
||||
),
|
||||
section(
|
||||
{ id: "fediverse" },
|
||||
) : null,
|
||||
modOn('fediverse') ? section(
|
||||
{ id: "multiverse" },
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.fediverseSettingsTitle),
|
||||
div({ class: "fediverse-network" },
|
||||
|
|
@ -333,7 +356,7 @@ const settingsView = ({ version, aiPrompt, fediverseAccount, fediverseError }) =
|
|||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
) : null,
|
||||
section(
|
||||
div({ class: "tags-header" },
|
||||
h2(i18n.indexes),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue