A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
|
|
|
export default defineEventHandler(async event => {
|
|
|
|
|
const user = await requireUser(event)
|
|
|
|
|
const id = getRouterParam(event, 'id')
|
|
|
|
|
if (!isProjectId(id)) throw createError({ statusCode: 404, message: 'Project not found' })
|
|
|
|
|
return withLock(user.id, async () => {
|
|
|
|
|
const index = await readIndex(user.id)
|
2026-10-20 11:20:55 +00:00
|
|
|
// The last state goes to the trash (kept as a version for 30 days).
|
|
|
|
|
const meta = index.projects.find(p => p.id === id)
|
|
|
|
|
const last = meta && (await readProject(user.id, id))
|
|
|
|
|
if (meta && last) await keepVersion(user.id, id, { project: last, rev: meta.rev, at: meta.updated, name: meta.name }, true)
|
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
|
|
|
index.projects = index.projects.filter(p => p.id !== id)
|
|
|
|
|
// Remember the deletion for a year, so other devices drop their copy too.
|
|
|
|
|
const yearAgo = Date.now() - 365 * 86_400_000
|
|
|
|
|
index.deleted = [{ id, at: Date.now() }, ...index.deleted.filter(d => d.id !== id && d.at > yearAgo)].slice(0, 2000)
|
|
|
|
|
await accounts().removeItem(projectKey(user.id, id))
|
|
|
|
|
await writeIndex(user.id, index)
|
2026-10-20 11:20:55 +00:00
|
|
|
await emptyOldTrash(user.id, index)
|
A settings for every part, overlap-free wiring with crossing styles, accounts with sync
- Clicking anything opens its settings: swap parts in place (wires stay on
matching pins), clock frequency per clock, keyboard keys for switches and
buttons, lamp/display colours, note sizes, component names on the canvas,
position, unlink all wires, unpack a component, make an independent copy.
- Wires of different signals never share a line: auto routes pick free
columns or detours, remaining clashes go on separate lanes. Crossings drawn
as bow, triangle, bridge, gap or plain.
- Accounts (email + scrypt password, httpOnly session) with two-way project
sync and conflict copies; per-account limits; cross-site writes refused.
- Compatibility suite: a project and both browser-storage layouts from
release a241adc must load and compute identically.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-20 11:09:37 +00:00
|
|
|
return { ok: true }
|
|
|
|
|
})
|
|
|
|
|
})
|