fix: cerrar la integracion 0.9.5 — recursos que faltaban y regresiones

Una revision a fondo del arbol contra 0.9.5 saco varios fallos, unos heredados y
otros que introdujo la propia integracion. Verificados uno a uno antes de tocar.

Recursos referenciados que no existian (los introduje al adoptar vistas de 0.9.5
que los usan, mientras la rama los habia borrado):
- Los cuatro temas *-SNH.css. settings_view ofrece Dark, Clear, Matrix y Purple,
  pero solo estaba OasisMobile: elegir cualquiera daba 404 y la app se quedaba sin
  estilos. Ahora los cuatro responden 200.
- pdf.min.mjs, pdf.worker.min.mjs y pdf-viewer.js, referenciados desde seis vistas.

Regresiones revertidas a 0.9.5 verbatim en catorce ficheros. Las de fondo:
- larp_model perdio getGoverningPeriodId, que backend.js llama: el anuncio de
  gobierno no salia nunca, con el TypeError tragado por un catch.
- courts_view y search_view tenian selected: false, que hyperscript SI serializa
  como atributo y HTML interpreta como seleccionado. La forma de upstream, el
  spread condicional, es la correcta.
- pm_model perdio includeDeleted, projects_model la validacion de deadline pasado,
  jobs_model el desempate por timestamp, middleware el flag de debug HTTP.

forum_view pasa a 0.9.5 conservando el filtro hot. Esto arregla un fallo activo: la
vista de la rama declaraba un cuarto parametro topic y backend.js llama con cinco
argumentos, asi que al abrir una respuesta el %clave del hilo se colaba como tema y
el hilo salia VACIO. Upstream pasa los mismos cinco argumentos a una firma de tres y
JS los ignora, que es lo correcto.

chats_view pasa a 0.9.5 y se implementa replyTo de verdad. Estaba muerto de punta a
punta: backend.js no leia ctx.query.replyTo ni pasaba el cuarto argumento a
sendMessage, asi que ningun mensaje llegaba a tener replyTo y la cita no se
renderizaba jamas. Ahora la cadena esta completa —modelo, GET, POST y vista— con
indice msgById armado antes de mezclar con las encuestas, y sin gate de movil:
responder a un mensaje no es una funcion de movil.

aria-label: encontrada la causa. No es que hyperaxe lo ignore, es que hyperscript
solo asigna como propiedad y html-element solo serializa atributos de su tabla, en
la que aria-* no esta; data-* si tiene rama propia, por eso las tablas responsive
funcionaban. Se arregla con el escape hatch attrs:{}, sin tocar node_modules.

prepare.sh copia README.md y falla si no esta: backend.js lo lee con readFileSync
sin try/catch, de modo que sin el fichero el backend muere con ENOENT al arrancar.

Verificado con la app en marcha: 17 rutas OK, los cuatro recursos que faltaban
sirviendo 200, aria-label emitido en el HTML, e interfaz intacta (10 categorias,
50 modulos, 7 accesos rapidos, 0 etiquetas vacias).
This commit is contained in:
SITO 2026-08-18 23:48:14 +02:00
parent 7459644a73
commit c3a1c841e6
27 changed files with 1994 additions and 220 deletions

View file

@ -3,7 +3,7 @@ const {
input, label, br, select, option, h2, textarea
} = require("../server/node_modules/hyperaxe");
const moment = require("../server/node_modules/moment");
const { template, i18n, userLink, renderSpreadButton, renderPrivacyChip, renderLifespanChip } = require('./main_views');
const { template, i18n, userLink, renderSpreadButton, renderPrivacyChip, renderLifespanChip, renderContentActions } = require('./main_views');
const { renderEncryptedChip: renderForumEncryptedChip } = require('./clearnet_view');
const { config } = require('../server/SSB_server.js');
const { renderUrl } = require('../backend/renderUrl');
@ -23,8 +23,8 @@ exports.renderForumInvitePage = (code) => {
};
const BASE_FILTERS = ['hot','all','mine','recent','top'];
const CAT_BLOCK1 = ['GENERAL','OASIS','L.A.R.P.','POLITICS','TECH'];
const CAT_BLOCK2 = ['SCIENCE','MUSIC','ART','GAMING','BOOKS','FILMS'];
const CAT_BLOCK1 = ['GENERAL','OASIS','L.A.R.P.'];
const CAT_BLOCK2 = ['POLITICS','TECH','SCIENCE','MUSIC','ART','GAMING','BOOKS','FILMS'];
const CAT_BLOCK3 = ['PHILOSOPHY','SOCIETY','PRIVACY','CYBERWARFARE','SURVIVALISM'];
const ALL_CATS = [...CAT_BLOCK1, ...CAT_BLOCK2, ...CAT_BLOCK3];
@ -99,7 +99,7 @@ const renderForumForm = () =>
label(i18n.forumTitleLabel), br(),
input({
type: 'text',
name: 'title',
name: 'title', maxlength: '100',
required: true,
placeholder: i18n.forumTitlePlaceholder
}), br(), br(),
@ -138,7 +138,7 @@ const renderThread = (nodes, level = 0, forumId) => {
userLink(m.author),
div({ class: 'comment-votes' },
span({ class: 'votes-count' }, `▲: ${m.positiveVotes || 0}`),
span({ class: 'votes-count', style: 'margin-left:12px;' },
span({ class: 'votes-count votes-count-negative' },
`▼: ${m.negativeVotes || 0}`)
)
),
@ -190,6 +190,9 @@ const renderForumList = (forums, currentFilter, spreadMap = new Map()) => {
renderVotes(f.key, f.score, f.key)
),
div({ class: 'forum-main-col' },
div({ class: 'card-header activity-card-header' },
renderContentActions(f.key, `/forum/${encodeURIComponent(f.key)}`, { spread: spreadMap.get(f.key) || null, author: f.author, favKind: 'forum', isFavorite: f.isFavorite, reportTitle: f.title })
),
div({ class: 'forum-header-row' },
a({
class: 'forum-category',
@ -210,20 +213,13 @@ const renderForumList = (forums, currentFilter, spreadMap = new Map()) => {
div({ class: 'forum-meta' },
span({ class: 'forum-positive-votes' },
`▲: ${f.positiveVotes || 0}`),
span({ class: 'forum-negative-votes', style: 'margin-left:12px;' },
span({ class: 'forum-negative-votes' },
`▼: ${f.negativeVotes || 0}`),
span({ class: 'forum-participants' },
`${i18n.forumParticipants.toUpperCase()}: ${f.participants?.length || 1}`),
span({ class: 'forum-messages' },
`${i18n.forumMessages.toUpperCase()}: ${(f.messagesCount || 1) - 1}`),
form({ method: 'GET', action: `/forum/${encodeURIComponent(f.key)}`, class: 'visit-forum-form' },
button({ type: 'submit', class: 'filter-btn' }, i18n.forumVisitButton)
)
`${i18n.forumMessages.toUpperCase()}: ${(f.messagesCount || 1) - 1}`)
),
(() => {
const btn = renderSpreadButton(f.key, spreadMap.get(f.key));
return btn ? div({ class: 'card-spread-left' }, btn) : null;
})(),
div({ class: 'forum-footer' },
span({ class: 'date-link' },
`${moment(f.createdAt).format('YYYY/MM/DD HH:mm:ss')} ${i18n.performed}`),
@ -253,9 +249,7 @@ exports.forumView = async (forums, currentFilter, params = {}) => {
return template(i18n.forumTitle,
section(
div({ class: 'tags-header' },
h2(currentFilter === 'create'
? i18n.forumCreateSectionTitle
: i18n.forumTitle),
h2(i18n.forumTitle),
p(i18n.forumDescription)
),
div({ class: 'mode-buttons-cols' },
@ -271,6 +265,17 @@ exports.forumView = async (forums, currentFilter, params = {}) => {
generateFilterButtons(CAT_BLOCK3, currentFilter, '/forum', CAT_I18N_MAP_UP),
renderCreateForumButton()
),
currentFilter === 'create'
? null
: div({ class: 'filters' },
form({ method: 'GET', action: '/forum', class: 'filter-box' },
input({ type: 'hidden', name: 'filter', value: currentFilter || 'all' }),
input({ type: 'text', name: 'q', value: params.q || '', placeholder: i18n.forumSearchPlaceholder, class: 'filter-box__input' }),
div({ class: 'filter-box__controls' },
button({ type: 'submit', class: 'filter-box__button' }, i18n.searchButton)
)
)
),
currentFilter === 'create'
? renderForumForm()
: renderForumList(
@ -282,20 +287,8 @@ exports.forumView = async (forums, currentFilter, params = {}) => {
);
};
exports.singleForumView = async (forum, messagesData, currentFilter, topic = '') => {
exports.singleForumView = async (forum, messagesData, currentFilter) => {
const CAT_I18N_MAP_UP = ALL_CATS.reduce((m,c)=>{ m[c]=(catLabel(c)||c).toUpperCase(); return m; },{});
// móvil: subtopics — etiqueta opcional en los mensajes raíz → tira de pestañas + filtro por ?topic=
const forumMobile = process.env.OASIS_MOBILE === '1';
const rootMsgs = Array.isArray(messagesData.messages) ? messagesData.messages : [];
const forumTopics = forumMobile ? [...new Set(rootMsgs.map(m => String(m.subtopic || '').trim()).filter(Boolean))] : [];
const activeTopic = forumMobile ? String(topic || '').trim() : '';
const shownMsgs = activeTopic ? rootMsgs.filter(m => String(m.subtopic || '').trim() === activeTopic) : rootMsgs;
const topicStrip = (forumMobile && forumTopics.length)
? div({ class: 'forum-topics' },
a({ class: activeTopic ? 'forum-topic-chip' : 'forum-topic-chip active', href: `/forum/${encodeURIComponent(forum.key)}` }, i18n.menuAll || 'All'),
...forumTopics.map(t => a({ class: t === activeTopic ? 'forum-topic-chip active' : 'forum-topic-chip', href: `/forum/${encodeURIComponent(forum.key)}?topic=${encodeURIComponent(t)}` }, t))
)
: null;
return template(forum.title,
section(
div({ class: 'tags-header' },
@ -317,23 +310,22 @@ exports.singleForumView = async (forum, messagesData, currentFilter, topic = '')
)
),
div({ class: 'forum-thread-container' },
topicStrip,
div({
class: 'forum-card forum-thread-header',
style: 'display:flex;align-items:flex-start;'
},
div({
class: 'root-vote-col',
style: 'width:60px;text-align:center;'
}, renderVotes(
div({ class: 'forum-card forum-thread-header' },
div({ class: 'root-vote-col' }, renderVotes(
forum.key,
messagesData.totalScore,
forum.key
)),
div({
class: 'forum-main-col',
style: 'flex:1;padding-left:10px;'
},
div({ class: 'forum-main-col' },
div({ class: 'card-header activity-card-header' },
renderContentActions(forum.key, null, {
author: forum.author,
favKind: 'forum',
isFavorite: forum.isFavorite,
spread: null,
reportTitle: forum.title
})
),
div({ class: 'forum-header-row' },
a({
class: 'forum-category',
@ -376,21 +368,15 @@ exports.singleForumView = async (forum, messagesData, currentFilter, topic = '')
innerHTML: sanitizeHtml(renderTextWithStyles(forum.text || ''))
}),
div({ class: 'forum-meta' },
span({ class: 'votes-count' },
span({ class: 'forum-positive-votes' },
`▲: ${messagesData.positiveVotes}`),
span({
class: 'votes-count',
style: 'margin-left:12px;'
}, `▼: ${messagesData.negativeVotes}`),
span({ class: 'forum-negative-votes' },
`▼: ${messagesData.negativeVotes}`),
span({ class: 'forum-participants' },
`${i18n.forumParticipants.toUpperCase()}: ${forum.participants?.length || 1}`),
span({ class: 'forum-messages' },
`${i18n.forumMessages.toUpperCase()}: ${messagesData.total}`)
),
(() => {
const btn = renderSpreadButton(forum.key);
return btn ? div({ class: 'card-spread-left' }, btn) : null;
})(),
div({ class: 'forum-footer' },
span({ class: 'date-link' },
`${moment(forum.createdAt).format('YYYY/MM/DD HH:mm:ss')} ${i18n.performed}`),
@ -398,31 +384,23 @@ exports.singleForumView = async (forum, messagesData, currentFilter, topic = '')
)
)
),
div({
class: 'new-message-wrapper',
style: 'margin-top:12px;'
},
div({ class: 'new-message-wrapper' },
form({
method: 'POST',
action: `/forum/${encodeURIComponent(forum.key)}/message`,
class: 'new-message-form'
},
forumMobile ? input({ type: 'text', name: 'subtopic', value: activeTopic, placeholder: 'Topic (optional)', class: 'forum-topic-input' }) : null,
textarea({
name: 'message',
rows: 4,
required: true,
placeholder: i18n.forumMessagePlaceholder,
style: 'width:100%;'
class: 'new-message-textarea'
}), br(),
button({
type: 'submit',
class: 'forum-send-btn',
style: 'margin-top:4px;'
}, i18n.forumSendButton)
button({ type: 'submit', class: 'forum-send-btn' }, i18n.forumSendButton)
)
),
...renderThread(shownMsgs, 0, forum.key)
...renderThread(messagesData.messages, 0, forum.key)
)
);
};