Skip to content

Commit

Permalink
dev and run domains configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pmgl committed Sep 13, 2022
1 parent 5df4a19 commit b003aae
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 27 deletions.
7 changes: 7 additions & 0 deletions server/webapp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class @WebApp
@app.get new RegExp(home_exp), (req,res)=>
return if @ensureDevArea(req,res)

dev_domain = if @server.config.dev_domain then "'#{@server.config.dev_domain}'" else "location.origin"
run_domain = if @server.config.run_domain then "'#{@server.config.run_domain}'" else "location.origin.replace('.dev','.io')"

lang = @getLanguage(req)
for l in @languages
if req.path == "/#{l}" or req.path == "/#{l}/"
Expand Down Expand Up @@ -107,6 +110,8 @@ class @WebApp
long_description: project.description
poster: if project.files? and project.files["sprites/poster.png"]? then "https://microstudio.io/#{user.nick}/#{project.slug}/sprites/poster.png" else "https://microstudio.io/#{user.nick}/#{project.slug}/sprites/icon.png"
project_moderation: @server.config.project_moderation == true
dev_domain: dev_domain
run_domain: run_domain

return res.send page
else if not @home_page[lang]? or not @server.use_cache
Expand All @@ -128,6 +133,8 @@ class @WebApp
long_description: translator.get("microStudio is a free game engine online. Learn, create and share with the community. Use the built-in sprite editor, map editor and code editor to create anything.")
poster: "https://microstudio.dev/img/microstudio.jpg"
project_moderation: @server.config.project_moderation == true
dev_domain: dev_domain
run_domain: run_domain

res.send @home_page[lang]

Expand Down
12 changes: 9 additions & 3 deletions server/webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ this.WebApp = (function() {
console.info("home_exp = " + home_exp);
this.app.get(new RegExp(home_exp), (function(_this) {
return function(req, res) {
var l, lang, len2, n, page, project, ref3, s, translator, user;
var dev_domain, l, lang, len2, n, page, project, ref3, run_domain, s, translator, user;
if (_this.ensureDevArea(req, res)) {
return;
}
dev_domain = _this.server.config.dev_domain ? "'" + _this.server.config.dev_domain + "'" : "location.origin";
run_domain = _this.server.config.run_domain ? "'" + _this.server.config.run_domain + "'" : "location.origin.replace('.dev','.io')";
lang = _this.getLanguage(req);
ref3 = _this.languages;
for (n = 0, len2 = ref3.length; n < len2; n++) {
Expand Down Expand Up @@ -119,7 +121,9 @@ this.WebApp = (function() {
description: project.description,
long_description: project.description,
poster: (project.files != null) && (project.files["sprites/poster.png"] != null) ? "https://microstudio.io/" + user.nick + "/" + project.slug + "/sprites/poster.png" : "https://microstudio.io/" + user.nick + "/" + project.slug + "/sprites/icon.png",
project_moderation: _this.server.config.project_moderation === true
project_moderation: _this.server.config.project_moderation === true,
dev_domain: dev_domain,
run_domain: run_domain
});
return res.send(page);
} else if ((_this.home_page[lang] == null) || !_this.server.use_cache) {
Expand All @@ -139,7 +143,9 @@ this.WebApp = (function() {
description: translator.get("Learn programming, create video games - microStudio is a free game engine online."),
long_description: translator.get("microStudio is a free game engine online. Learn, create and share with the community. Use the built-in sprite editor, map editor and code editor to create anything."),
poster: "https://microstudio.dev/img/microstudio.jpg",
project_moderation: _this.server.config.project_moderation === true
project_moderation: _this.server.config.project_moderation === true,
dev_domain: dev_domain,
run_domain: run_domain
});
}
return res.send(_this.home_page[lang]);
Expand Down
1 change: 1 addition & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ header .username span {
.about img {
width: 150px ;
vertical-align: middle ;
margin-bottom: 6px ;
}
.about a {
text-decoration: none ;
Expand Down
10 changes: 6 additions & 4 deletions static/doc/en/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ Created by Gilles Pommereuil in Strasbourg, France

Published by:

Neuronality SARL<br/>
2 Chemin des Rochers<br/>
67120 MOLSHEIM<br/>
![microStudio](/img/microstudiologo.svg "microStudio")<br/>
2 rue Schwilgué<br/>
67000 Strasbourg<br/>
FRANCE

Siret: R.C.S. Saverne TI 808 517 858<br/>
SIRET 423 577 634 00037<br />

Sponsored by:

[![Neuronality](/img/neuronality.svg "Neuronality")](https://www.neuronality.com)
10 changes: 6 additions & 4 deletions static/doc/fr/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ Créé par Gilles Pommereuil à Strasbourg, France

Edité par :

Neuronality SARL<br/>
2 Chemin des Rochers<br/>
67120 MOLSHEIM<br/>
![microStudio](/img/microstudiologo.svg "microStudio")<br/>
2 rue Schwilgué<br/>
67000 Strasbourg<br/>
FRANCE

Siret: R.C.S. Saverne TI 808 517 858<br/>
SIRET 423 577 634 00037<br/>

Sponsor :

[![Neuronality](/img/neuronality.svg "Neuronality")](https://www.neuronality.com)
14 changes: 8 additions & 6 deletions static/doc/it/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Sostieni microStudio su Patreon e ottieni ricompense esclusive!

Molte grazie a tutti i collaboratori e specialmente ai nostri meravigliosi fondatori: Steven Landman, Code Club France

Grazie mille ai nostri fantastici traduttori:
* FeniXb3 (per il Polacco)
Grazie mille ai nostri fantastici traduttori:
* FeniXb3 (per il Polacco)
* TinkerSmith (per il Tedesco)
* HomineLudens (per l'Italiano)

Expand All @@ -27,11 +27,13 @@ Creato da Gilles Pommereuil a Strasburgo, Francia

Pubblicato da:

Neuronality SARL<br/>
2 Chemin des Rochers<br/>
67120 MOLSHEIM<br/>
![microStudio](/img/microstudiologo.svg "microStudio")<br/>
2 rue Schwilgué<br/>
67000 Strasbourg<br/>
FRANCE

Siret: R.C.S. Saverne TI 808 517 858<br/>
SIRET 423 577 634 00037<br/>

Sponsor :

[![Neuronality](/img/neuronality.svg "Neuronality")](https://www.neuronality.com)
12 changes: 7 additions & 5 deletions static/doc/pt/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ Criado por Gilles Pommereuil em Estrasburgo, França.

Publicado por:

Neuronality SARL<br/>
2 Chemin des Rochers<br/>
67120 MOLSHEIM<br/>
FRANÇA
![microStudio](/img/microstudiologo.svg "microStudio")<br/>
2 rue Schwilgué<br/>
67000 Strasbourg<br/>
FRANCE

Siret: R.C.S. Saverne TI 808 517 858<br/>
SIRET 423 577 634 00037<br />

Patrocinador:

[![Neuronality](/img/neuronality.svg "Neuronality")](https://www.neuronality.com)
12 changes: 7 additions & 5 deletions static/doc/ru/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@

Опубликовано:

Neuronality SARL<br/>
2 Chemin des Rochers<br/>
67120 MOLSHEIM<br/>
![microStudio](/img/microstudiologo.svg "microStudio")<br/>
2 rue Schwilgué<br/>
67000 Strasbourg<br/>
FRANCE

Siret: R.C.S. Saverne TI 808 517 858<br/>
SIRET 423 577 634 00037<br />

[![Neuronality](/img/neuronality.svg "Neuronality")](https://www.neuronality.com)
Спонсор:

[![Neuronality](/img/neuronality.svg "Neuronality")](https://www.neuronality.com)
2 changes: 2 additions & 0 deletions templates/home.pug
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ html(lang=language)
window.ms_standalone = !{standalone} ;
window.ms_project_moderation = !{project_moderation} ;
window.translation = !{translation};
window.dev_domain = !{dev_domain} ;
window.run_domain = !{run_domain} ;

each js in javascript_files
script(src=js)
Expand Down

0 comments on commit b003aae

Please sign in to comment.