Files
wekan/models/lib/sandstormShare.js
T
Lauri Ojansivu ca2dc5fae5 Sandstorm: build from install.sandstorm.org, and link sandstorm.org everywhere.
v12.69's build-sandstorm in release-all.yml stopped because the
certificate of install.sandstorm.io had expired. It fetches the installer
from install.sandstorm.org, as sandstorm.yml and sandstorm-store.yml
already did, and so does releases/install-sandstorm.sh. That installer
downloads Sandstorm from dl.sandstorm.org and configures a development
server at local.sandstorm.org, so the docs follow: docs, apps, dl, install
and local.sandstorm.io links and addresses become sandstorm.org in the docs,
SECURITY.md, code comments and the accounts-sandstorm README, each URL
checked to answer there. demo.sandstorm.io stays, as it has no sandstorm.org
name; released CHANGELOG sections are records and stay as they are. The
release audit's baseline allows the two code comments' docs.sandstorm.org.

tests/sandstormOrgHosts.test.cjs: every Sandstorm build installs from
install.sandstorm.org, and no tracked file names a sandstorm.io host
outside those kept on purpose; it fails on the old release-all.yml.

Thanks to xet7 !
2026-10-30 00:27:54 +02:00

27 lines
1.1 KiB
JavaScript

'use strict';
// #1188: on Sandstorm, a WeKan address is the inside of a grain - nobody can
// open it on its own, and a grain's own URL only reaches people it is shared
// with. So Copy card URL asks the Sandstorm shell to share the card instead:
// a { startSharing: { pathname } } message opens Sandstorm's Share Access
// dialog, whose sharing link opens the grain at that card
// (https://docs.sandstorm.org/en/latest/developing/path/#helping-the-user-share-access).
// The shell requires the path to start with "/" and accepts only
// { pathname, hash } (sandstorm shell grain-client.js). Pure:
// tests/sandstormShare.test.cjs.
function sandstormSharePath(url) {
let u;
try { u = new URL(String(url || ''), 'http://grain.invalid'); } catch (e) { return null; }
const pathname = u.pathname;
if (!pathname || pathname.charAt(0) !== '/' || pathname.includes('/../') || pathname.endsWith('/..')) return null;
return pathname;
}
function startSharingMessage(url) {
const pathname = sandstormSharePath(url);
return pathname ? { startSharing: { pathname } } : null;
}
module.exports = { sandstormSharePath, startSharingMessage };