NostrScript

NostrScript is a WebAssembly implementation that interacts with Damus.
It enables dynamic scripting that can be used to power custom list views,
enabling pluggable algorithms.

The web has JavaScript, Damus has NostrScript. NostrScripts can be
written in any language that compiles to WASM.

This commit adds a WASM interpreter I've written as a mostly-single C
file for portability and embeddability. In the future we could
JIT-compile these for optimal performance if NostrScripts get large and
complicated. For now an interpreter is simple enough for algorithm list
view plugins.

Changelog-Added: Add initial NostrScript implementation
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2023-06-02 18:51:49 -07:00
parent 0c0c58c0cc
commit 97f10e865f
31 changed files with 9623 additions and 117 deletions

View File

@@ -35,7 +35,7 @@ typedef struct mention_bech32_block {
struct nostr_bech32 bech32;
} mention_bech32_block_t;
typedef struct block {
typedef struct note_block {
enum block_type type;
union {
struct str_block str;
@@ -45,12 +45,12 @@ typedef struct block {
} block;
} block_t;
typedef struct blocks {
typedef struct note_blocks {
int num_blocks;
struct block *blocks;
struct note_block *blocks;
} blocks_t;
void blocks_init(struct blocks *blocks);
void blocks_free(struct blocks *blocks);
void blocks_init(struct note_blocks *blocks);
void blocks_free(struct note_blocks *blocks);
#endif /* block_h */