From db376d3ac650b07c26907a075b56cd72f09cb871 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 14 Jun 2019 23:58:39 +0200 Subject: [PATCH] rename morpheus to brawl --- README.md | 4 ++-- doc/architecture.md | 2 +- package-lock.json | 2 +- package.json | 8 ++++---- src/main.js | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 38d8f907..09676d19 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# morpheusjs +# Brawl A javascript matrix client prototype, trying to minize RAM usage by offloading as much as possible to IndexedDB ## Status Syncing & storing rooms with state and timeline, with a minimal UI syncing room list and timeline on screen. Filling gaps supported, detecting overlapping events. The `[0/1]` in the gif below is the local event key, consisting of a fragment id and event index. No sending yet. Using Fractal here to update the room name and send messages: -![Rooms and timeline syncing on-screen, gaps filling](https://bwindels.github.io/morpheusjs/images/morpheus-gaps.gif) +![Rooms and timeline syncing on-screen, gaps filling](https://bwindels.github.io/brawl-chat/images/morpheus-gaps.gif) ## Features that this approach would be well suited for diff --git a/doc/architecture.md b/doc/architecture.md index 286113d5..e2550805 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -9,7 +9,7 @@ For this reason a `Room` processes a sync response in two phases: `persistSync` ## Timeline, fragments & event indices. -A room in matrix is a DAG (directed, acyclic graph) of events, also known as the timeline. Morpheus is only aware of fragments of this graph, and can be unaware how these fragments relate to each other until a common event is found while paginating a fragment. After doing an initial sync, you start with one fragment. When looking up an event with the `/context` endpoint (for fetching a replied to message, or navigating to a given event id, e.g. through a permalink), a new, unconnected, fragment is created. Also, when receiving a limited sync response during incremental sync, a new fragment is created. Here, the relationship is clear, so they are immediately linked up at creation. Events in morpheus are identified within a room by `[fragment_id, event_index]`. The `event_index` is an unique number within a fragment to sort events in chronological order in the timeline. `fragment_id` cannot be directly compared for sorting (as the relationship may be unknown), but with help of the `FragmentIndex`, one can attempt to sort events by their `FragmentIndex([fragment_id, event_index])`. +A room in matrix is a DAG (directed, acyclic graph) of events, also known as the timeline. brawl is only aware of fragments of this graph, and can be unaware how these fragments relate to each other until a common event is found while paginating a fragment. After doing an initial sync, you start with one fragment. When looking up an event with the `/context` endpoint (for fetching a replied to message, or navigating to a given event id, e.g. through a permalink), a new, unconnected, fragment is created. Also, when receiving a limited sync response during incremental sync, a new fragment is created. Here, the relationship is clear, so they are immediately linked up at creation. Events in brawl are identified within a room by `[fragment_id, event_index]`. The `event_index` is an unique number within a fragment to sort events in chronological order in the timeline. `fragment_id` cannot be directly compared for sorting (as the relationship may be unknown), but with help of the `FragmentIndex`, one can attempt to sort events by their `FragmentIndex([fragment_id, event_index])`. A fragment is the following data structure: ``` diff --git a/package-lock.json b/package-lock.json index 56f65bc8..631c70f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "morpheusjs", + "name": "brawl-chat", "version": "1.0.0", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index 6ae62e9c..f0a8ab93 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "morpheusjs", + "name": "brawl-chat", "version": "1.0.0", "description": "A javascript matrix client prototype, trying to minize RAM usage by offloading as much as possible to IndexedDB", "main": "index.js", @@ -12,14 +12,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/bwindels/morpheusjs.git" + "url": "git+https://github.com/bwindels/brawl-chat.git" }, "author": "", "license": "ISC", "bugs": { - "url": "https://github.com/bwindels/morpheusjs/issues" + "url": "https://github.com/bwindels/brawl-chat/issues" }, - "homepage": "https://github.com/bwindels/morpheusjs#readme", + "homepage": "https://github.com/bwindels/brawl-chat#readme", "devDependencies": { "finalhandler": "^1.1.1", "impunity": "^0.0.7", diff --git a/src/main.js b/src/main.js index f0787673..6ecef32c 100644 --- a/src/main.js +++ b/src/main.js @@ -12,7 +12,7 @@ const USER_ID = `@${USERNAME}:${HOST}`; const PASSWORD = "testtest"; function getSessionInfo(userId) { - const sessionsJson = localStorage.getItem("morpheus_sessions_v1"); + const sessionsJson = localStorage.getItem("brawl_sessions_v1"); if (sessionsJson) { const sessions = JSON.parse(sessionsJson); const session = sessions.find(session => session.userId === userId); @@ -23,7 +23,7 @@ function getSessionInfo(userId) { } function storeSessionInfo(loginData) { - const sessionsJson = localStorage.getItem("morpheus_sessions_v1"); + const sessionsJson = localStorage.getItem("brawl_sessions_v1"); const sessions = sessionsJson ? JSON.parse(sessionsJson) : []; const sessionId = (Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)).toString(); const sessionInfo = { @@ -34,7 +34,7 @@ function storeSessionInfo(loginData) { accessToken: loginData.access_token, }; sessions.push(sessionInfo); - localStorage.setItem("morpheus_sessions_v1", JSON.stringify(sessions)); + localStorage.setItem("brawl_sessions_v1", JSON.stringify(sessions)); return sessionInfo; } @@ -58,7 +58,7 @@ export default async function main(label, button, container) { if (!sessionInfo) { sessionInfo = await login(USERNAME, PASSWORD, HOMESERVER); } - const storage = await createIdbStorage(`morpheus_session_${sessionInfo.id}`); + const storage = await createIdbStorage(`brawl_session_${sessionInfo.id}`); const hsApi = new HomeServerApi(HOMESERVER, sessionInfo.accessToken); const session = new Session({storage, hsApi, sessionInfo: { deviceId: sessionInfo.deviceId,