diff --git a/apps/cory/follow.json b/apps/cory/follow.json index 03e538bc..eaef11d6 100644 --- a/apps/cory/follow.json +++ b/apps/cory/follow.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&+LbIl429+UZeS9Nh8zO6n7pzRfWOfFF2K/Hg7Kq2HQo=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&3d9ABFgRwQvWsYbFv/rzimtnLDnVrWlGtdw7serFIGw=.sha256"}} \ No newline at end of file diff --git a/apps/cory/follow/app.js b/apps/cory/follow/app.js index 7e0db3f0..f3cfb7a9 100644 --- a/apps/cory/follow/app.js +++ b/apps/cory/follow/app.js @@ -150,7 +150,7 @@ async function main() { var whoami = await ssb.getIdentities(); var tree = ''; for (let id of whoami) { - await app.setDocument(`
building... ${id}`); + await app.setDocument(`
building... ${id}`); tree += await buildTree(db, id, '', 2); } await app.setDocument('
FOLLOWING:\n' + tree + ''); diff --git a/apps/cory/ssblit.json b/apps/cory/ssblit.json new file mode 100644 index 00000000..85bded97 --- /dev/null +++ b/apps/cory/ssblit.json @@ -0,0 +1 @@ +{"type":"tildefriends-app","files":{"app.js":"&Y01AAZJWUjOXzzcIPHTzeEWvgrBsBgcL34QcNdOtLpA=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&NQfp81Ve+FpMPRzPS1UcoXEkn7BW+yz/XArGQbLSmPg=.sha256","script.js":"&vnCSRIvjb0kS+QOmkJP+ISB6wJdXDp/lOn6FJn2esKk=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&ewIlLZNhaHm2dztxqj2Ft38WZkNPQxYfOGBrwTDUhds=.sha256","tf-app.js":"&HOqvQvHjzGv94YSqPQWVOr9fTNMVRZk+vO7Dd+/LcEA=.sha256","tf-message.js":"&E98rTMtN1Ok3gBVbe54uqv6P45wHoMicdA/+gHVP7BM=.sha256","tf-user.js":"&hsIveVMRVMRNJfrTN1hkVQgO4VdRurMATfV2EXnIk/0=.sha256","tf-utils.js":"&MPINm55jkpz2rrNbwsYl09PKGvbgL3nwgBy6CMQkSnw=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&oo0iWvT+c2rU91zWpBIfPePRzmU8qmSnVOm+QCQqG/I=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&htPMi2z6Bmgi3f9jCnECCDZRCHACnDRjOl1kgPm+W80=.sha256","tf-styles.js":"&BkvFkMpGyL0DYP6FISFKR4pe6ZBOp8t6tQEzWZ4IQYs=.sha256","tf-profile.js":"&OmDTn4Bhu6kV4PzJ0wfaExyuLOO/7bPmbRNHD5yp02w=.sha256"}} \ No newline at end of file diff --git a/apps/cory/ssblit/app.js b/apps/cory/ssblit/app.js new file mode 100644 index 00000000..39f77164 --- /dev/null +++ b/apps/cory/ssblit/app.js @@ -0,0 +1,56 @@ +import * as tfrpc from '/tfrpc.js'; + +let g_database; +let g_hash; + +tfrpc.register(async function localStorageGet(key) { + return app.localStorageGet(key); +}); +tfrpc.register(async function localStorageSet(key, value) { + return app.localStorageSet(key, value); +}); +tfrpc.register(async function databaseGet(key) { + return g_database ? g_database.get(key) : undefined; +}); +tfrpc.register(async function databaseSet(key, value) { + return g_database ? g_database.set(key, value) : undefined; +}); +tfrpc.register(async function getIdentities() { + return ssb.getIdentities(); +}); +tfrpc.register(async function query(sql, args) { + let result = []; + await ssb.sqlStream(sql, args, function callback(row) { + result.push(row); + }); + return result; +}); +tfrpc.register(async function appendMessage(id, message) { + return ssb.appendMessageWithIdentity(id, message); +}); +core.register('message', async function message_handler(message) { + if (message.event == 'hashChange') { + g_hash = message.hash; + await tfrpc.rpc.hashChanged(message.hash); + } +}); +tfrpc.register(function getHash(id, message) { + return g_hash; +}); +ssb.addEventListener('message', async function(id) { + await tfrpc.rpc.notifyNewMessage(id); +}); +tfrpc.register(async function store_blob(blob) { + if (Array.isArray(blob)) { + blob = Uint8Array.from(blob); + } + return await ssb.blobStore(blob); +}); + +async function main() { + if (typeof(database) !== 'undefined') { + g_database = await database('ssb'); + } + await app.setDocument(utf8Decode(await getFile('index.html'))); +} +main(); \ No newline at end of file diff --git a/apps/cory/ssblit/commonmark.min.js b/apps/cory/ssblit/commonmark.min.js new file mode 100644 index 00000000..3b37fec2 --- /dev/null +++ b/apps/cory/ssblit/commonmark.min.js @@ -0,0 +1 @@ +!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).commonmark={})}(this,function(e){"use strict";function i(e){switch(e._type){case"document":case"block_quote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"link":case"image":case"custom_inline":case"custom_block":return!0;default:return!1}}function r(e,r){this.current=e,this.entering=!0===r}function t(){var e=this.current,r=this.entering;if(null===e)return null;var t=i(e);return r&&t?e._firstChild?(this.current=e._firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e._next?(this.current=e._parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:r,node:e}}function n(e){return{current:e,root:e,entering:!0,next:t,resumeAt:r}}var b=function(e,r){this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=null,this._next=null,this._sourcepos=r,this._lastLineBlank=!1,this._lastLineChecked=!1,this._open=!0,this._string_content=null,this._literal=null,this._listData={},this._info=null,this._destination=null,this._title=null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=null,this._level=null,this._onEnter=null,this._onExit=null},a=b.prototype;Object.defineProperty(a,"isContainer",{get:function(){return i(this)}}),Object.defineProperty(a,"type",{get:function(){return this._type}}),Object.defineProperty(a,"firstChild",{get:function(){return this._firstChild}}),Object.defineProperty(a,"lastChild",{get:function(){return this._lastChild}}),Object.defineProperty(a,"next",{get:function(){return this._next}}),Object.defineProperty(a,"prev",{get:function(){return this._prev}}),Object.defineProperty(a,"parent",{get:function(){return this._parent}}),Object.defineProperty(a,"sourcepos",{get:function(){return this._sourcepos}}),Object.defineProperty(a,"literal",{get:function(){return this._literal},set:function(e){this._literal=e}}),Object.defineProperty(a,"destination",{get:function(){return this._destination},set:function(e){this._destination=e}}),Object.defineProperty(a,"title",{get:function(){return this._title},set:function(e){this._title=e}}),Object.defineProperty(a,"info",{get:function(){return this._info},set:function(e){this._info=e}}),Object.defineProperty(a,"level",{get:function(){return this._level},set:function(e){this._level=e}}),Object.defineProperty(a,"listType",{get:function(){return this._listData.type},set:function(e){this._listData.type=e}}),Object.defineProperty(a,"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.tight=e}}),Object.defineProperty(a,"listStart",{get:function(){return this._listData.start},set:function(e){this._listData.start=e}}),Object.defineProperty(a,"listDelimiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.delimiter=e}}),Object.defineProperty(a,"onEnter",{get:function(){return this._onEnter},set:function(e){this._onEnter=e}}),Object.defineProperty(a,"onExit",{get:function(){return this._onExit},set:function(e){this._onExit=e}}),b.prototype.appendChild=function(e){e.unlink(),(e._parent=this)._lastChild?(this._lastChild._next=e)._prev=this._lastChild:this._firstChild=e,this._lastChild=e},b.prototype.prependChild=function(e){e.unlink(),(e._parent=this)._firstChild?((this._firstChild._prev=e)._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=e)},b.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this._parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,this._prev=null},b.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,e._next&&(e._next._prev=e),((e._prev=this)._next=e)._parent=this._parent,e._next||(e._parent._lastChild=e)},b.prototype.insertBefore=function(e){e.unlink(),e._prev=this._prev,e._prev&&(e._prev._next=e),((e._next=this)._prev=e)._parent=this._parent,e._prev||(e._parent._firstChild=e)},b.prototype.walker=function(){return new n(this)};var c={};function u(e,r,t){var i,n,a,s,o,l="";for("string"!=typeof r&&(t=r,r=u.defaultChars),void 0===t&&(t=!0),o=function(e){var r,t,i=c[e];if(i)return i;for(i=c[e]=[],r=0;r<128;r++)t=String.fromCharCode(r),/^[0-9a-z]$/i.test(t)?i.push(t):i.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2));for(r=0;r
(\n prop: P,\n _obj: unknown\n): P => prop;\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter