reorganize project structure (#366)

This commit is contained in:
BlowaterNostr 2024-01-02 01:28:10 +08:00 committed by GitHub
parent b3e680ad95
commit 0d366c18b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
138 changed files with 1069 additions and 884 deletions

View File

@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
deno-version: [1.38.2] deno-version: [1.39.1]
steps: steps:
- name: Setup repo - name: Setup repo
@ -44,7 +44,7 @@ jobs:
run: make test run: make test
- name: UI test - name: UI test
run: cd UI && make compile-all-tests run: make compile-all-ui-tests
deploy: deploy:
timeout-minutes: 1 timeout-minutes: 1
@ -63,11 +63,11 @@ jobs:
uses: denoland/setup-deno@v1 uses: denoland/setup-deno@v1
- name: Bundle - name: Bundle
run: cd UI && make build-pwa run: make build
- name: Upload to Deno Deploy - name: Upload to Deno Deploy
uses: denoland/deployctl@v1 uses: denoland/deployctl@v1
with: with:
project: "blowater" project: "blowater"
entrypoint: https://raw.githubusercontent.com/denoland/deno_std/0.196.0/http/file_server.ts entrypoint: https://raw.githubusercontent.com/denoland/deno_std/0.196.0/http/file_server.ts
root: UI/build-pwa root: build-pwa

3
.gitignore vendored
View File

@ -4,6 +4,7 @@ test.ts
*.log *.log
# Bundle # Bundle
*.mjs *.mjs
main.js
cov_profile* cov_profile*
Elm Elm
DevOps/stats.sqlite DevOps/stats.sqlite
@ -12,3 +13,5 @@ DevOps/stats.sqlite
build-pwa build-pwa
build-extension build-extension
*.zip *.zip
# tauri
tauri-app/src-tauri/icons

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "lib/nostr-ts"] [submodule "libs/nostr.ts"]
path = lib/nostr-ts path = libs/nostr.ts
url = https://github.com/BlowaterNostr/nostr.ts url = https://github.com/BlowaterNostr/nostr.ts

View File

@ -1,6 +1,6 @@
import { DB } from "https://deno.land/x/sqlite@v3.7.2/mod.ts"; import { DB } from "https://deno.land/x/sqlite@v3.7.2/mod.ts";
import { NostrKind } from "../lib/nostr-ts/nostr.ts"; import { NostrKind } from "../libs/nostr.ts/nostr.ts";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts"; import { ConnectionPool } from "../libs/nostr.ts/relay-pool.ts";
// Open a database // Open a database
const db = new DB("stats.sqlite"); const db = new DB("stats.sqlite");

View File

@ -1,8 +0,0 @@
import { walk } from "https://deno.land/std@0.202.0/fs/walk.ts";
import { bundle } from "https://deno.land/x/emit@0.31.0/mod.ts";
for await (const entry of walk("./", { exts: [".test.tsx"] })) {
const url = new URL(entry.path, import.meta.url);
console.log("bundling", url.pathname);
await bundle(url);
}

View File

@ -1,25 +0,0 @@
# https://stackoverflow.com/questions/3931741/why-does-make-think-the-target-is-up-to-date
.PHONY: build-pwa build-extension
page=app
port=4507
test: fmt bundle
file_server ./deploy
bundle:
deno bundle --config=./deno.json $(page).test.tsx deploy/main.mjs
app: fmt build-pwa
file_server --port=$(port) ./build-pwa
compile-all-tests:
deno run --allow-read --allow-env --allow-write --allow-net _compile-ui-tests.ts
build-extension:
deno run --allow-read --allow-env --allow-write --allow-net _build-extension.ts
build-pwa:
deno run --allow-read --allow-env --allow-write --allow-net _build-pwa.ts
fmt:
deno fmt --options-indent-width 4 --options-line-width 110

View File

@ -1,76 +0,0 @@
/** @jsx h */
import { Fragment, h, render } from "https://esm.sh/preact@10.17.1";
import { NoteCard } from "./note-card.tsx";
import { prepareEncryptedNostrEvent, prepareNormalNostrEvent } from "../lib/nostr-ts/event.ts";
import { PrivateKey } from "../lib/nostr-ts/key.ts";
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { parseJSON } from "../features/profile.ts";
import { testEventBus, testEventsAdapter } from "./_setup.test.ts";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { originalEventToUnencryptedEvent, parseDM } from "../database.ts";
import { getTags } from "../nostr.ts";
const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
const socialEvent = await prepareNormalNostrEvent<NostrKind.TEXT_NOTE>(
ctx,
NostrKind.TEXT_NOTE,
[],
`Edge`,
);
const profileEvent = await prepareNormalNostrEvent(
ctx,
NostrKind.META_DATA,
[],
`{"name":"mike"}`,
);
const DMEvent = await prepareEncryptedNostrEvent(
ctx,
ctx.publicKey,
NostrKind.DIRECT_MESSAGE,
[
[
"p",
ctx.publicKey.hex,
],
],
"maybe we can finish it first",
);
if (DMEvent instanceof Error) fail(DMEvent.message);
const decryptDMEvent = await parseDM(
DMEvent,
ctx,
getTags(DMEvent),
ctx.publicKey,
testEventsAdapter,
);
if (decryptDMEvent instanceof Error) fail(decryptDMEvent.message);
if (decryptDMEvent == false) fail();
const parsedSocialEvent = originalEventToUnencryptedEvent(socialEvent, getTags(socialEvent), ctx.publicKey);
if (parsedSocialEvent instanceof Error) fail(parsedSocialEvent.message);
const profileData = parseJSON(profileEvent.content);
if (profileData instanceof Error) fail(profileData.message);
render(
<Fragment>
<NoteCard
profileData={profileData}
// @ts-ignore
event={parsedSocialEvent}
emit={testEventBus.emit}
/>
<NoteCard
profileData={profileData}
// @ts-ignore
event={decryptDMEvent}
emit={testEventBus.emit}
/>
</Fragment>,
document.body,
);
for await (const e of testEventBus.onChange()) {
console.log(e);
}

View File

@ -1,26 +0,0 @@
/** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1";
import { Search } from "./search.tsx";
import { testEventBus, testEventsAdapter } from "./_setup.test.ts";
import { Datebase_View } from "../database.ts";
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { PrivateKey } from "../lib/nostr-ts/key.ts";
import { prepareNormalNostrEvent } from "../lib/nostr-ts/event.ts";
const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
await testEventsAdapter.put(await prepareNormalNostrEvent(ctx, NostrKind.META_DATA, [], `{"name":"mike"}`));
const db = await Datebase_View.New(testEventsAdapter, ctx);
render(
<Search
placeholder="search for data"
emit={testEventBus.emit}
db={db}
/>,
document.body,
);
for await (const e of testEventBus.onChange()) {
console.log(e);
}

2
_build-common.ts Normal file
View File

@ -0,0 +1,2 @@
export const logo = "./deploy/logo.webp";
export const main_module = "./1_app/UI/_main.tsx";

View File

@ -1,5 +1,5 @@
import { bundle } from "https://deno.land/x/emit@0.31.0/mod.ts"; import { bundle } from "https://deno.land/x/emit@0.31.0/mod.ts";
import { logo } from "./_build-pwa.ts"; import { logo, main_module } from "./_build-common.ts";
const exists = async (filename: string): Promise<boolean> => { const exists = async (filename: string): Promise<boolean> => {
try { try {
@ -20,7 +20,7 @@ if (await exists(folderName)) {
} }
await Deno.mkdir(folderName); await Deno.mkdir(folderName);
const url = new URL("./_main.tsx", import.meta.url); const url = new URL(main_module, import.meta.url);
const res = await bundle(url); const res = await bundle(url);
await Deno.writeTextFile(`./${folderName}/main.mjs`, res.code); await Deno.writeTextFile(`./${folderName}/main.mjs`, res.code);
await Deno.copyFile("./deploy/alby-logo.svg", `./${folderName}/alby-logo.svg`); await Deno.copyFile("./deploy/alby-logo.svg", `./${folderName}/alby-logo.svg`);

View File

@ -1,4 +1,5 @@
import { bundle } from "https://deno.land/x/emit@0.31.0/mod.ts"; import { bundle } from "https://deno.land/x/emit@0.31.0/mod.ts";
import { logo, main_module } from "./_build-common.ts";
const exists = async (filename: string): Promise<boolean> => { const exists = async (filename: string): Promise<boolean> => {
try { try {
@ -18,10 +19,8 @@ if (await exists(folderName)) {
await Deno.remove(folderName, { recursive: true }); await Deno.remove(folderName, { recursive: true });
} }
export const logo = "./deploy/logo.webp";
await Deno.mkdir(folderName); await Deno.mkdir(folderName);
const url = new URL("./_main.tsx", import.meta.url); const url = new URL(main_module, import.meta.url);
const res = await bundle(url); const res = await bundle(url);
await Deno.writeTextFile(`./${folderName}/main.mjs`, res.code); await Deno.writeTextFile(`./${folderName}/main.mjs`, res.code);
await Deno.copyFile("./deploy/alby-logo.svg", `./${folderName}/alby-logo.svg`); await Deno.copyFile("./deploy/alby-logo.svg", `./${folderName}/alby-logo.svg`);

View File

@ -0,0 +1,7 @@
import { walk } from "https://deno.land/std@0.202.0/fs/walk.ts";
import * as emit from "https://deno.land/x/emit@0.32.0/mod.ts";
for await (const entry of walk("./", { exts: [".test.tsx"] })) {
console.log("compiling", entry.path);
await emit.transpile(entry.path);
}

View File

@ -2,8 +2,8 @@
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { setup } from "https://esm.sh/twind@0.16.16"; import { setup } from "https://esm.sh/twind@0.16.16";
import { NewIndexedDB } from "./dexie-db.ts"; import { NewIndexedDB } from "./dexie-db.ts";
import { Start } from "./app.tsx";
import { TWConfig } from "./tw.config.ts"; import { TWConfig } from "./tw.config.ts";
import { Start } from "./app.tsx";
setup(TWConfig); setup(TWConfig);

View File

@ -1,6 +1,6 @@
import { Datebase_View, EventMark, EventMarker, EventsAdapter, Indices, RelayRecorder } from "../database.ts"; import { Datebase_View, EventMark, EventMarker, EventsAdapter, Indices, RelayRecorder } from "../database.ts";
import { EventBus } from "../event-bus.ts"; import { EventBus } from "../event-bus.ts";
import { NostrEvent } from "../lib/nostr-ts/nostr.ts"; import { NostrEvent } from "../../libs/nostr.ts/nostr.ts";
import { UI_Interaction_Event } from "./app_update.tsx"; import { UI_Interaction_Event } from "./app_update.tsx";
export const testEventBus = new EventBus<UI_Interaction_Event>(); export const testEventBus = new EventBus<UI_Interaction_Event>();

View File

@ -1,10 +1,10 @@
/** @jsx h */ /** @jsx h */
import { h } from "https://esm.sh/preact@10.17.1"; import { h } from "https://esm.sh/preact@10.17.1";
import { DividerClass } from "./components/tw.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { LinkColor, PrimaryTextColor, SecondaryBackgroundColor } from "./style/colors.ts";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
import { DividerClass } from "./components/tw.ts";
import { SelectConversation } from "./search_model.ts"; import { SelectConversation } from "./search_model.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { LinkColor, PrimaryTextColor, SecondaryBackgroundColor } from "./style/colors.ts";
export function About(emit: emitFunc<SelectConversation>) { export function About(emit: emitFunc<SelectConversation>) {
return ( return (

View File

@ -1,12 +1,12 @@
import { chan, closed, sleep } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { chan, closed, sleep } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { PrivateKey, PublicKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey, PublicKey } from "../../libs/nostr.ts/key.ts";
import { import {
InMemoryAccountContext, InMemoryAccountContext,
NostrAccountContext, NostrAccountContext,
NostrEvent, NostrEvent,
NostrKind, NostrKind,
UnsignedNostrEvent, UnsignedNostrEvent,
} from "../lib/nostr-ts/nostr.ts"; } from "../../libs/nostr.ts/nostr.ts";
type NIP07 = { type NIP07 = {
getPublicKey(): Promise<string>; getPublicKey(): Promise<string>;

View File

@ -1,40 +1,38 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import * as dm from "../features/dm.ts";
import { DirectMessageContainer } from "./dm.tsx";
import { tw } from "https://esm.sh/twind@0.16.16"; import { tw } from "https://esm.sh/twind@0.16.16";
import { EditProfile } from "./edit-profile.tsx"; import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import * as nav from "./nav.tsx"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { EventBus } from "../event-bus.ts"; import { NostrAccountContext, NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { Setting } from "./setting.tsx"; import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { Datebase_View } from "../database.ts"; import { Datebase_View } from "../database.ts";
import { DM_List } from "./conversation-list.ts"; import { EventBus } from "../event-bus.ts";
import { new_DM_EditorModel } from "./editor.tsx"; import { DirectedMessageController, getAllEncryptedMessagesOf, InvalidEvent } from "../features/dm.ts";
import { group_GM_events, GroupChatSyncer, GroupMessageController } from "../features/gm.ts";
import { ProfileSyncer } from "../features/profile.ts";
import { About } from "./about.tsx";
import { initialModel, Model } from "./app_model.ts"; import { initialModel, Model } from "./app_model.ts";
import { AppEventBus, Database_Update, UI_Interaction_Event, UI_Interaction_Update } from "./app_update.tsx"; import { AppEventBus, Database_Update, UI_Interaction_Event, UI_Interaction_Update } from "./app_update.tsx";
import * as time from "../time.ts"; import { Popover, PopOverInputChannel } from "./components/popover.tsx";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { OtherConfig } from "./config-other.ts";
import { NostrAccountContext, NostrEvent, NostrKind } from "../lib/nostr-ts/nostr.ts"; import { DM_List } from "./conversation-list.ts";
import { getCurrentSignInCtx, setSignInState, SignIn } from "./signIn.tsx"; import { DexieDatabase } from "./dexie-db.ts";
import { SecondaryBackgroundColor } from "./style/colors.ts"; import { DirectMessageContainer } from "./dm.tsx";
import { EditProfile } from "./edit-profile.tsx";
import { new_DM_EditorModel } from "./editor.tsx";
import { EventSyncer } from "./event_syncer.ts"; import { EventSyncer } from "./event_syncer.ts";
import { RelayConfig } from "./relay-config.ts"; import { RelayConfig } from "./relay-config.ts";
import { DexieDatabase } from "./dexie-db.ts";
import { About } from "./about.tsx";
import { ProfileSyncer } from "../features/profile.ts";
import { Popover, PopOverInputChannel } from "./components/popover.tsx";
import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { group_GM_events, GroupChatSyncer, GroupMessageController } from "../features/gm.ts";
import { OtherConfig } from "./config-other.ts";
import { ProfileGetter } from "./search.tsx"; import { ProfileGetter } from "./search.tsx";
import { DirectedMessageController, InvalidEvent } from "../features/dm.ts"; import { Setting } from "./setting.tsx";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts"; import { getCurrentSignInCtx, setSignInState, SignIn } from "./signIn.tsx";
import { SecondaryBackgroundColor } from "./style/colors.ts";
import { LamportTime } from "../time.ts"; import { LamportTime } from "../time.ts";
import { InstallPrompt, NavBar } from "./nav.tsx";
export async function Start(database: DexieDatabase) { export async function Start(database: DexieDatabase) {
console.log("Start the application"); console.log("Start the application");
const installPrompt: nav.InstallPrompt = { const installPrompt: InstallPrompt = {
event: undefined, event: undefined,
}; };
window.addEventListener("beforeinstallprompt", async (event) => { window.addEventListener("beforeinstallprompt", async (event) => {
@ -131,7 +129,7 @@ export class App {
public readonly conversationLists: DM_List, public readonly conversationLists: DM_List,
public readonly relayConfig: RelayConfig, public readonly relayConfig: RelayConfig,
public readonly groupChatController: GroupMessageController, public readonly groupChatController: GroupMessageController,
public readonly lamport: time.LamportTime, public readonly lamport: LamportTime,
public readonly dmController: DirectedMessageController, public readonly dmController: DirectedMessageController,
) {} ) {}
@ -144,7 +142,7 @@ export class App {
popOverInputChan: PopOverInputChannel; popOverInputChan: PopOverInputChannel;
otherConfig: OtherConfig; otherConfig: OtherConfig;
lamport: LamportTime; lamport: LamportTime;
installPrompt: nav.InstallPrompt; installPrompt: InstallPrompt;
}) { }) {
args.lamport.fromEvents(args.database.getAllEvents()); args.lamport.fromEvents(args.database.getAllEvents());
const eventSyncer = new EventSyncer(args.pool, args.database); const eventSyncer = new EventSyncer(args.pool, args.database);
@ -238,7 +236,7 @@ export class App {
return app; return app;
} }
private initApp = async (installPrompt: nav.InstallPrompt) => { private initApp = async (installPrompt: InstallPrompt) => {
console.log("App.initApp"); console.log("App.initApp");
// configurations: pin list // configurations: pin list
@ -308,7 +306,7 @@ export class App {
ctx: NostrAccountContext, ctx: NostrAccountContext,
pool: ConnectionPool, pool: ConnectionPool,
) { ) {
const messageStream = dm.getAllEncryptedMessagesOf( const messageStream = getAllEncryptedMessagesOf(
ctx.publicKey, ctx.publicKey,
pool, pool,
); );
@ -396,7 +394,7 @@ export function AppComponent(props: {
eventBus: AppEventBus; eventBus: AppEventBus;
pool: ConnectionPool; pool: ConnectionPool;
popOverInputChan: PopOverInputChannel; popOverInputChan: PopOverInputChannel;
installPrompt: nav.InstallPrompt; installPrompt: InstallPrompt;
}) { }) {
const t = Date.now(); const t = Date.now();
const model = props.model; const model = props.model;
@ -446,7 +444,7 @@ export function AppComponent(props: {
const final = ( const final = (
<div class={tw`h-screen w-full flex`}> <div class={tw`h-screen w-full flex`}>
<nav.NavBar <NavBar
publicKey={app.ctx.publicKey} publicKey={app.ctx.publicKey}
profileGetter={app.database} profileGetter={app.database}
emit={app.eventBus.emit} emit={app.eventBus.emit}

View File

@ -1,10 +1,10 @@
import { NavigationModel } from "./nav.tsx"; import { NavigationModel } from "./nav.tsx";
import { SearchInitModel, SearchModel } from "./search_model.ts"; import { SearchInitModel, SearchModel } from "./search_model.ts";
import { ProfileData } from "../features/profile.ts"; import { ProfileData } from "../features/profile.ts";
import { App } from "./app.tsx";
import { EditorModel } from "./editor.tsx"; import { EditorModel } from "./editor.tsx";
import { DM_Model } from "./dm.tsx"; import { DM_Model } from "./dm.tsx";
import { RightPanelModel } from "./right-panel.tsx"; import { RightPanelModel } from "./right-panel.tsx";
import { App } from "./app.tsx";
export type Model = { export type Model = {
app: App | undefined; // app is only available after sign-in app: App | undefined; // app is only available after sign-in

View File

@ -1,24 +1,16 @@
/** @jsx h */ /** @jsx h */
import { h } from "https://esm.sh/preact@10.17.1"; import { h } from "https://esm.sh/preact@10.17.1";
import { ProfileSyncer, saveProfile } from "../features/profile.ts"; import { Channel, closed, sleep } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { prepareEncryptedNostrEvent, prepareNormalNostrEvent } from "../../libs/nostr.ts/event.ts";
import { App } from "./app.tsx"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { DM_List } from "./conversation-list.ts"; import { NoteID } from "../../libs/nostr.ts/nip19.ts";
import { NostrAccountContext, NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import * as csp from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { Datebase_View } from "../database.ts"; import { Datebase_View } from "../database.ts";
import { DirectedMessageController, sendDMandImages } from "../features/dm.ts";
import { notify } from "./notification.ts";
import { emitFunc, EventBus } from "../event-bus.ts"; import { emitFunc, EventBus } from "../event-bus.ts";
import { ContactUpdate } from "./conversation-list.tsx"; import { DirectedMessageController, sendDMandImages } from "../features/dm.ts";
import { EditorEvent, EditorModel, new_DM_EditorModel, SendMessage } from "./editor.tsx"; import { GroupMessageController } from "../features/gm.ts";
import { DirectMessagePanelUpdate } from "./message-panel.tsx"; import { ProfileSyncer, saveProfile } from "../features/profile.ts";
import { InstallPrompt, NavigationUpdate } from "./nav.tsx";
import { Model } from "./app_model.ts";
import { SearchUpdate, SelectConversation } from "./search_model.ts";
import { LamportTime } from "../time.ts";
import { SignInEvent } from "./signIn.tsx";
import { import {
Encrypted_Event, Encrypted_Event,
getTags, getTags,
@ -27,25 +19,29 @@ import {
Profile_Nostr_Event, Profile_Nostr_Event,
UnpinConversation, UnpinConversation,
} from "../nostr.ts"; } from "../nostr.ts";
import { StartInvite } from "./dm.tsx"; import { LamportTime } from "../time.ts";
import { RelayConfigChange, ViewRelayDetail } from "./setting.tsx"; import { App } from "./app.tsx";
import { Model } from "./app_model.ts";
import { PopOverInputChannel } from "./components/popover.tsx"; import { PopOverInputChannel } from "./components/popover.tsx";
import { Search } from "./search.tsx";
import { NoteID } from "../lib/nostr-ts/nip19.ts";
import { EventDetail, EventDetailItem } from "./event-detail.tsx";
import { CreateGroup, CreateGroupChat, StartCreateGroupChat } from "./create-group.tsx";
import { prepareEncryptedNostrEvent, prepareNormalNostrEvent } from "../lib/nostr-ts/event.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts";
import { NostrAccountContext, NostrEvent, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts";
import { OtherConfig } from "./config-other.ts"; import { OtherConfig } from "./config-other.ts";
import { DM_List } from "./conversation-list.ts";
import { ContactUpdate } from "./conversation-list.tsx";
import { CreateGroup, CreateGroupChat, StartCreateGroupChat } from "./create-group.tsx";
import { StartInvite } from "./dm.tsx";
import { EditGroup, StartEditGroupChatProfile } from "./edit-group.tsx"; import { EditGroup, StartEditGroupChatProfile } from "./edit-group.tsx";
import { GroupMessageController } from "../features/gm.ts";
import { ChatMessage } from "./message.ts";
import { InviteUsersToGroup } from "./invite-button.tsx";
import { SaveProfile } from "./edit-profile.tsx"; import { SaveProfile } from "./edit-profile.tsx";
import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { EditorEvent, EditorModel, new_DM_EditorModel, SendMessage } from "./editor.tsx";
import { EventDetail, EventDetailItem } from "./event-detail.tsx";
import { InviteUsersToGroup } from "./invite-button.tsx";
import { DirectMessagePanelUpdate } from "./message-panel.tsx";
import { ChatMessage } from "./message.ts";
import { InstallPrompt, NavigationUpdate } from "./nav.tsx";
import { notify } from "./notification.ts";
import { RelayDetail } from "./relay-detail.tsx"; import { RelayDetail } from "./relay-detail.tsx";
import { Search } from "./search.tsx";
import { SearchUpdate, SelectConversation } from "./search_model.ts";
import { RelayConfigChange, ViewRelayDetail } from "./setting.tsx";
import { SignInEvent } from "./signIn.tsx";
export type UI_Interaction_Event = export type UI_Interaction_Event =
| SearchUpdate | SearchUpdate
@ -467,7 +463,7 @@ export async function* Database_Update(
) { ) {
const changes = database.subscribe(); const changes = database.subscribe();
while (true) { while (true) {
await csp.sleep(333); await sleep(333);
await changes.ready(); await changes.ready();
const changes_events: (Encrypted_Event | Profile_Nostr_Event | Parsed_Event)[] = []; const changes_events: (Encrypted_Event | Profile_Nostr_Event | Parsed_Event)[] = [];
while (true) { while (true) {
@ -475,7 +471,7 @@ export async function* Database_Update(
break; break;
} }
const e = await changes.pop(); const e = await changes.pop();
if (e == csp.closed) { if (e == closed) {
console.error("unreachable: db changes channel should never close"); console.error("unreachable: db changes channel should never close");
break; break;
} }

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -1,8 +1,8 @@
import { assertEquals, fail } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { assertEquals, fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { OtherConfig } from "./config-other.ts"; import { OtherConfig } from "./config-other.ts";
import { InMemoryAccountContext, NostrEvent } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext, NostrEvent } from "../../libs/nostr.ts/nostr.ts";
import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { LamportTime } from "../time.ts"; import { LamportTime } from "../../time.ts";
Deno.test("Pin List", async () => { Deno.test("Pin List", async () => {
const ctx = InMemoryAccountContext.Generate(); const ctx = InMemoryAccountContext.Generate();

View File

@ -1,15 +1,10 @@
import { prepareEncryptedNostrEvent } from "../lib/nostr-ts/event.ts";
import { NostrAccountContext, NostrEvent, NostrKind, verifyEvent } from "../lib/nostr-ts/nostr.ts";
import { PinListGetter } from "./conversation-list.tsx";
import { parseJSON } from "../features/profile.ts";
import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { import { prepareEncryptedNostrEvent } from "../../libs/nostr.ts/event.ts";
PinConversation, import { NostrAccountContext, NostrEvent, NostrKind, verifyEvent } from "../../libs/nostr.ts/nostr.ts";
PinConversationRelay, import { parseJSON } from "../features/profile.ts";
UnpinConversation, import { PinConversationRelay, UnpinConversationRelay } from "../nostr.ts";
UnpinConversationRelay,
} from "../nostr.ts";
import { LamportTime } from "../time.ts"; import { LamportTime } from "../time.ts";
import { PinListGetter } from "./conversation-list.tsx";
export type NostrEventAdder = { export type NostrEventAdder = {
addEvent(event: NostrEvent): Promise<undefined | Error>; addEvent(event: NostrEvent): Promise<undefined | Error>;

View File

@ -1,20 +1,20 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { ConversationList } from "./conversation-list.tsx"; import { InMemoryAccountContext, NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { Datebase_View } from "../database.ts";
import { PrivateKey } from "../lib/nostr-ts/key.ts";
import { InMemoryAccountContext, NostrEvent, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { testEventBus } from "./_setup.test.ts";
import { DM_List } from "./conversation-list.ts";
import { NewIndexedDB } from "./dexie-db.ts";
import { ProfileSyncer } from "../features/profile.ts";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts";
import { OtherConfig } from "./config-other.ts";
import { GroupChatSyncer, GroupMessageController } from "../features/gm.ts";
import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { prepareEncryptedNostrEvent } from "../../libs/nostr.ts/event.ts";
import { PrivateKey } from "../../libs/nostr.ts/key.ts";
import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { Datebase_View } from "../database.ts";
import { GroupChatSyncer, GroupMessageController } from "../features/gm.ts";
import { ProfileSyncer } from "../features/profile.ts";
import { LamportTime } from "../time.ts"; import { LamportTime } from "../time.ts";
import { prepareEncryptedNostrEvent } from "../lib/nostr-ts/event.ts"; import { testEventBus } from "./_setup.test.ts";
import { OtherConfig } from "./config-other.ts";
import { DM_List } from "./conversation-list.ts";
import { ConversationList } from "./conversation-list.tsx";
import { NewIndexedDB } from "./dexie-db.ts";
const ctx = InMemoryAccountContext.Generate(); const ctx = InMemoryAccountContext.Generate();
const db = NewIndexedDB(); const db = NewIndexedDB();

View File

@ -1,8 +1,8 @@
import { ConversationListRetriever, NewMessageChecker } from "./conversation-list.tsx"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { NostrAccountContext, NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { NostrAccountContext, NostrEvent, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { getTags, Parsed_Event } from "../nostr.ts";
import { InvalidEvent } from "../features/dm.ts"; import { InvalidEvent } from "../features/dm.ts";
import { getTags } from "../nostr.ts";
import { ConversationListRetriever, NewMessageChecker } from "./conversation-list.tsx";
export interface ConversationSummary { export interface ConversationSummary {
pubkey: PublicKey; pubkey: PublicKey;

View File

@ -1,24 +1,23 @@
/** @jsx h */ /** @jsx h */
import { Fragment, h } from "https://esm.sh/preact@10.17.1"; import { Component, Fragment, h } from "https://esm.sh/preact@10.17.1";
import { tw } from "https://esm.sh/twind@0.16.16"; import { tw } from "https://esm.sh/twind@0.16.16";
import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { emitFunc, EventSubscriber } from "../event-bus.ts";
import { ProfileData } from "../features/profile.ts";
import { PinConversation, UnpinConversation } from "../nostr.ts";
import { UI_Interaction_Event } from "./app_update.tsx";
import { Avatar } from "./components/avatar.tsx"; import { Avatar } from "./components/avatar.tsx";
import { CenterClass, IconButtonClass, LinearGradientsClass } from "./components/tw.ts"; import { CenterClass, IconButtonClass, LinearGradientsClass } from "./components/tw.ts";
import { ConversationSummary, sortUserInfo } from "./conversation-list.ts";
import { emitFunc, EventSubscriber } from "../event-bus.ts";
import { SearchUpdate, SelectConversation } from "./search_model.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts";
import { PinConversation, UnpinConversation } from "../nostr.ts";
import { ErrorColor, PrimaryTextColor, SecondaryBackgroundColor } from "./style/colors.ts";
import { ChatIcon } from "./icons/chat-icon.tsx";
import { StartCreateGroupChat } from "./create-group.tsx";
import { GroupIcon } from "./icons/group-icon.tsx";
import { Component } from "https://esm.sh/preact@10.17.1";
import { UI_Interaction_Event } from "./app_update.tsx";
import { ProfileData } from "../features/profile.ts";
import { ProfileGetter } from "./search.tsx";
import { IS_BETA_VERSION } from "./config.js"; import { IS_BETA_VERSION } from "./config.js";
import { UnpinIcon } from "./icons/unpin-icon.tsx"; import { ConversationSummary, sortUserInfo } from "./conversation-list.ts";
import { StartCreateGroupChat } from "./create-group.tsx";
import { ChatIcon } from "./icons/chat-icon.tsx";
import { GroupIcon } from "./icons/group-icon.tsx";
import { PinIcon } from "./icons/pin-icon.tsx"; import { PinIcon } from "./icons/pin-icon.tsx";
import { UnpinIcon } from "./icons/unpin-icon.tsx";
import { ProfileGetter } from "./search.tsx";
import { SearchUpdate, SelectConversation } from "./search_model.ts";
import { ErrorColor, PrimaryTextColor, SecondaryBackgroundColor } from "./style/colors.ts";
export interface ConversationListRetriever { export interface ConversationListRetriever {
getContacts: () => Iterable<ConversationSummary>; getContacts: () => Iterable<ConversationSummary>;

View File

@ -32,6 +32,46 @@
"https://deno.land/std@0.186.0/path/posix.ts": "8b7c67ac338714b30c816079303d0285dd24af6b284f7ad63da5b27372a2c94d", "https://deno.land/std@0.186.0/path/posix.ts": "8b7c67ac338714b30c816079303d0285dd24af6b284f7ad63da5b27372a2c94d",
"https://deno.land/std@0.186.0/path/separator.ts": "0fb679739d0d1d7bf45b68dacfb4ec7563597a902edbaf3c59b50d5bcadd93b1", "https://deno.land/std@0.186.0/path/separator.ts": "0fb679739d0d1d7bf45b68dacfb4ec7563597a902edbaf3c59b50d5bcadd93b1",
"https://deno.land/std@0.186.0/path/win32.ts": "d186344e5583bcbf8b18af416d13d82b35a317116e6460a5a3953508c3de5bba", "https://deno.land/std@0.186.0/path/win32.ts": "d186344e5583bcbf8b18af416d13d82b35a317116e6460a5a3953508c3de5bba",
"https://deno.land/std@0.202.0/assert/assert.ts": "9a97dad6d98c238938e7540736b826440ad8c1c1e54430ca4c4e623e585607ee",
"https://deno.land/std@0.202.0/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56",
"https://deno.land/std@0.202.0/fs/_util.ts": "fbf57dcdc9f7bc8128d60301eece608246971a7836a3bb1e78da75314f08b978",
"https://deno.land/std@0.202.0/fs/walk.ts": "a16146724a6aaf9efdb92023a74e9805195c3469900744ce5de4113b07b29779",
"https://deno.land/std@0.202.0/path/_basename.ts": "057d420c9049821f983f784fd87fa73ac471901fb628920b67972b0f44319343",
"https://deno.land/std@0.202.0/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0",
"https://deno.land/std@0.202.0/path/_dirname.ts": "355e297236b2218600aee7a5301b937204c62e12da9db4b0b044993d9e658395",
"https://deno.land/std@0.202.0/path/_extname.ts": "eaaa5aae1acf1f03254d681bd6a8ce42a9cb5b7ff2213a9d4740e8ab31283664",
"https://deno.land/std@0.202.0/path/_format.ts": "4a99270d6810f082e614309164fad75d6f1a483b68eed97c830a506cc589f8b4",
"https://deno.land/std@0.202.0/path/_from_file_url.ts": "6eadfae2e6f63ad9ee46b26db4a1b16583055c0392acedfb50ed2fc694b6f581",
"https://deno.land/std@0.202.0/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b",
"https://deno.land/std@0.202.0/path/_is_absolute.ts": "05dac10b5e93c63198b92e3687baa2be178df5321c527dc555266c0f4f51558c",
"https://deno.land/std@0.202.0/path/_join.ts": "815f5e85b042285175b1492dd5781240ce126c23bd97bad6b8211fe7129c538e",
"https://deno.land/std@0.202.0/path/_normalize.ts": "a19ec8706b2707f9dd974662a5cd89fad438e62ab1857e08b314a8eb49a34d81",
"https://deno.land/std@0.202.0/path/_os.ts": "30b0c2875f360c9296dbe6b7f2d528f0f9c741cecad2e97f803f5219e91b40a2",
"https://deno.land/std@0.202.0/path/_parse.ts": "0f9b0ff43682dd9964eb1c4398610c4e165d8db9d3ac9d594220217adf480cfa",
"https://deno.land/std@0.202.0/path/_relative.ts": "27bdeffb5311a47d85be26d37ad1969979359f7636c5cd9fcf05dcd0d5099dc5",
"https://deno.land/std@0.202.0/path/_resolve.ts": "7a3616f1093735ed327e758313b79c3c04ea921808ca5f19ddf240cb68d0adf6",
"https://deno.land/std@0.202.0/path/_to_file_url.ts": "a141e4a525303e1a3a0c0571fd024552b5f3553a2af7d75d1ff3a503dcbb66d8",
"https://deno.land/std@0.202.0/path/_to_namespaced_path.ts": "0d5f4caa2ed98ef7a8786286df6af804b50e38859ae897b5b5b4c8c5930a75c8",
"https://deno.land/std@0.202.0/path/_util.ts": "4e191b1bac6b3bf0c31aab42e5ca2e01a86ab5a0d2e08b75acf8585047a86221",
"https://deno.land/std@0.202.0/path/basename.ts": "bdfa5a624c6a45564dc6758ef2077f2822978a6dbe77b0a3514f7d1f81362930",
"https://deno.land/std@0.202.0/path/common.ts": "ee7505ab01fd22de3963b64e46cff31f40de34f9f8de1fff6a1bd2fe79380000",
"https://deno.land/std@0.202.0/path/dirname.ts": "b6533f4ee4174a526dec50c279534df5345836dfdc15318400b08c62a62a39dd",
"https://deno.land/std@0.202.0/path/extname.ts": "62c4b376300795342fe1e4746c0de518b4dc9c4b0b4617bfee62a2973a9555cf",
"https://deno.land/std@0.202.0/path/format.ts": "110270b238514dd68455a4c54956215a1aff7e37e22e4427b7771cefe1920aa5",
"https://deno.land/std@0.202.0/path/from_file_url.ts": "9f5cb58d58be14c775ec2e57fc70029ac8b17ed3bd7fe93e475b07280adde0ac",
"https://deno.land/std@0.202.0/path/glob.ts": "593e2c3573883225c25c5a21aaa8e9382a696b8e175ea20a3b6a1471ad17aaed",
"https://deno.land/std@0.202.0/path/is_absolute.ts": "0b92eb35a0a8780e9f16f16bb23655b67dace6a8e0d92d42039e518ee38103c1",
"https://deno.land/std@0.202.0/path/join.ts": "31c5419f23d91655b08ec7aec403f4e4cd1a63d39e28f6e42642ea207c2734f8",
"https://deno.land/std@0.202.0/path/mod.ts": "6e1efb0b13121463aedb53ea51dabf5639a3172ab58c89900bbb72b486872532",
"https://deno.land/std@0.202.0/path/normalize.ts": "6ea523e0040979dd7ae2f1be5bf2083941881a252554c0f32566a18b03021955",
"https://deno.land/std@0.202.0/path/parse.ts": "be8de342bb9e1924d78dc4d93c45215c152db7bf738ec32475560424b119b394",
"https://deno.land/std@0.202.0/path/posix.ts": "0a1c1952d132323a88736d03e92bd236f3ed5f9f079e5823fae07c8d978ee61b",
"https://deno.land/std@0.202.0/path/relative.ts": "8bedac226afd360afc45d451a6c29fabceaf32978526bcb38e0c852661f66c61",
"https://deno.land/std@0.202.0/path/resolve.ts": "133161e4949fc97f9ca67988d51376b0f5eef8968a6372325ab84d39d30b80dc",
"https://deno.land/std@0.202.0/path/separator.ts": "40a3e9a4ad10bef23bc2cd6c610291b6c502a06237c2c4cd034a15ca78dedc1f",
"https://deno.land/std@0.202.0/path/to_file_url.ts": "00e6322373dd51ad109956b775e4e72e5f9fa68ce2c6b04e4af2a6eed3825d31",
"https://deno.land/std@0.202.0/path/to_namespaced_path.ts": "1b1db3055c343ab389901adfbda34e82b7386bcd1c744d54f9c1496ee0fd0c3d",
"https://deno.land/std@0.202.0/path/win32.ts": "8b3f80ef7a462511d5e8020ff490edcaa0a0d118f1b1e9da50e2916bdd73f9dd",
"https://deno.land/x/deno_cache@0.5.2/auth_tokens.ts": "5d1d56474c54a9d152e44d43ea17c2e6a398dd1e9682c69811a313567c01ee1e", "https://deno.land/x/deno_cache@0.5.2/auth_tokens.ts": "5d1d56474c54a9d152e44d43ea17c2e6a398dd1e9682c69811a313567c01ee1e",
"https://deno.land/x/deno_cache@0.5.2/cache.ts": "92ce8511e1e5c00fdf53a41619aa77d632ea8e0fc711324322e4d5ebf8133911", "https://deno.land/x/deno_cache@0.5.2/cache.ts": "92ce8511e1e5c00fdf53a41619aa77d632ea8e0fc711324322e4d5ebf8133911",
"https://deno.land/x/deno_cache@0.5.2/deno_dir.ts": "1ea355b8ba11c630d076b222b197cfc937dd81e5a4a260938997da99e8ff93a0", "https://deno.land/x/deno_cache@0.5.2/deno_dir.ts": "1ea355b8ba11c630d076b222b197cfc937dd81e5a4a260938997da99e8ff93a0",
@ -48,8 +88,13 @@
"https://deno.land/x/emit@0.31.0/_utils.ts": "98412edc7aa29e77d592b54fbad00bdec1b05d0c25eb772a5f8edc9813e08d88", "https://deno.land/x/emit@0.31.0/_utils.ts": "98412edc7aa29e77d592b54fbad00bdec1b05d0c25eb772a5f8edc9813e08d88",
"https://deno.land/x/emit@0.31.0/emit.generated.js": "f2453b4a5243f2f5377e70e4577de0be57f99384c1a773bc5b786ad324739dac", "https://deno.land/x/emit@0.31.0/emit.generated.js": "f2453b4a5243f2f5377e70e4577de0be57f99384c1a773bc5b786ad324739dac",
"https://deno.land/x/emit@0.31.0/mod.ts": "326c48e48f3f3c83c11b089aec803e6270bcd64493f250aeb56f46f6960a8458", "https://deno.land/x/emit@0.31.0/mod.ts": "326c48e48f3f3c83c11b089aec803e6270bcd64493f250aeb56f46f6960a8458",
"https://deno.land/x/emit@0.32.0/_utils.ts": "98412edc7aa29e77d592b54fbad00bdec1b05d0c25eb772a5f8edc9813e08d88",
"https://deno.land/x/emit@0.32.0/emit.generated.js": "8c8e1fed94f6b742042897312ad223fff0f5d3c92317ff9970a5b7e8b2bd9441",
"https://deno.land/x/emit@0.32.0/mod.ts": "326c48e48f3f3c83c11b089aec803e6270bcd64493f250aeb56f46f6960a8458",
"https://deno.land/x/wasmbuild@0.14.1/cache.ts": "89eea5f3ce6035a1164b3e655c95f21300498920575ade23161421f5b01967f4", "https://deno.land/x/wasmbuild@0.14.1/cache.ts": "89eea5f3ce6035a1164b3e655c95f21300498920575ade23161421f5b01967f4",
"https://deno.land/x/wasmbuild@0.14.1/loader.ts": "d98d195a715f823151cbc8baa3f32127337628379a02d9eb2a3c5902dbccfc02", "https://deno.land/x/wasmbuild@0.14.1/loader.ts": "d98d195a715f823151cbc8baa3f32127337628379a02d9eb2a3c5902dbccfc02",
"https://deno.land/x/wasmbuild@0.15.1/cache.ts": "9d01b5cb24e7f2a942bbd8d14b093751fa690a6cde8e21709ddc97667e6669ed",
"https://deno.land/x/wasmbuild@0.15.1/loader.ts": "8c2fc10e21678e42f84c5135d8ab6ab7dc92424c3f05d2354896a29ccfd02a63",
"https://esm.sh/dexie@3.2.4": "c47d1a2d892e605fde24fd9900602b11808018d5fb11a1c6ad91cec6bb0bf828", "https://esm.sh/dexie@3.2.4": "c47d1a2d892e605fde24fd9900602b11808018d5fb11a1c6ad91cec6bb0bf828",
"https://esm.sh/preact@10.11.3": "ad3c24796c4132c84b4b392f812228d53a0fd600fa64648f27aebd05ec09b24e", "https://esm.sh/preact@10.11.3": "ad3c24796c4132c84b4b392f812228d53a0fd600fa64648f27aebd05ec09b24e",
"https://esm.sh/preact@10.17.1": "d9d10d95cd047fd2c26bb68e760a87d3747fafc64a1e54049095682c69c7491a", "https://esm.sh/preact@10.17.1": "d9d10d95cd047fd2c26bb68e760a87d3747fafc64a1e54049095682c69c7491a",

View File

@ -1,19 +1,19 @@
import * as dexie from "https://esm.sh/dexie@3.2.4"; import { Dexie, Table } from "https://esm.sh/v135/dexie@3.2.4/dist/dexie.js";
import { NostrEvent, NostrKind, Tag } from "../lib/nostr-ts/nostr.ts"; import { NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { EventMark, EventMarker, EventRemover, EventsAdapter, Indices, RelayRecorder } from "../database.ts"; import { EventMark, EventMarker, EventRemover, EventsAdapter, Indices, RelayRecorder } from "../database.ts";
import { Tag } from "../nostr.ts";
export type RelayRecord = { export type RelayRecord = {
url: string; url: string;
event_id: string; event_id: string;
}; };
export class DexieDatabase extends dexie.Dexie export class DexieDatabase extends Dexie implements EventsAdapter, RelayRecorder, EventMarker, EventRemover {
implements EventsAdapter, RelayRecorder, EventMarker, EventRemover {
// 'events' is added by dexie when declaring the stores() // 'events' is added by dexie when declaring the stores()
// We just tell the typing system this is the case // We just tell the typing system this is the case
events!: dexie.Table<NostrEvent>; events!: Table<NostrEvent>;
relayRecords!: dexie.Table<RelayRecord>; relayRecords!: Table<RelayRecord>;
eventMarks!: dexie.Table<EventMark>; eventMarks!: Table<EventMark>;
constructor() { constructor() {
super("Events"); super("Events");

View File

@ -1,25 +1,24 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1";
import { PrivateKey } from "../lib/nostr-ts/key.ts";
import { InMemoryAccountContext, NostrEvent, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { Datebase_View } from "../database.ts";
import { testEventBus } from "./_setup.test.ts";
import { prepareEncryptedNostrEvent } from "../lib/nostr-ts/event.ts";
import { DM_List } from "./conversation-list.ts";
import { EventSyncer } from "./event_syncer.ts";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts";
import { ProfileSyncer } from "../features/profile.ts";
import { handle_SendMessage } from "./app_update.tsx";
import { LamportTime } from "../time.ts";
import { initialModel } from "./app_model.ts";
import { relays } from "../lib/nostr-ts/relay-list.test.ts";
import { DirectMessageContainer } from "./dm.tsx";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { NewIndexedDB } from "./dexie-db.ts"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { OtherConfig } from "./config-other.ts"; import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { prepareEncryptedNostrEvent } from "../../libs/nostr.ts/event.ts";
import { PrivateKey } from "../../libs/nostr.ts/key.ts";
import { InMemoryAccountContext, NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { relays } from "../../libs/nostr.ts/relay-list.test.ts";
import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { Datebase_View } from "../database.ts";
import { DirectedMessageController } from "../features/dm.ts"; import { DirectedMessageController } from "../features/dm.ts";
import { GroupMessageController } from "../features/gm.ts"; import { GroupMessageController } from "../features/gm.ts";
import { Channel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { ProfileSyncer } from "../features/profile.ts";
import { LamportTime } from "../time.ts";
import { testEventBus } from "./_setup.test.ts";
import { initialModel } from "./app_model.ts";
import { OtherConfig } from "./config-other.ts";
import { DM_List } from "./conversation-list.ts";
import { NewIndexedDB } from "./dexie-db.ts";
import { DirectMessageContainer } from "./dm.tsx";
import { EventSyncer } from "./event_syncer.ts";
const ctx = InMemoryAccountContext.New(PrivateKey.Generate()); const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
const indexedDB = NewIndexedDB(); const indexedDB = NewIndexedDB();
@ -43,8 +42,8 @@ if (!e || e instanceof Error) {
} }
const dm_list = new DM_List(ctx); const dm_list = new DM_List(ctx);
dm_list.addEvents([e]); dm_list.addEvents([e], true);
dm_list.addEvents(Array.from(database.getAllEvents())); dm_list.addEvents(Array.from(database.getAllEvents()), true);
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
const event = await prepareEncryptedNostrEvent(ctx, { const event = await prepareEncryptedNostrEvent(ctx, {
@ -55,7 +54,7 @@ for (let i = 0; i < 20; i++) {
["p", PrivateKey.Generate().toPublicKey().hex], ["p", PrivateKey.Generate().toPublicKey().hex],
], ],
}) as NostrEvent; }) as NostrEvent;
const err = dm_list.addEvents([event]); const err = dm_list.addEvents([event], true);
if (err instanceof Error) { if (err instanceof Error) {
fail(err.message); fail(err.message);
} }
@ -99,6 +98,6 @@ render(
if (event == null) { if (event == null) {
continue; continue;
} }
dm_list.addEvents([event]); dm_list.addEvents([event], true);
} }
})(); })();

View File

@ -1,28 +1,33 @@
/** @jsx h */ /** @jsx h */
import { Component, h, VNode } from "https://esm.sh/preact@10.17.1"; import { Component, h, VNode } from "https://esm.sh/preact@10.17.1";
import * as cl from "./conversation-list.tsx"; import { PopChannel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { MessagePanel, NewMessageListener } from "./message-panel.tsx"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { NostrAccountContext, NostrEvent } from "../../libs/nostr.ts/nostr.ts";
import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { RelayRecordGetter } from "../database.ts";
import { EventBus } from "../event-bus.ts"; import { EventBus } from "../event-bus.ts";
import { CenterClass, IconButtonClass } from "./components/tw.ts"; import { GroupMessageController } from "../features/gm.ts";
import { ChatMessagesGetter, UI_Interaction_Event } from "./app_update.tsx";
import { NostrAccountContext, NostrEvent } from "../lib/nostr-ts/nostr.ts";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts";
import { ProfileSyncer } from "../features/profile.ts"; import { ProfileSyncer } from "../features/profile.ts";
import { getFocusedContent } from "./app.tsx"; import { getFocusedContent } from "./app.tsx";
import { EventSyncer } from "./event_syncer.ts"; import { ChatMessagesGetter, UI_Interaction_Event } from "./app_update.tsx";
import { PrimaryTextColor } from "./style/colors.ts"; import { CenterClass, IconButtonClass } from "./components/tw.ts";
import { SettingIcon } from "./icons/setting-icon.tsx";
import { GroupMessageController } from "../features/gm.ts";
import { ProfileGetter } from "./search.tsx";
import { PublicKey } from "../lib/nostr-ts/key.ts";
import { EditorModel } from "./editor.tsx";
import { InviteButton } from "./invite-button.tsx";
import { IS_BETA_VERSION } from "./config.js"; import { IS_BETA_VERSION } from "./config.js";
import { UserIcon } from "./icons/user-icon.tsx"; import { EditorModel } from "./editor.tsx";
import { EventSyncer } from "./event_syncer.ts";
import { LeftArrowIcon } from "./icons/left-arrow-icon.tsx"; import { LeftArrowIcon } from "./icons/left-arrow-icon.tsx";
import { RelayRecordGetter } from "../database.ts"; import { SettingIcon } from "./icons/setting-icon.tsx";
import { UserIcon } from "./icons/user-icon.tsx";
import { InviteButton } from "./invite-button.tsx";
import { MessagePanel, NewMessageListener } from "./message-panel.tsx";
import { RightPanelModel } from "./right-panel.tsx"; import { RightPanelModel } from "./right-panel.tsx";
import { Channel, PopChannel } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { ProfileGetter } from "./search.tsx";
import { PrimaryTextColor } from "./style/colors.ts";
import {
ConversationList,
ConversationListRetriever,
NewMessageChecker,
PinListGetter,
} from "./conversation-list.tsx";
export type DM_Model = { export type DM_Model = {
currentEditor: EditorModel | undefined; currentEditor: EditorModel | undefined;
@ -42,9 +47,9 @@ type DirectMessageContainerProps = {
profileGetter: ProfileGetter; profileGetter: ProfileGetter;
messageGetter: ChatMessagesGetter; messageGetter: ChatMessagesGetter;
newMessageListener: NewMessageListener; newMessageListener: NewMessageListener;
pinListGetter: cl.PinListGetter; pinListGetter: PinListGetter;
conversationLists: cl.ConversationListRetriever; conversationLists: ConversationListRetriever;
newMessageChecker: cl.NewMessageChecker; newMessageChecker: NewMessageChecker;
relayRecordGetter: RelayRecordGetter; relayRecordGetter: RelayRecordGetter;
} & DM_Model; } & DM_Model;
@ -155,7 +160,7 @@ export class DirectMessageContainer extends Component<DirectMessageContainerProp
max-sm:w-full max-sm:w-full
${props.currentEditor ? "max-sm:hidden" : ""}`} ${props.currentEditor ? "max-sm:hidden" : ""}`}
> >
<cl.ConversationList <ConversationList
eventBus={props.bus} eventBus={props.bus}
emit={props.bus.emit} emit={props.bus.emit}
convoListRetriever={props.conversationLists} convoListRetriever={props.conversationLists}

View File

@ -2,7 +2,7 @@
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { testEventBus, testEventMarker, testEventsAdapter, testRelayAdapter } from "./_setup.test.ts"; import { testEventBus, testEventMarker, testEventsAdapter, testRelayAdapter } from "./_setup.test.ts";
import { EditGroup } from "./edit-group.tsx"; import { EditGroup } from "./edit-group.tsx";
import { InMemoryAccountContext } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext } from "../../libs/nostr.ts/nostr.ts";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { Datebase_View } from "../database.ts"; import { Datebase_View } from "../database.ts";

View File

@ -5,7 +5,7 @@ import { GroupIcon } from "./icons/group-icon.tsx";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
import { ProfileGetter } from "./search.tsx"; import { ProfileGetter } from "./search.tsx";
import { EditProfile, SaveProfile } from "./edit-profile.tsx"; import { EditProfile, SaveProfile } from "./edit-profile.tsx";
import { NostrAccountContext } from "../lib/nostr-ts/nostr.ts"; import { NostrAccountContext } from "../../libs/nostr.ts/nostr.ts";
export type StartEditGroupChatProfile = { export type StartEditGroupChatProfile = {
type: "StartEditGroupChatProfile"; type: "StartEditGroupChatProfile";

View File

@ -2,7 +2,7 @@
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { testEventBus, testEventMarker, testEventsAdapter, testRelayAdapter } from "./_setup.test.ts"; import { testEventBus, testEventMarker, testEventsAdapter, testRelayAdapter } from "./_setup.test.ts";
import { EditGroup } from "./edit-group.tsx"; import { EditGroup } from "./edit-group.tsx";
import { InMemoryAccountContext } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext } from "../../libs/nostr.ts/nostr.ts";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { Datebase_View } from "../database.ts"; import { Datebase_View } from "../database.ts";
import { EditProfile } from "./edit-profile.tsx"; import { EditProfile } from "./edit-profile.tsx";

View File

@ -20,8 +20,8 @@ import {
} from "./style/colors.ts"; } from "./style/colors.ts";
import { Component, ComponentChildren } from "https://esm.sh/preact@10.11.3"; import { Component, ComponentChildren } from "https://esm.sh/preact@10.11.3";
import { ProfileGetter } from "./search.tsx"; import { ProfileGetter } from "./search.tsx";
import { NostrAccountContext } from "../lib/nostr-ts/nostr.ts";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
import { NostrAccountContext } from "../../libs/nostr.ts/nostr.ts";
export type SaveProfile = { export type SaveProfile = {
type: "SaveProfile"; type: "SaveProfile";

View File

@ -1,8 +1,8 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { Editor } from "./editor.tsx"; import { Editor } from "./editor.tsx";
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { PrivateKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey } from "../../libs/nostr.ts/key.ts";
import { testEventBus } from "./_setup.test.ts"; import { testEventBus } from "./_setup.test.ts";
const ctx = InMemoryAccountContext.New(PrivateKey.Generate()); const ctx = InMemoryAccountContext.New(PrivateKey.Generate());

View File

@ -3,7 +3,7 @@ import { createRef, h } from "https://esm.sh/preact@10.17.1";
import { CenterClass, LinearGradientsClass, NoOutlineClass } from "./components/tw.ts"; import { CenterClass, LinearGradientsClass, NoOutlineClass } from "./components/tw.ts";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { ImageIcon } from "./icons/image-icon.tsx"; import { ImageIcon } from "./icons/image-icon.tsx";
import { DividerBackgroundColor, PrimaryBackgroundColor, PrimaryTextColor } from "./style/colors.ts"; import { DividerBackgroundColor, PrimaryBackgroundColor, PrimaryTextColor } from "./style/colors.ts";
import { SendIcon } from "./icons/send-icon.tsx"; import { SendIcon } from "./icons/send-icon.tsx";

View File

@ -1,13 +1,17 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { PrivateKey, PublicKey } from "../lib/nostr-ts/key.ts"; import { prepareNormalNostrEvent } from "../../libs/nostr.ts/event.ts";
import { prepareNormalNostrEvent } from "../lib/nostr-ts/event.ts"; import { PrivateKey, PublicKey } from "../../libs/nostr.ts/key.ts";
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts"; import { NoteID } from "../../libs/nostr.ts/nip19.ts";
import { InMemoryAccountContext, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { EventDetail, EventDetailItem } from "./event-detail.tsx"; import { EventDetail, EventDetailItem } from "./event-detail.tsx";
import { NoteID } from "../lib/nostr-ts/nip19.ts";
const ctx = InMemoryAccountContext.New(PrivateKey.Generate()); const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
const event = await prepareNormalNostrEvent(ctx, NostrKind.TEXT_NOTE, [["d", "nostr"]], "Pura Vida"); const event = await prepareNormalNostrEvent(ctx, {
kind: NostrKind.TEXT_NOTE,
tags: [["d", "nostr"]],
content: "Pura Vida",
});
const publicKey = PublicKey.FromHex(event.pubkey) as PublicKey; const publicKey = PublicKey.FromHex(event.pubkey) as PublicKey;
const items: EventDetailItem[] = [ const items: EventDetailItem[] = [

View File

@ -1,6 +1,6 @@
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts"; import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { NoteID } from "../../libs/nostr.ts/nip19.ts";
import { Datebase_View } from "../database.ts"; import { Datebase_View } from "../database.ts";
import { NoteID } from "../lib/nostr-ts/nip19.ts";
export class EventSyncer { export class EventSyncer {
constructor(private readonly pool: ConnectionPool, private readonly db: Datebase_View) {} constructor(private readonly pool: ConnectionPool, private readonly db: Datebase_View) {}

View File

@ -1,13 +1,13 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { InviteButton } from "./invite-button.tsx"; import { InviteButton } from "./invite-button.tsx";
import { InMemoryAccountContext } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext } from "../../libs/nostr.ts/nostr.ts";
import { GroupMessageController } from "../features/gm.ts"; import { GroupMessageController } from "../features/gm.ts";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { test_db_view, testEventBus } from "./_setup.test.ts"; import { test_db_view, testEventBus } from "./_setup.test.ts";
import { CenterClass } from "./components/tw.ts"; import { CenterClass } from "./components/tw.ts";
import { getTags } from "../nostr.ts"; import { getTags } from "../nostr.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
const database = await test_db_view(); const database = await test_db_view();
@ -38,8 +38,10 @@ render(
for await (const event of testEventBus.onChange()) { for await (const event of testEventBus.onChange()) {
console.log(event); console.log(event);
// @ts-ignore if (event.type == "InviteUsersToGroup") {
console.log(event.groupPublicKey.hex, "=", gm_A_creation.groupKey.publicKey.hex); console.log(event.groupPublicKey.hex, "=", gm_A_creation.groupKey.publicKey.hex);
// @ts-ignore console.log(event.usersPublicKey[0].hex, "=", user_B.publicKey.hex);
console.log(event.usersPublicKey[0].hex, "=", user_B.publicKey.hex); } else {
throw new Error("impossible");
}
} }

View File

@ -5,7 +5,7 @@ import { DividerBackgroundColor, HoverButtonBackgroudColor, PrimaryTextColor } f
import { NoOutlineClass } from "./components/tw.ts"; import { NoOutlineClass } from "./components/tw.ts";
import { GroupMessageController } from "../features/gm.ts"; import { GroupMessageController } from "../features/gm.ts";
import { ProfileGetter } from "./search.tsx"; import { ProfileGetter } from "./search.tsx";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
type State = { type State = {

View File

@ -3,7 +3,7 @@ import { h } from "https://esm.sh/preact@10.17.1";
import { PrimaryTextColor, SecondaryBackgroundColor, SecondaryTextColor } from "./style/colors.ts"; import { PrimaryTextColor, SecondaryBackgroundColor, SecondaryTextColor } from "./style/colors.ts";
import { Avatar } from "./components/avatar.tsx"; import { Avatar } from "./components/avatar.tsx";
import { LinearGradientsClass, NoOutlineClass } from "./components/tw.ts"; import { LinearGradientsClass, NoOutlineClass } from "./components/tw.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { ProfileGetter } from "./search.tsx"; import { ProfileGetter } from "./search.tsx";
import { SelectConversation } from "./search_model.ts"; import { SelectConversation } from "./search_model.ts";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";

View File

@ -2,7 +2,7 @@
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import KeyView from "./key-view.tsx"; import KeyView from "./key-view.tsx";
import { PrivateKey, PublicKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey, PublicKey } from "../../libs/nostr.ts/key.ts";
const key = PrivateKey.Generate(); const key = PrivateKey.Generate();

View File

@ -1,6 +1,6 @@
/** @jsx h */ /** @jsx h */
import { Fragment, h } from "https://esm.sh/preact@10.17.1"; import { Fragment, h } from "https://esm.sh/preact@10.17.1";
import { PrivateKey, PublicKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey, PublicKey } from "../../libs/nostr.ts/key.ts";
import { InputClass } from "./components/tw.ts"; import { InputClass } from "./components/tw.ts";
import { PrimaryTextColor, TitleIconColor, WarnColor } from "./style/colors.ts"; import { PrimaryTextColor, TitleIconColor, WarnColor } from "./style/colors.ts";
import { KeyIcon } from "./icons/key-icon.tsx"; import { KeyIcon } from "./icons/key-icon.tsx";

View File

@ -1,26 +1,24 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { MessagePanel } from "./message-panel.tsx"; import { prepareNormalNostrEvent } from "../../libs/nostr.ts/event.ts";
import { InvalidKey, PrivateKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey } from "../../libs/nostr.ts/key.ts";
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { Datebase_View } from "../database.ts"; import { relays } from "../../libs/nostr.ts/relay-list.test.ts";
import { testEventBus, testEventMarker, testEventsAdapter, testRelayAdapter } from "./_setup.test.ts"; import { ConnectionPool } from "../../libs/nostr.ts/relay-pool.ts";
import { prepareNormalNostrEvent } from "../lib/nostr-ts/event.ts";
import { DM_List } from "./conversation-list.ts";
import { EventSyncer } from "./event_syncer.ts";
import { ConnectionPool } from "../lib/nostr-ts/relay-pool.ts";
import { ProfileSyncer } from "../features/profile.ts";
import { handle_SendMessage } from "./app_update.tsx";
import { LamportTime } from "../time.ts";
import { initialModel } from "./app_model.ts";
import { relays } from "../lib/nostr-ts/relay-list.test.ts";
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { GroupChatSyncer, GroupMessageController } from "../features/gm.ts"; import { GroupChatSyncer, GroupMessageController } from "../features/gm.ts";
import { ProfileSyncer } from "../features/profile.ts";
import { LamportTime } from "../time.ts";
import { test_db_view, testEventBus } from "./_setup.test.ts";
import { initialModel } from "./app_model.ts";
import { handle_SendMessage } from "./app_update.tsx";
import { EventSyncer } from "./event_syncer.ts";
import { MessagePanel } from "./message-panel.tsx";
import { DirectedMessageController } from "../features/dm.ts";
const ctx = InMemoryAccountContext.New(PrivateKey.Generate()); const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
const database = await test_db_view(); const database = await test_db_view();
const lamport = new LamportTime(0); const lamport = new LamportTime();
await database.addEvent( await database.addEvent(
await prepareNormalNostrEvent(ctx, { await prepareNormalNostrEvent(ctx, {
@ -68,11 +66,13 @@ const view = () => {
myPublicKey={ctx.publicKey} myPublicKey={ctx.publicKey}
profilesSyncer={new ProfileSyncer(database, pool)} profilesSyncer={new ProfileSyncer(database, pool)}
emit={testEventBus.emit} emit={testEventBus.emit}
messages={[]}
rightPanelModel={{ rightPanelModel={{
show: true, show: true,
}} }}
isGroupChat={false} isGroupMessage={true}
messageGetter={groupMessageController}
newMessageListener={new DirectedMessageController(ctx)}
relayRecordGetter={database}
/> />
); );
}; };

View File

@ -1,13 +1,23 @@
/** @jsx h */ /** @jsx h */
import { Component, ComponentChildren, createRef, h } from "https://esm.sh/preact@10.17.1"; import { Component, createRef, h } from "https://esm.sh/preact@10.17.1";
import { tw } from "https://esm.sh/twind@0.16.16"; import { tw } from "https://esm.sh/twind@0.16.16";
import { Editor, EditorEvent, EditorModel } from "./editor.tsx"; import { Channel, sleep } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts";
import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { NoteID } from "../../libs/nostr.ts/nip19.ts";
import { NostrEvent, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { RelayRecordGetter } from "../database.ts";
import { emitFunc } from "../event-bus.ts";
import { ProfileData, ProfileSyncer } from "../features/profile.ts";
import { Parsed_Event, PinConversation, UnpinConversation } from "../nostr.ts";
import { isMobile } from "./_helper.ts";
import { ChatMessagesGetter } from "./app_update.tsx";
import { Avatar } from "./components/avatar.tsx"; import { Avatar } from "./components/avatar.tsx";
import { IconButtonClass } from "./components/tw.ts"; import { IconButtonClass } from "./components/tw.ts";
import { Channel, sleep } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; import { Editor, EditorEvent, EditorModel } from "./editor.tsx";
import { emitFunc } from "../event-bus.ts"; import { EventSyncer } from "./event_syncer.ts";
import { AboutIcon } from "./icons/about-icon.tsx";
import { LeftArrowIcon } from "./icons/left-arrow-icon.tsx";
import { InviteCard } from "./invite-card.tsx";
import { import {
ChatMessage, ChatMessage,
groupContinuousMessages, groupContinuousMessages,
@ -16,26 +26,12 @@ import {
urlIsImage, urlIsImage,
urlIsVideo, urlIsVideo,
} from "./message.ts"; } from "./message.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts";
import { NostrEvent, NostrKind } from "../lib/nostr-ts/nostr.ts";
import { Parsed_Event, PinConversation, UnpinConversation } from "../nostr.ts";
import { ProfileData, ProfileSyncer } from "../features/profile.ts";
import { DividerBackgroundColor, ErrorColor, LinkColor, PrimaryTextColor } from "./style/colors.ts";
import { EventSyncer } from "./event_syncer.ts";
import { ProfileCard } from "./profile-card.tsx";
import { NoteCard } from "./note-card.tsx"; import { NoteCard } from "./note-card.tsx";
import { ProfileGetter } from "./search.tsx"; import { ProfileCard } from "./profile-card.tsx";
import { InviteCard } from "./invite-card.tsx";
import { SelectConversation } from "./search_model.ts";
import { AboutIcon } from "./icons/about-icon.tsx";
import { CloseIcon } from "./icons/close-icon.tsx";
import { LeftArrowIcon } from "./icons/left-arrow-icon.tsx";
import { NoteID } from "../lib/nostr-ts/nip19.ts";
import { ChatMessagesGetter } from "./app_update.tsx";
import { isMobile } from "./_helper.ts";
import { RelayRecordGetter } from "../database.ts";
import { RightPanel, RightPanelModel } from "./right-panel.tsx"; import { RightPanel, RightPanelModel } from "./right-panel.tsx";
import { ProfileGetter } from "./search.tsx";
import { SelectConversation } from "./search_model.ts";
import { DividerBackgroundColor, ErrorColor, LinkColor, PrimaryTextColor } from "./style/colors.ts";
import { UserDetail } from "./user-detail.tsx"; import { UserDetail } from "./user-detail.tsx";
export type DirectMessagePanelUpdate = export type DirectMessagePanelUpdate =
@ -493,7 +489,7 @@ export function ParseMessageContent(
} else if (message.event.kind == NostrKind.Group_Message) { } else if (message.event.kind == NostrKind.Group_Message) {
parsedContentItems = parseContent(message.content); parsedContentItems = parseContent(message.content);
} else { } else {
parsedContentItems = message.event.parsedContentItems; parsedContentItems = parseContent(message.content);
} }
const vnode = []; const vnode = [];

View File

@ -1,8 +1,8 @@
import { assertEquals } from "https://deno.land/std@0.176.0/testing/asserts.ts"; import { assertEquals } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { ChatMessage, findUrlInString, groupContinuousMessages, parseContent } from "./message.ts"; import { ChatMessage, findUrlInString, groupContinuousMessages, parseContent } from "./message.ts";
import { PrivateKey, PublicKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey, PublicKey } from "../../libs/nostr.ts/key.ts";
import { Nevent, NostrAddress } from "../lib/nostr-ts/nip19.ts"; import { Nevent, NostrAddress } from "../../lib/nostr-ts/nip19.ts";
import { NostrKind } from "../lib/nostr-ts/nostr.ts"; import { NostrKind } from "../../libs/nostr.ts/nostr.ts";
Deno.test("inline parse", async (t) => { Deno.test("inline parse", async (t) => {
const data = [ const data = [

View File

@ -1,7 +1,7 @@
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { DirectedMessage_Event, Parsed_Event } from "../nostr.ts"; import { DirectedMessage_Event, Parsed_Event } from "../nostr.ts";
import { Nevent, NostrAddress, NostrProfile, NoteID } from "../lib/nostr-ts/nip19.ts"; import { Nevent, NostrAddress, NostrProfile, NoteID } from "../../libs/nostr.ts/nip19.ts";
import { NostrKind } from "../lib/nostr-ts/nostr.ts"; import { NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { gm_Invitation } from "../features/gm.ts"; import { gm_Invitation } from "../features/gm.ts";
export function* parseContent(content: string) { export function* parseContent(content: string) {

View File

@ -1,7 +1,7 @@
/** @jsx h */ /** @jsx h */
import { ComponentChild, Fragment, h } from "https://esm.sh/preact@10.17.1"; import { ComponentChild, Fragment, h } from "https://esm.sh/preact@10.17.1";
import { Avatar } from "./components/avatar.tsx"; import { Avatar } from "./components/avatar.tsx";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { import {
PrimaryBackgroundColor, PrimaryBackgroundColor,
PrimaryTextColor, PrimaryTextColor,

View File

@ -10,8 +10,8 @@ import {
} from "./style/colors.ts"; } from "./style/colors.ts";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
import { OpenNote, ViewUserDetail } from "./message-panel.tsx"; import { OpenNote, ViewUserDetail } from "./message-panel.tsx";
import { NostrEvent } from "../lib/nostr-ts/nostr.ts"; import { NostrEvent } from "../../libs/nostr.ts/nostr.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
export function NoteCard(props: { export function NoteCard(props: {
profileData?: ProfileData; profileData?: ProfileData;

View File

@ -1,7 +1,7 @@
/** @jsx h */ /** @jsx h */
import { h, render } from "https://esm.sh/preact@10.17.1"; import { h, render } from "https://esm.sh/preact@10.17.1";
import { PrivateKey } from "../lib/nostr-ts/key.ts"; import { PrivateKey } from "../../libs/nostr.ts/key.ts";
import { InMemoryAccountContext, NostrKind } from "../lib/nostr-ts/nostr.ts"; import { InMemoryAccountContext, NostrKind } from "../../libs/nostr.ts/nostr.ts";
import { ProfileCard } from "./profile-card.tsx"; import { ProfileCard } from "./profile-card.tsx";
import { testEventBus } from "./_setup.test.ts"; import { testEventBus } from "./_setup.test.ts";

View File

@ -2,7 +2,7 @@
import { h } from "https://esm.sh/preact@10.17.1"; import { h } from "https://esm.sh/preact@10.17.1";
import { emitFunc } from "../event-bus.ts"; import { emitFunc } from "../event-bus.ts";
import { ProfileData } from "../features/profile.ts"; import { ProfileData } from "../features/profile.ts";
import { PublicKey } from "../lib/nostr-ts/key.ts"; import { PublicKey } from "../../libs/nostr.ts/key.ts";
import { Avatar } from "./components/avatar.tsx"; import { Avatar } from "./components/avatar.tsx";
import { DividerClass } from "./components/tw.ts"; import { DividerClass } from "./components/tw.ts";
import { ViewUserDetail } from "./message-panel.tsx"; import { ViewUserDetail } from "./message-panel.tsx";

Some files were not shown because too many files have changed in this diff Show More