diff --git a/backend/src/langs.ts b/backend/src/langs.ts index 34223a2..586a0b5 100644 --- a/backend/src/langs.ts +++ b/backend/src/langs.ts @@ -37,7 +37,7 @@ int main() { } `, }, - "c++": { + cpp: { name: "C++", monacoLang: "cpp", main: "main.cpp", @@ -49,6 +49,27 @@ int main() { std::cout << "Hello, world!" << std::endl; return 0; } +`, + }, + crystal: { + name: "Crystal", + monacoLang: "plaintext", + main: "main.cr", + run: "crystal main.cr", + template: `puts "Hello, world!" +`, + }, + csharp: { + name: "C#", + monacoLang: "csharp", + main: "main.cs", + compile: "mcs main.cs", + run: "./main.exe", + template: `class main { + static void Main(string[] args) { + System.Console.WriteLine("Hello, world!"); + } +} `, }, clojure: { @@ -58,6 +79,15 @@ int main() { main: "main.clj", run: "clojure -i main.clj -r", template: `(println "Hello, world!") +`, + }, + elixir: { + name: "Elixir", + monacoLang: "plaintext", + repl: "iex", + main: "main.exs", + run: "iex main.exs", + template: `IO.puts("Hello, world!") `, }, emacs: { @@ -76,6 +106,15 @@ int main() { main: "main.fish", run: 'fish -C "$(< main.fish)"', template: `echo "Hello, world!" +`, + }, + fsharp: { + name: "F#", + monacoLang: "fsharp", + repl: "fsharpi", + main: "main.fsx", + run: "fsharpi --use:main.fsx", + template: `printfn "Hello, world!" `, }, go: { @@ -126,6 +165,15 @@ main = putStrLn "Hello, world!" main: "main.jl", run: "julia -L main.jl", template: `println("Hello, world!") +`, + }, + kotlin: { + name: "Kotlin", + monacoLang: "kotlin", + repl: "kotlinc", + main: "main.kts", + run: "kotlinc -script main.kts; kotlinc", + template: `println("Hello, world!") `, }, lua: { @@ -156,6 +204,15 @@ require("repl").start(); main: "main.py", run: "python3 -u -i main.py", template: `print("Hello, world!") +`, + }, + r: { + name: "R", + monacoLang: "r", + repl: "R", + main: ".Rprofile", + run: "R --no-save", + template: `print("Hello, world!") `, }, ruby: { @@ -183,6 +240,26 @@ binding_irb.run(IRB.conf) template: `fn main() { println!("Hello, world!"); } +`, + }, + scheme: { + name: "Scheme", + monacoLang: "scheme", + repl: "mit-scheme", + main: "main.scm", + run: "mit-scheme --load main.scm", + template: `(begin + (display "Hello, world!") + (newline)) +`, + }, + swift: { + name: "Swift", + monacoLang: "swift", + main: "main.swift", + compile: "swiftc main.swift", + run: "./main", + template: `print("Hello, world!") `, }, vim: { diff --git a/backend/src/server.ts b/backend/src/server.ts index 981276e..8abea8f 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -25,9 +25,6 @@ app.use(sslRedirect()); app.get("/", (_, res) => { res.sendFile(appRoot.path + "/frontend/pages/index.html"); }); -app.get("/cpp", (_, res) => { - res.redirect("/c++"); -}); app.get("/:lang", (req, res) => { if (langs[req.params.lang]) { res.sendFile(appRoot.path + "/frontend/pages/app.html"); diff --git a/scripts/docker-install.bash b/scripts/docker-install.bash index 82f3f6a..07de95d 100755 --- a/scripts/docker-install.bash +++ b/scripts/docker-install.bash @@ -12,14 +12,23 @@ uid="$1" export DEBIAN_FRONTEND=noninteractive apt-get update -apt-get install -y curl gnupg lsb-release +apt-get install -y apt-transport-https curl gnupg lsb-release rm -rf /var/lib/apt/lists/* -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - +curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - +curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +curl -sSL https://keybase.io/crystal/pgp_keys.asc | apt-key add - +apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 + +cd /tmp +wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb +dpkg -i packages-microsoft-prod.deb +rm packages-microsoft-prod.deb tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<"EOF" +deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ deb https://deb.nodesource.com/node_14.x focal main +deb https://dist.crystal-lang.org/apt crystal main deb https://dl.yarnpkg.com/debian/ stable main deb-src https://deb.nodesource.com/node_14.x EOF @@ -53,12 +62,24 @@ bash # C/C++ clang +# C# +mono-mcs + # Clojure clojure +# Crystal +crystal + +# Elixir +elixir + # Emacs Lisp emacs-nox +# F# +fsharp + # Fish fish @@ -87,12 +108,21 @@ python3 python3-pip python3-venv +# R +r-base + # Ruby ruby # Rust rustc +# Scheme +mit-scheme + +# Swift +libpython2.7 + # Vimscript vim @@ -111,6 +141,20 @@ wget -nv https://github.com/watchexec/watchexec/releases/download/1.13.1/watchex dpkg -i watchexec-*.deb rm watchexec-*.deb +cd /tmp +wget -nv https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip +unzip kotlin-*.zip +cp kotlinc/bin/* /usr/bin/ +cp kotlinc/lib/* /usr/lib/ +rm -rf kotlin-*.zip kotlinc + +cd /tmp +wget -nv https://swift.org/builds/swift-5.2.4-release/ubuntu2004/swift-5.2.4-RELEASE/swift-5.2.4-RELEASE-ubuntu20.04.tar.gz +mkdir /opt/swift +tar -xf swift-*.tar.gz -C /opt/swift --strip-components=2 +ln -s /opt/swift/bin/swiftc /usr/bin/swiftc +rm swift-*.tar.gz + if (( "$uid" != 0 )); then useradd --uid="$uid" --create-home --groups sudo docker passwd -d docker