Merge branch 'mnt' of github.com:spacedeck/spacedeck-open into feature/convert-percentage

pull/162/head
dm 2021-02-06 00:27:30 +01:00
commit 8d73918d0d
9 changed files with 126 additions and 38 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ public/stylesheets/*.css
database.sqlite
*.swp
*~
storage/
.DS_Store

1
.tool-versions 100644
View File

@ -0,0 +1 @@
nodejs 10.23.1

14
.vscode/launch.json vendored 100644
View File

@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Nodemon",
"runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/spacedeck.js",
"cwd": "${workspaceFolder}"
}
]
}

View File

@ -45,6 +45,52 @@ To install all node dependencies, run (do this once):
See [config/default.json](config/default.json). Set `storage_local_path` for a local sqlite database or `storage_region`, `storage_bucket`, `storage_cdn` and `storage_endpoint` for AWS S3. `mail_provider` may be one of `console` or `smtp`. Also, omit a trailing `/` for the `endpoint`.
## Disable DB logs
```json
...
"db_logs_disabled": true
...
```
## Configure color swatches
Add a custom array of swatches to your config/default.json.
**You should include the swatch transparent (rgba(0,0,0,0)) so users can remove the color applied.**
## Configure default colors
You can define text, stroke and fill color in your config/default.json.
**You also should include the default colors in your custom swatches palette.**
```json
...
"spacedeck": {
"default_text_color": "#E11F26",
"default_stroke_color": "#9E0F13",
"default_fill_color": "#64BCCA",
"swatches": [
{"id":8, "hex":"#000000"},
{"id":30, "hex":"rgba(0,0,0,0)"},
{"id":31, "hex": "#E11F26"},
{"id":32, "hex": "#9E0F13"},
{"id":33, "hex": "#64BCCA"},
{"id":34, "hex": "#40808A"},
{"id":35, "hex": "#036492"},
{"id":36, "hex": "#005179"},
{"id":37, "hex": "#84427E"},
{"id":38, "hex": "#6C3468"},
{"id":39, "hex": "#F79B84"},
{"id":40, "hex": "#B57362"},
{"id":41, "hex": "#E7D45A"},
{"id":42, "hex": "#ACA044"}
]
}
...
```
# Run (web server)
node spacedeck.js
@ -64,6 +110,26 @@ For advanced media conversion:
By default, media files are uploaded to the ```storage``` folder.
The database is stored in ```database.sqlite``` by default.
# Other databases (Not officially supported)
## Postgres
Add the [pg](https://www.npmjs.com/package/pg) module and change the config/default.json to
```
"storage_dialect": "postgres",
```
Adapt the other values as needed
```
"storage_host": "localhost",
"storage_database": "spacedeck",
"storage_username": "username",
"storage_password": "password",
```
# Run with Docker
- configure `config/default.json`

View File

@ -7,6 +7,13 @@
"endpoint": "http://localhost:9666",
"invite_code": "top-sekrit",
"storage_dialect": "sqlite",
"storage_host": "localhost",
"storage_database": "spacedeck",
"storage_username": "username",
"storage_password": "password",
"storage_local_path": "./storage",
"storage_local_db": "./database.sqlite",
"storage_region": "eu-central-1",
@ -26,5 +33,6 @@
"mail_smtp_secure": true,
"mail_smtp_require_tls": true,
"mail_smtp_user": "your.smtp.user",
"mail_smtp_pass": "your.secret.smtp.password"
"mail_smtp_pass": "your.secret.smtp.password",
"spacedeck": {}
}

View File

@ -6,24 +6,28 @@ function sequel_log(a,b,c) {
}
const Sequelize = require('sequelize');
const sequelize = new Sequelize('database', 'username', 'password', {
host: 'localhost',
dialect: 'sqlite',
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
},
// SQLite only
storage: config.get('storage_local_db'),
logging: sequel_log,
// http://docs.sequelizejs.com/manual/tutorial/querying.html#operators
operatorsAliases: false
});
const sequelize = new Sequelize(
config.get('storage_database'),
config.get('storage_username'),
config.get('storage_password'),
{
host: config.get('storage_host'),
dialect: config.get('storage_dialect'),
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
},
logging: config.has('db_logs_disabled') ? false : sequel_log,
// http://docs.sequelizejs.com/manual/tutorial/querying.html#operators
operatorsAliases: false,
// SQLite only
storage: config.get('storage_local_db')
}
);
// https://github.com/sequelize/sequelize/issues/8019#issuecomment-384316346
Sequelize.postgres.DECIMAL.parse = function (value) { return parseFloat(value); };
var User;
var Session;

View File

@ -3,7 +3,8 @@
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node spacedeck.js"
"start": "node spacedeck.js",
"dev": "nodemon spacedeck.js"
},
"engines": {
"node": ">=10.0.0"
@ -49,6 +50,9 @@
"validator": "7.0.0",
"ws": "3.3.1"
},
"devDependencies": {
"nodemon": "^2.0.6"
},
"main": "app.js",
"description": "",
"directories": {},

View File

@ -68,9 +68,9 @@ var SpacedeckSections = {
line_height: 1.5,
letter_spacing: 0,
stroke_color: "#000000",
fill_color: "#00000000",
text_color: "#000000",
stroke_color: ENV.options.default_stroke_color ? ENV.options.default_stroke_color : "#000000",
fill_color: ENV.options.default_fill_color ? ENV.options.default_fill_color : "#000000",
text_color: ENV.options.default_text_color ? ENV.options.default_text_color : "#000000",
background_color: "#ffffff",
padding: 0,
@ -109,7 +109,7 @@ var SpacedeckSections = {
color_picker_hue: 127,
color_picker_opacity: 255,
swatches: [
swatches: ENV.options.swatches ? ENV.options.swatches : [
{id:1, hex:"#ff00ff"},
{id:2, hex:"#ffff00"},
{id:3, hex:"#00ffff"},
@ -133,18 +133,7 @@ var SpacedeckSections = {
{id:26, hex:"#d55c4b"},
{id:27, hex:"#6f4021"},
{id:29, hex:"#95a5a6"},
{id:30, hex:"rgba(0,0,0,0)"},
],
swatches_text: [
{id:1, hex:"#9b59b6"},
{id:2, hex:"#3498db"},
{id:3, hex:"#2ecc71"},
{id:4, hex:"#f1c40f"},
{id:5, hex:"#e67e22"},
{id:6, hex:"#d55c4b"},
{id:8, hex:"#ffffff"},
{id:10, hex:"#252525"},
{id:30, hex:"rgba(0,0,0,0)"}
],
fonts: [

View File

@ -17,7 +17,8 @@
webHost: location.host,
webEndpoint: location.origin,
apiEndpoint: location.origin,
websocketsEndpoint: location.origin.replace("https:","wss:").replace("http:","ws:")
websocketsEndpoint: location.origin.replace("https:","wss:").replace("http:","ws:"),
options: <%- config.spacedeck ? JSON.stringify(config.spacedeck) : "{}" %>
};
</script>