diff --git a/CHANGELOG.md b/CHANGELOG.md index 78332de9..cc3ea145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,17 @@ -##v0.1 +## v0.1 Add real time drawing - Change file structure and how files are served - Fix custom invite URL - Automatic connection -##v0.2 +## v0.2 Basic functionality to allow for more features to be added +- Instant live documents +- Data persistence +- User identity, separation between browser client and user -###v0.2.1 +### v0.2.1 Room to document based model - Add sidebar @@ -18,14 +21,14 @@ Room to document based model - Event based WebSocketHandler - Change how URLs work -###v0.2.2 +### v0.2.2 Add document opening/closing - Change how queued packets work - Documents are saved before closed - Change protocol again -###v0.2.3 +### v0.2.3 Flat file data persistence - Remove ConsoleManager @@ -35,7 +38,7 @@ Flat file data persistence - Complete rework of config system - SSL support -###v0.2.4 +### v0.2.4 User identity - Change URL parsing @@ -44,19 +47,55 @@ User identity - Sessions are linked to documents - Improve toString debug -###v0.2.5 +### v0.2.5 Multiple clients per user - Change how sessions are handled - Clean up script loading - Fix hashcode issues -###v0.2.6 +### v0.2.6 Design + - Clean up CSS - Add changelog - Add invite/connected users toolbar - "Fix" canvas resize - Change/clean up config system - Improve client debug -- Better local user with different handshake \ No newline at end of file +- Better local user with different handshake + +## v0.3 +Architecture rework + +### v0.3.1 +SQL data persistence + +- Dockerized server with Maven dependencies +- Add environment variable config method +- Fix send rate of client +- Remove flatfile, add runtime (in memory only) and PostgresSQL database +- Move frontend to independent HTTP server (nginx) + +### v0.3.2 +Rework protocol, document serialization + +- Canvas objects instead of points +- Rename packets to messages +- Add better serialization/deserialization methods + +### v0.3.3 +Rework db, implement document persistence + +- Canvas is saved in db +- Rework user authentication + +### v0.3.4 +Document update/delete operations, overhaul db and config + +- Fix changes not being saved on canvas close +- Fix canvas serialization +- Fix connected clients list +- Add db creation scripts into version control +- Overhaul config - improve exceptions +- Add document update and delete functionality \ No newline at end of file diff --git a/README.md b/README.md index ddfc4b8e..b5a7a200 100644 --- a/README.md +++ b/README.md @@ -2,53 +2,4 @@ welcome to the board project name pending -This project is separated into the server (`board-server`) and the client (`board-web-client`). All files inside `board-web-client` can be served to the browser and are therefore public. - -You will need to build and run the `board-server` project before using or contributing to the client or server. - -## Building `board-server` - -`board-server` is an HTTP/WebSocket server written in Java 8. Make sure you have the Java 8 JDK and [Apache Maven](https://maven.apache.org/index.html) installed on your system before attempting to build the project. - -#### Build Steps -- Clone this repository to your local machine -- Run `mvn clean package` in `board-server` to generate server artifact in the newly created `target` folder - -Modifying `board-server` will require you to recompile the project and restart the server. - -Modifying `board-web-client` only requires you to refresh your browser. If you do not see your new changes, then use `ctrl+F5` to also reset your browser cache. - -## Running `board-server` - -Once you have built `board-server`, you may run it using using the following command: - - java -jar board-server-xxx.jar --ssl.keystore http - -- This starts an HTTP/WebSocket server listening on port 80, which you can connect in your browser at [http://localhost](http://localhost). -- All WebSocket connections run on the same port as the HTTP server, and should connect to [ws://localhost/websocket](ws://localhost/websocket). -- Stop the server gracefully to save persistent data (`ctrl+c` on Windows terminals). Killing the process may result in data loss from any unsaved persistent data. - -### Properties - -These can be set in several different ways: - -##### `board.properties` -Create a file called `board.properties` in the working directory of the server and format as the following - - key=value - other.key=value with spaces - -##### Command line arguments - - java -jar board-server-xxx.jar --key value --other.key "value with spaces" -File indicates a relative (/folder/file.ext) or absolute path (C:/folder/file.ext) - -| Flag | Type | Default | Description | -| --- | ---- | ------- | ----------- | -| ssl.keystore.path | file | (required) | Path to the PKCS12 `mykeystore.pfx` containing the private key for the server. Set to `http` to use HTTP without SSL encryption | -| ssl.passphrase | string | (optional) | Passphrase for `mykeystore.pfx` | -| document.root.path | file | documentRoot | Should be set to where `board-web-client` is. HTTP requests to a directory (`localhost` or `localhost/folder/`) will be served the `index.html` file of those directories HTTP requests to a file that do not specify an extension (`localhost/file`) will be served a `.html` that corresponds to the requested name -| data.root.path | file | data | Sets the folder location of the flat file storage | -| debug.log.traffic | boolean | false | Will print network throughput (read/write) into the console | -| autosave.interval | integer (seconds) | -1 | Sets how often flat file storage will be saved to disk, or negative value to disable | -| http.cache.time | integer (seconds) | 0 | How long before a cached item expires. Set to 0 for development purposes so refreshing the page will always load your new changes (equivalent of `crtl+f5`) | \ No newline at end of file +Make sure to check out the [Quick Start guide](https://github.com/stzups/Board/wiki/Quick-Start). \ No newline at end of file diff --git a/board-database/Dockerfile b/board-database/Dockerfile new file mode 100644 index 00000000..22fb88e8 --- /dev/null +++ b/board-database/Dockerfile @@ -0,0 +1,2 @@ +FROM postgres +COPY init.sql /docker-entrypoint-initdb.d/ \ No newline at end of file diff --git a/board-database/init.sql b/board-database/init.sql new file mode 100644 index 00000000..0334f60a --- /dev/null +++ b/board-database/init.sql @@ -0,0 +1,43 @@ +CREATE DATABASE board; + +-- Connect to board database (currently on default postgres database) +\c board +REVOKE CONNECT ON DATABASE board FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM PUBLIC; + +CREATE USER board_room PASSWORD 'changeme'; +GRANT CONNECT ON DATABASE board TO board_room; +GRANT USAGE ON SCHEMA public TO board_room; + +-- Create tables and grant permissions +CREATE TABLE users( + id bigint NOT NULL, + owned_documents bigint[] NOT NULL, + shared_documents bigint[] NOT NULL, + PRIMARY KEY (id) +); +GRANT SELECT, INSERT, UPDATE ON users TO board_room; + +CREATE TABLE documents( + id bigint NOT NULL, + owner bigint NOT NULL, + name varchar(64) not null, + PRIMARY KEY (id) +); +GRANT SELECT, INSERT, UPDATE, DELETE ON documents TO board_room; + +CREATE TABLE canvases( + document bigint NOT NULL, + data bytea NOT NULL, + PRIMARY KEY (document) +); +GRANT SELECT, INSERT, UPDATE, DELETE ON canvases TO board_room; + +CREATE TABLE persistent_user_sessions( + id bigint NOT NULL, + "user" bigint NOT NULL, + creation_time timestamp, + hashed_token bytea NOT NULL, + PRIMARY KEY (id) +); +GRANT SELECT, INSERT, DELETE ON persistent_user_sessions TO board_room; \ No newline at end of file diff --git a/board-frontend/Dockerfile b/board-frontend/Dockerfile new file mode 100644 index 00000000..8f4b01f7 --- /dev/null +++ b/board-frontend/Dockerfile @@ -0,0 +1,10 @@ +# +# Nginx +# +FROM nginx + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /user/share/nginx/html + +COPY html . diff --git a/board-frontend/html/assets/default.png b/board-frontend/html/assets/default.png new file mode 100644 index 00000000..9616f3e9 Binary files /dev/null and b/board-frontend/html/assets/default.png differ diff --git a/board-web-client/favicon.ico b/board-frontend/html/favicon.ico similarity index 100% rename from board-web-client/favicon.ico rename to board-frontend/html/favicon.ico diff --git a/board-web-client/index.css b/board-frontend/html/index.css similarity index 100% rename from board-web-client/index.css rename to board-frontend/html/index.css diff --git a/board-web-client/index.html b/board-frontend/html/index.html similarity index 78% rename from board-web-client/index.html rename to board-frontend/html/index.html index 422cb63c..99a3c454 100644 --- a/board-web-client/index.html +++ b/board-frontend/html/index.html @@ -3,9 +3,9 @@ Board | Empty board - - - + + +