a proof of concept realtime collaborative text editor using atproto as a sync server jake.tngl.io/y-pds/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Deploy to tangled sites

+11 -11
+3 -3
callback.html
··· 17 17 const params = new URLSearchParams(location.hash.slice(1)); 18 18 19 19 finalizeAuthorization(params) 20 - .then((agent) => { 20 + .then(agent => { 21 21 localStorage.setItem("ypds:did", agent.session.info.sub); 22 - window.location.assign("/"); 22 + window.location.assign("/y-pds/"); 23 23 }) 24 - .catch((err) => console.error(err)); 24 + .catch(err => console.error(err)); 25 25 </script>
+4 -4
client-metadata.json
··· 1 1 { 2 - "client_id": "https://ff10-66-108-106-210.ngrok-free.app/client-metadata.json", 3 - "client_uri": "https://ff10-66-108-106-210.ngrok-free.app", 4 - "redirect_uris": ["https://ff10-66-108-106-210.ngrok-free.app/callback.html"], 2 + "client_id": "https://jake.tngl.io/y-pds/client-metadata.json", 3 + "client_uri": "https://jake.tngl.io/y-pds", 4 + "redirect_uris": ["https://jake.tngl.io/y-pds/callback.html"], 5 5 "application_type": "native", 6 6 "client_name": "atrtc demo", 7 7 "dpop_bound_access_tokens": true, 8 8 "grant_types": ["authorization_code", "refresh_token"], 9 9 "response_types": ["code"], 10 - "scope": "atproto repo?collection=com.jakelazaroff.ypds.doc&collection=com.jakelazaroff.ypds.update&collection=com.jakelazaroff.ypds.awareness&collection=com.jakelazaroff.ypds.snapshot", 10 + "scope": "atproto repo?collection=jake.tngl.io.ypds.doc&collection=jake.tngl.io.ypds.update&collection=jake.tngl.io.ypds.awareness&collection=jake.tngl.io.ypds.snapshot", 11 11 "token_endpoint_auth_method": "none" 12 12 }
+1 -1
index.html
··· 25 25 } 26 26 } 27 27 </script> 28 - <link rel="stylesheet" href="/style.css" /> 28 + <link rel="stylesheet" href="./style.css" /> 29 29 </head> 30 30 <body> 31 31 <div id="app"></div>
+3 -3
y-pds.js
··· 2 2 import * as Y from "yjs"; 3 3 import { Awareness, encodeAwarenessUpdate, applyAwarenessUpdate } from "y-protocols/awareness"; 4 4 5 - export const DOC_COLLECTION = "com.jakelazaroff.ypds.doc"; 6 - export const UPDATE_COLLECTION = "com.jakelazaroff.ypds.update"; 7 - export const AWARENESS_COLLECTION = "com.jakelazaroff.ypds.awareness"; 5 + export const DOC_COLLECTION = "jake.tngl.io.ypds.doc"; 6 + export const UPDATE_COLLECTION = "jake.tngl.io.ypds.update"; 7 + export const AWARENESS_COLLECTION = "jake.tngl.io.ypds.awareness"; 8 8 9 9 const encode = (/** @type {Uint8Array} */ update) => btoa(String.fromCharCode(...update)); 10 10 const decode = (/** @type {string} */ b64) => Uint8Array.from(atob(b64), c => c.charCodeAt(0));