Loading files
f826f6f19This file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/stack-chan-374381865.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
import { MAX_PROJECT_JSON_BYTES, parseVisualProject } from './project-format.mjs'
export function projectUrlFromSearch(search, pageUrl) {
const value = new URLSearchParams(String(search ?? '')).get('project')
if (!value) return null
const base = new URL(pageUrl)
const projectUrl = new URL(value, base)
if (projectUrl.origin !== base.origin) throw new TypeError('別のサイトにあるプロジェクトは開けません')
if (!projectUrl.pathname.endsWith('.stackchan-blocks.json')) {
throw new TypeError('ブロックプロジェクトのURLではありません')
}
return projectUrl
}
export async function fetchExternalProject(projectUrl, fetcher = globalThis.fetch) {
const response = await fetcher(projectUrl)
if (!response.ok) throw new Error(`プロジェクトを取得できませんでした (${response.status})`)
const declaredSize = Number(response.headers?.get?.('content-length'))
if (Number.isFinite(declaredSize) && declaredSize > MAX_PROJECT_JSON_BYTES) {
throw new TypeError(`プロジェクトが上限 ${MAX_PROJECT_JSON_BYTES} バイトを超えています`)
}
return parseVisualProject(await response.text())
}
f826f6f19This file is pinned to the selected release. Download the original to open it in your design tool.