From f9ffbb4989fe697af554ba8d4fca779114687b7b Mon Sep 17 00:00:00 2001 From: Luk Date: Wed, 24 Sep 2025 11:46:52 +0800 Subject: [PATCH] u --- tool_core.js | 6 ++++-- tool_uniapp.js | 16 ++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tool_core.js b/tool_core.js index d2f6598..1723384 100644 --- a/tool_core.js +++ b/tool_core.js @@ -363,7 +363,7 @@ module.exports = { summarize_story (story = []) { // story is an array of objects, each object could either be {text:'some string'}, {image: url} or {video:url}. Please construct a summary object as result: { textLength, imageCount, VideoCount } return story.reduce( - (summary, { text, image, video, audio, file, linkTarget } = {}) => { + (summary, { text, image, video, audio, file, linkTarget, _autocontent } = {}) => { if (text) { summary.textLength += text.length summary.wordCount += text.split(/\s+/).length @@ -377,12 +377,14 @@ module.exports = { summary.fileCount++ } else if (linkTarget) { summary.linkCount++ + } else if (_autocontent) { + summary.emptyContent++ } else { summary.untypeCount++ } return summary }, - { textLength: 0, wordCount: 0, imageCount: 0, videoCount: 0, audioCount: 0, fileCount: 0, linkCount: 0, untypeCount: 0 } + { textLength: 0, wordCount: 0, imageCount: 0, videoCount: 0, audioCount: 0, fileCount: 0, linkCount: 0, emptyContent: 0, untypeCount: 0 } ) }, diff --git a/tool_uniapp.js b/tool_uniapp.js index c23f47b..4660417 100644 --- a/tool_uniapp.js +++ b/tool_uniapp.js @@ -146,7 +146,7 @@ module.exports = { } }, - make_server_url (route, envar = globalThis.wo?.envar || {}) { + make_server_url (route, { envar = globalThis.wo?.envar, fullUrl = false } = {}) { if (typeof route === 'string') route = route.replace('\\', '/') else if (route?.apiWho && route?.apiTodo) { const { apiVersion = 'api', apiWho, apiTodo } = route @@ -163,22 +163,26 @@ module.exports = { if (/^\/static\//.test(route)) { return route } + route = route.replace(/^\//, '') + // 对 route='abc.com' 这种,应当有 fullUrl===true,就直接使用,而不是组装成 pexserver.tic.cc/abc.com // 纯数字和字母的cid - if (/^[\da-zA-Z]+$/.test(route) && envar.ipfsLens) { - return `${envar.ipfsLens.replace(/\/$/, '')}/${route.replace(/^\//, '')}` + if (/^[0-9a-zA-Z]+$/.test(route) && envar?.ipfsLens) { + return `${envar.ipfsLens.replace(/\/$/, '')}/${route}` } //// base url / 后台服务器url 需要组装。包括了 route === '_filestore/xxx' 的情况 - route = route.replace(/^\//, '') // 已有现成后端服务域名 - if (envar.servUrl) { + if (fullUrl) { + return `http://${route}` + } else if (envar?.servUrl) { return `${envar.servUrl.replace(/\/$/, '')}/${route}` - } else { + } else if (envar?.servHostname) { // 需要组装后端服务域名 const hostname = envar.servHostname /*|| globalThis.window?.location?.hostname*/ || 'localhost' const port = envar.servPort /*|| globalThis.window?.location?.port*/ || '' const protocol = hostname === 'localhost' ? 'http' : envar.servProtocol || (process.env.NODE_ENV === 'production' ? 'https' : 'http') return `${protocol}://${hostname}${port ? ':' : ''}${port}/${route}` } + return route }, make_bgurl (image) {