Merge branches/quickjs to trunk. This is the way.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3621 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-01-02 18:10:00 +00:00
parent d293637741
commit 79022e1e1f
703 changed files with 419987 additions and 30640 deletions

28
apps/cory/docs/app.js Normal file

File diff suppressed because one or more lines are too long

16
apps/cory/docs/guide.md Normal file
View File

@ -0,0 +1,16 @@
# Tilde Friends Developer's Guide
[Back to index](#index)
A Tilde Friends application runs on the server. To make an interesting
application that interacts with the client, it's necessary to understand
how the parts work together.
## Hello, world!
A simple starting point. Presents `Hello, world!` in the browser when
visited.
**app.js**:
```
app.setDocument('<h1>Hello, world!</h1>');
```

11
apps/cory/docs/index.md Normal file
View File

@ -0,0 +1,11 @@
# Tilde Friends Documentation
Tilde Friends is a participating member of a greater social
network, [Secure Scuttlebutt](https://scuttlebutt.nz/),
augmenting it with a way to safely and securely write, share,
and run code.
- [Purpose](#purpose)
- [Structure](#structure)
- [Guide](#guide)
- [TODO](#todo)

4
apps/cory/docs/markdeep.min.js vendored Normal file

File diff suppressed because one or more lines are too long

24
apps/cory/docs/purpose.md Normal file
View File

@ -0,0 +1,24 @@
# Tilde Friends Purpose
[Back to index](#index)
## Beliefs
1. The web is the universal virtual machine.
- It is here, ready to be used from your desktop, laptop, smart phone,
tablet, game console, and smart TV.
- It is not ideal, but it is the best we have right now,
and all signs point to it continuing to improve, at least
in terms of features, security, and device support.
2. Distributed is superior to centralized.
- Distributed services don't need ads.
- Distributed services can't be acquired by evil corporations.
- Distributed services respect the user's privacy.
- Distributed services respect the user.
3. Offline-first is superior to online-only.
- The internet goes down sometimes. Applications should continue
to work.
3. Making and sharing code should be easy.
- Cloning your repository, installing dev tools, running a
docker image, or fighting with dependencies is *not* easy.
- If you see a thing in a web browser, you should be able to click
`edit`, make a change, save, and see the result.
[Wikipedia](https://www.wikipedia.org/) is easy.

View File

@ -0,0 +1,67 @@
# Tilde Friends Structure
[Back to index](#index)
Tilde Friends is a mostly-self-contained executable written in C.
In combines the following key components:
- A Secure Scuttlebutt (SSB) client/server. This talks with other SSB
instances, storing messages and blobs for anyone visible to local
users as they are encountered and sharing anything published locally
as appropriate.
- An sqlite database. This is where the SSB instance stores its data.
The general schema involves a `messages` table, storing mostly JSON,
a `blobs` table storing arbitrary blob data, and a `properties` table,
storing arbitrary state gleaned from `messages` and `blobs`, generally
updated on demand and incrementally.
- A QuickJS runtime. The core process runs stock scripts and has access
and permission to use all resources. All other processes, which
includes everything which runs untrusted code created by Tilde Friends
users, are strictly sandboxed in ways similar to how web browsers run
untrusted code. All attempts to access potentially sensitive resources
are mediated through the core process.
When run with no arguments, it starts a web server on
[http://localhost:12345/](http://localhost:12345/) and an SSB server.
## Web Interface
The Tilde Friends web server provides access to Tilde Friends applications,
which are arbitrary user-defined web applications.
At the top left, in addition to some basic navigation links, is an `edit`
link. Anyone can view, modify, and run in-place the code to any Tilde
Friends application by using the in-browser editor.
At the top right, one can `login` (to save work in their own space)
or `logout` (proceeding as a guest).
The rest of the page is an iframe belonging to the application.
## Special Paths
- `/~user/app/` - Tilde Friends application paths take the form `/~user/app/`, where `user`
is a username of a Tilde Friends account, and `app` is an arbitrary name
of an application saved by the given user.
- `/~user/app/file` - A raw file in an app.
- `/&blobid.ed25519` - A raw blob. Content-Type is inferred for at least
a few common image types.
## Communication Channels
Web Browser <-> Core <-> Sandbox
Visiting an application path delivers stock HTML and JavaScript which
establishes a WebSocket connection back to the server.
At this point, a new sandbox process is started in Tilde Friends, much
as a new sandboxed process might be started for a new tab in a web
browser. This process has a custom RPC connection to the core process
which holds the WebSocket connection to the browser.
The custom RPC communication between the sandbox process and the core
process facilitates calling functions asynchronously. Calling a remote
function (ie. a function in another process) returns a `Promise`. In
addition, any functions passed in either direction are serialized in
such a way that they can be called remotely.
An application will typically call `app.setDocument()` at startup to
populate the app's iframe in the web browser with its own client web
application resources.

44
apps/cory/docs/todo.md Normal file
View File

@ -0,0 +1,44 @@
# Tilde Friends TODO
[Back to index](#index)
## MVP
- release
- blog
- update COPYING
- update README
- auto-populate data on initial launch
- audit + document API exposed to apps
- ssb core
- good refresh
- live updates
- apps
- app messages
- installable apps
- web interface
- live updates
- strip out unnecessary things?
- more raw views until it's more functional?
## Done
- likely classes of script errors
- tf core
- good error feedback
- markdeep demo
- send blobs
## Later
- DB migration
- stop using CDNs
- collect loads of stats
- faster save - parallel / don't save unmodified
- test likely denials of service
- package standalone executable
- ideas
- visualizations / analysis of gps data
- good web interface for managing connections
- identity
- multiple identities
- tie identities to TF login accounts
- tf account timeout why
- make some demo apps
- rock paper scissors, somehow