From ee2554760d2089309b8567770a6fdbe0349aa374 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 27 May 2021 20:03:33 +0200 Subject: [PATCH 1/2] Run the formatter --- voicegardens/static/voicegardens.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index 7e3f775..956caac 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -86,7 +86,7 @@ function sendToArchive() { var config = new Headers({ "Content-Type": "multipart/form-data" }); - axios.post(archiveUrl, formData, config).catch(function(error) { + axios.post(archiveUrl, formData, config).catch(function (error) { console.log( "Upload failed!", "Received the following message:", @@ -107,15 +107,15 @@ function gardenShapes() { */ axios .get(archiveListingUrl) - .then(function(response) { + .then(function (response) { if (!response.data.length) return; let randomIndex = floor(random(0, response.data.length - 1)); let url = response.data[randomIndex]; axios .get(url, { responseType: "blob" }) - .then(function(response) { + .then(function (response) { let data = new p5.File(response.data); - let sound = new p5.SoundFile(data, function() { + let sound = new p5.SoundFile(data, function () { let amp = sound.getPeaks(1)[0] * 100; let dur = sound.duration(); let shape = new GeneratedShape(sound, amp, dur); @@ -123,7 +123,7 @@ function gardenShapes() { shapes.push(shape); }); }) - .catch(function(error) { + .catch(function (error) { console.log( "Retrieving single recording from archive failed!", "Received the following message:", @@ -131,7 +131,7 @@ function gardenShapes() { ); }); }) - .catch(function(error) { + .catch(function (error) { console.log( "Retrieving archive listing failed!", "Received the following message:", @@ -391,7 +391,7 @@ class GeneratedShape { color("#CC3D25"), color("#A3614E"), color("#F0DBA9"), - color("#7C4531") + color("#7C4531"), ]; let index = floor(random(0, colourChoices.length)); @@ -533,7 +533,7 @@ function draw() { // build a new copy of the recording to store on the shape object let soundBlob = recording.getBlob(); let data = new p5.File(soundBlob); - let sound = new p5.SoundFile(data, function() { + let sound = new p5.SoundFile(data, function () { let amp = sound.getPeaks(1)[0] * 100; let dur = sound.duration(); let shape = new GeneratedShape(sound, amp, dur); From d2bf28166f32380b30390848b20b9c53a99a7dad Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 27 May 2021 20:34:24 +0200 Subject: [PATCH 2/2] More sysadmin docs --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index e121015..4fc0745 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,28 @@ server { } ``` +You will also need to include the following in the `/etc/nginx/nginx.conf`: + +``` +client_max_body_size 100M; +``` + +And you'll need to create user accounts and hand out the right permissions too: + +``` +$ useradd -m voicegardens -s /bin/bash +$ usermod -a -G sudo voicegardens +$ usermod -a -G www-data voicegardens +$ chgrp www-data /var/www/voicegardens.org/voicegardens/archive/ +$ chmod g+rwxs /var/www/offline.voicegardens.org/voicegardens/archive/ +``` + +And the following in the `/etc/sudoers` file also: + +``` +voicegardens ALL=(ALL) NOPASSWD: ALL +``` + ## Layers of the Onion - [Flask](http://flask.palletsprojects.com/en/1.1.x/)