diff options
author | Minteck <contact@minteck.org> | 2022-04-14 14:31:16 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-04-14 14:31:16 +0200 |
commit | a3b43b7e79252653c5d3848747e1a45ae3230a75 (patch) | |
tree | 8361bf1a9ccec35d45e66ec18afec3c2afb5e39a | |
parent | f0c319e7bd7cc3554bfdd8e3e2df74d5c47fe838 (diff) | |
download | rainbow-a3b43b7e79252653c5d3848747e1a45ae3230a75.tar.gz rainbow-a3b43b7e79252653c5d3848747e1a45ae3230a75.tar.bz2 rainbow-a3b43b7e79252653c5d3848747e1a45ae3230a75.zip |
Detect user language
-rw-r--r-- | .DS_Store | bin | 8196 -> 0 bytes | |||
-rw-r--r-- | .idea/discord.xml | 7 | ||||
-rw-r--r-- | server/http.js | 7 | ||||
-rw-r--r-- | snowjail.yml | 56 |
4 files changed, 69 insertions, 1 deletions
diff --git a/.DS_Store b/.DS_Store Binary files differdeleted file mode 100644 index 59ea9b0..0000000 --- a/.DS_Store +++ /dev/null diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="DiscordProjectSettings"> + <option name="show" value="PROJECT_FILES" /> + <option name="description" value="" /> + </component> +</project>
\ No newline at end of file diff --git a/server/http.js b/server/http.js index 5e2df58..a9a4358 100644 --- a/server/http.js +++ b/server/http.js @@ -55,8 +55,13 @@ module.exports.start = function () { log.verbose("request: " + address + "; " + req.url) - // TODO: Detect user language let dlang = "en"; + try { + dlang = req.headers["accept-language"].substring(0, 2); + if (typeof dlang !== "string") dlang = "en"; + } catch (e) { + dlang = "en"; + } frhtml = false; ejs = false; diff --git a/snowjail.yml b/snowjail.yml new file mode 100644 index 0000000..315921e --- /dev/null +++ b/snowjail.yml @@ -0,0 +1,56 @@ +# ____ _ _ _ +# / ___| _ __ _____ _(_) __ _(_) | +# \___ \| '_ \ / _ \ \ /\ / / |/ _` | | | +# ___) | | | | (_) \ V V /| | (_| | | | +# |____/|_| |_|\___/ \_/\_/_/ |\__,_|_|_| +# |__/ +# +# Snowjail Default Configuration File +# generated by Snowjail version 0.1.0 + +# Number of CPU cores that the jailed application is allowed to use. +# 2.5 would allow the application to entirely use 2 cores and use half another core +# Use -1 to allow full CPU usage +cpu: -1 + +# In megabytes, the maximum RAM the jailed application can use. +# The application will be killed if it tries to use more memory than allowed. +# Use -1 to allow full RAM usage +ram: -1 + +# Whether the RAM limit (set in the option above) should be enforced. +# When disabled, memory requests MAY be denied but will not always be denied +enforce_ram: false + +# In megabytes, the maximum swap memory the jailed application can use. +# The application will be killed if it tries to use more swap than allowed and the memory is full. +# Use -1 to allow full swap usage (as much as the host system allows) +swap: -1 + +# Whether allow writing to the application's directory or not +# Make sure your application supports running from a read-only directory before disabling this option +readwrite: true + +# Whether allow this application to access the system's hardware or not. +# This WILL reduce security as it can be used to bypass jailing +hardware: false + +# The base Docker image to be used for the jail. +# Snowjail recommends using 'ubuntu:latest' +image: ubuntu:latest + +# An array of commands to execute once the jail is running. +# Command is an array of arguments. +# Index 0 is the command, index 1 and onwards are arguments. +# The jail will be destroyed once the last command is terminated. +commands: + - ["apt-get", "update", "-y"] + - ["apt-get", "install", "-y", "curl"] + - ["bash", "-c", "curl -fsSL https://deb.nodesource.com/setup_17.x | bash -"] + - ["apt-get", "install", "-y", "nodejs"] + - ["bash", "-c", "cd /snowjail/* && node index.js"] + +# Ports to forward to the host. +# The left part is port on the host, the right part is port on the guest +ports: + - 8081:8081 |