Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"format": "eslint . --fix --max-warnings 0 ."
},
"dependencies": {
"@codemirror/language": "^6.10.3",
"@codemirror/language": "^6.10.6",
"@codemirror/legacy-modes": "^6.4.2",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.34.3",
"@codemirror/state": "^6.5.0",
"@codemirror/view": "^6.35.3",
"@material/web": "^2.2.0",
"@milkdown/core": "^7.5.0",
"@milkdown/ctx": "^7.5.0",
Expand Down Expand Up @@ -57,16 +57,16 @@
"@suid/material": "^0.16.0",
"@syncedstore/core": "^0.6.0",
"@tailwindcss/typography": "^0.5.15",
"@tiptap/core": "^2.9.1",
"@tiptap/extension-collaboration": "^2.9.1",
"@tiptap/extension-collaboration-cursor": "^2.9.1",
"@tiptap/extension-color": "^2.9.1",
"@tiptap/extension-highlight": "^2.9.1",
"@tiptap/extension-link": "^2.9.1",
"@tiptap/extension-text-style": "^2.9.1",
"@tiptap/pm": "^2.9.1",
"@tiptap/starter-kit": "^2.9.1",
"@ucla-irl/ndnts-aux": "^4.0.1",
"@tiptap/core": "^2.10.3",
"@tiptap/extension-collaboration": "^2.10.3",
"@tiptap/extension-collaboration-cursor": "^2.10.3",
"@tiptap/extension-color": "^2.10.3",
"@tiptap/extension-highlight": "^2.10.3",
"@tiptap/extension-link": "^2.10.3",
"@tiptap/extension-text-style": "^2.10.3",
"@tiptap/pm": "^2.10.3",
"@tiptap/starter-kit": "^2.10.3",
"@ucla-irl/ndnts-aux": "file:../ndnts-aux/dist",
"autoprefixer": "^10.4.20",
"codemirror": "^6.0.1",
"diff": "^5.2.0",
Expand All @@ -79,16 +79,16 @@
"postcss": "^8.4.49",
"qr-scanner": "^1.4.2",
"qrcode": "^1.5.4",
"remark-gfm": "3.0.1",
"remark-gfm": "^4.0.0",
"solid-codemirror": "^2.3.1",
"solid-js": "^1.9.3",
"solid-markdown": "^2.0.13",
"solid-markdown": "^2.0.14",
"solid-tiptap": "^0.7.0",
"solid-toast": "^0.5.0",
"tailwindcss": "^3.4.15",
"tailwindcss": "^3.4.16",
"uuid": "^10.0.0",
"y-codemirror.next": "^0.3.5",
"y-prosemirror": "^1.2.12",
"y-prosemirror": "^1.2.15",
"y-protocols": "^1.0.6",
"yjs": "^13.6.20"
},
Expand All @@ -99,21 +99,21 @@
"@types/uuid": "^10.0.0",
"@types/web-bluetooth": "^0.0.20",
"@types/wicg-file-system-access": "^2023.10.5",
"@typescript-eslint/parser": "^8.14.0",
"@typescript-eslint/parser": "^8.18.0",
"eslint": "9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-solid": "^0.14.4",
"peer": "^1.0.2",
"prettier": "^3.3.3",
"sass": "^1.81.0",
"prettier": "^3.4.2",
"sass": "^1.82.0",
"solid-devtools": "^0.30.1",
"typescript": "^5.6.3",
"typescript-eslint": "^8.14.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.0",
"typescript-event-target": "^1.1.1",
"vite": "^5.4.11",
"vite-plugin-pwa": "^0.20.5",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid": "^2.11.0",
"wait-your-turn": "^1.0.1",
"workbox-cacheable-response": "^7.3.0",
"workbox-core": "^7.3.0",
Expand Down
2,835 changes: 1,259 additions & 1,576 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build-meta.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"revision":"v1.3.6 21086d0","timestamp":1730446944}
{"revision":"v1.3.8 db85bc3","timestamp":1733874127}
10 changes: 5 additions & 5 deletions src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export async function stopWorkspace() {
}

async function checkPrefixRegistration(cancel: boolean): Promise<boolean> {
if (!connection?.face?.running || !workspace) {
if (!connection?.face?.running || !workspace || nodeId === undefined || appPrefix === undefined) {
return false
}

Expand All @@ -317,7 +317,7 @@ async function checkPrefixRegistration(cancel: boolean): Promise<boolean> {
await nfdmgmt.invoke(
'rib/unregister',
{
name: nodeId!,
name: nodeId,
origin: 65, // client
},
{
Expand All @@ -331,7 +331,7 @@ async function checkPrefixRegistration(cancel: boolean): Promise<boolean> {
await nfdmgmt.invoke(
'rib/unregister',
{
name: appPrefix!,
name: appPrefix,
origin: 65, // client
},
{
Expand Down Expand Up @@ -379,7 +379,7 @@ async function checkPrefixRegistration(cancel: boolean): Promise<boolean> {
let cr = await nfdmgmt.invoke(
'rib/register',
{
name: appPrefix!,
name: appPrefix,
origin: 65, // client
cost: 0,
flags: 0x02, // CAPTURE
Expand All @@ -397,7 +397,7 @@ async function checkPrefixRegistration(cancel: boolean): Promise<boolean> {
cr = await nfdmgmt.invoke(
'rib/register',
{
name: nodeId!,
name: nodeId,
origin: 65, // client
cost: 0,
flags: 0x02, // CAPTURE
Expand Down
4 changes: 2 additions & 2 deletions src/build-meta.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const REVISION = 'v1.3.6 21086d0'
export const REVISION = 'v1.3.8 db85bc3'
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision, prettier/prettier
export const TIMESTAMP = 1730446944
export const TIMESTAMP = 1733874127
9 changes: 5 additions & 4 deletions src/components/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export function Chat() {
const navigate = useNavigate()
const messages = createSyncedStoreSig(() => rootDoc()?.chats)
const data = () => messages()?.value
const username = () => syncAgent()?.nodeId.at(-1).text ?? ''
// TODO: This depends on the namespace design. Fix this.
const username = () => syncAgent()?.nodeId.at(-2).text ?? ''

const [messageTerm, setMessageTerm] = createSignal('')
const [container, setContainer] = createSignal<HTMLDivElement>()
Expand Down Expand Up @@ -93,16 +94,16 @@ export function Chat() {
/>
<div class={styles.App__msgContent}>
<h4
class={`${styles.App__msgHeader}
${isLocalUser(msg.value.sender) ? styles.App__backgroundLocal : styles.App__backgroundForeign}
class={`${styles.App__msgHeader}
${isLocalUser(msg.value.sender) ? styles.App__backgroundLocal : styles.App__backgroundForeign}
${isLocalUser(msg.value.sender) ? styles.App__borderLocal : styles.App__borderForeign}`}
>
{' '}
{msg.value.sender}
<span>{new Date(msg.value.timestamp).toDateString()}</span>
</h4>
<div
class={`${styles.App_msgContentSolid}
class={`${styles.App_msgContentSolid}
${isLocalUser(msg.value.sender) ? styles.App__borderLocal : styles.App__borderForeign}`}
>
<SolidMarkdown
Expand Down
6 changes: 4 additions & 2 deletions src/components/config/update-inspect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useNdnWorkspace } from '../../../Context'
import { getNamespace } from '@ucla-irl/ndnts-aux/sync-agent'
import { SequenceNum } from '@ndn/naming-convention2'
import { Decoder } from '@ndn/tlv'
import { Data } from '@ndn/packet'
import { Data, Name } from '@ndn/packet'
import { toHex } from '@ndn/util'

// TODO: Make it to utils
Expand All @@ -25,7 +25,9 @@ export default function UpdateInspect() {
const agent = syncAgent()
if (!agent) return
try {
const nodeId = agent.appPrefix.append(nodeIdStr())
// TODO: Support naming convention
const nodeIdComp = Name.from(nodeIdStr())
const nodeId = agent.appPrefix.append(...nodeIdComp.comps)
const seqNum = parseInt(seqStr())
const appPrefix = agent.appPrefix
const aloSyncPrefix = appPrefix.append(getNamespace().syncKeyword, getNamespace().atLeastOnceKeyword)
Expand Down
3 changes: 1 addition & 2 deletions src/components/config/workspace-state/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { StateVector } from '@ndn/svs'
export const reprStateVector = (sv?: StateVector): Record<string, number> => {
if (!sv) return {}
const ret = {} as Record<string, number>
let unknownNum = 0
for (const [id, seq] of sv) {
ret[id.get(-1)?.text ?? `Unknown-${++unknownNum}`] = seq
ret[`${id.get(-2)?.text}-${id.get(-1)?.text}`] = seq
}
return ret
}
Expand Down
48 changes: 2 additions & 46 deletions src/components/share-latex/share-latex/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import { useParams, useNavigate } from '@solidjs/router'
import { project } from '../../../backend/models'
import { createEffect, createSignal, onCleanup } from 'solid-js'
import { observeDeep } from '@syncedstore/core'
import { Interest, Name, digestSigning } from '@ndn/packet'
import { Name } from '@ndn/packet'
import { v4 as uuidv4 } from 'uuid'
import { useNdnWorkspace } from '../../../Context'
import { FileMapper } from '../../../backend/file-mapper'
import { createInterval } from '../../../utils'
import ShareLatexComponent from './component'
import { Encoder } from '@ndn/tlv'
import * as segObj from '@ndn/segmented-object'
import { consume } from '@ndn/endpoint'
import { PdfTeXEngine } from '../../../vendor/swiftlatex/PdfTeXEngine'
import { LatexEnginePath } from '../../../constants'
import { ViewValues } from '../types'
Expand All @@ -21,7 +18,7 @@ import toast from 'solid-toast'
export type ModalState = '' | 'rename' | 'create'

export default function ShareLatex(props: { rootUri: string }) {
const { rootDoc, syncAgent, booted, fw, yjsProvider } = useNdnWorkspace()!
const { rootDoc, syncAgent, booted, yjsProvider } = useNdnWorkspace()!
const navigate = useNavigate()
const params = useParams<{ itemId: string }>()
const itemId = () => params.itemId
Expand Down Expand Up @@ -291,47 +288,6 @@ export default function ShareLatex(props: { rootUri: string }) {
setPdfUrl(fileUrl)
}

// Preservec unused
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _onCompileRemote = async () => {
const agent = syncAgent()
if (!agent) {
return
}
const zip = await project.exportAsZip(async (name) => await agent.getBlob(name), rootDoc()!.latex)
const blobFile = await zip.generateAsync({ type: 'uint8array' })

// TODO: Disable the button when compiling is in progress
// TODO: Remove this temporary blob after finish (so is the object URL)
const reqName = await agent.publishBlob('zipToCompile', blobFile, undefined, false)
const reqNameEncoder = new Encoder()
reqName.encodeTo(reqNameEncoder)

const interest = new Interest(
'/ndn/workspace-compiler/request',
Interest.MustBeFresh,
Interest.Lifetime(60000),
reqNameEncoder.output,
)
await digestSigning.sign(interest)
const retWire = await consume(interest, { fw })
const retText = new TextDecoder().decode(retWire.content)
const result = JSON.parse(retText)

if (result.status === 'error') {
console.error('Request failed')
console.log(result.stdout)
console.log(result.stderr)
} else {
console.info('Request finished')
const reqId = result.id
const pdfContent = await segObj.fetch(`/ndn/workspace-compiler/result/${reqId}`)
const file = new Blob([pdfContent], { type: 'application/pdf;base64' })
const fileUrl = URL.createObjectURL(file)
window.open(fileUrl)
}
}

const onMapFolder = async () => {
if (mapper() !== undefined) {
console.error('Already mapped')
Expand Down
11 changes: 5 additions & 6 deletions src/components/workspace/convert-testbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as ndncert from '@ndn/ndncert'
import * as keychain from '@ndn/keychain'
import { useNavigate } from '@solidjs/router'
import { useNdnWorkspace } from '../../Context'
import { AltUri } from '@ndn/naming-convention2'
import { AltUri, Timestamp } from '@ndn/naming-convention2'
import { ValidityPeriod } from '@ndn/packet'
import toast from 'solid-toast'

Expand Down Expand Up @@ -46,12 +46,12 @@ export default function ConvertTestbed() {
return
}

// New identity name (node id)
// New identity name (node id + timestamp as demuxer)
// add a random number to prevent reusing the same identity over multiple devices
const appPrefix = workspaceAnchorName.getPrefix(workspaceAnchorName.length - 5)
const testbedName = pofp.name.at(pofp.name.length - 5).text
const username = testbedName + '-' + Math.floor(Math.random() * 256).toString()
const nodeId = appPrefix.append(username)
const testbedName = pofp.name.at(pofp.name.length - 5)
const usernameTimestamp = Timestamp.create(Date.now())
const nodeId = appPrefix.append(testbedName).append(usernameTimestamp)

// Generate key pair
const keyName = keychain.CertNaming.makeKeyName(nodeId)
Expand All @@ -74,7 +74,6 @@ export default function ConvertTestbed() {

try {
await bootstrapWorkspace({
// createNew: init,
trustAnchor: caProfile.cert,
ownCertificate: cert,
prvKey: new Uint8Array(prvKeyBits),
Expand Down
Loading