[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: fix links placeholder replacement
From: |
gnunet |
Subject: |
[libeufin] branch master updated: fix links placeholder replacement |
Date: |
Tue, 19 Apr 2022 13:59:15 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 93699fc0 fix links placeholder replacement
93699fc0 is described below
commit 93699fc09b770500c832f3fedf27d9285e006262
Author: ms <ms@taler.net>
AuthorDate: Tue Apr 19 13:58:59 2022 +0200
fix links placeholder replacement
---
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 31 ++++++++--------------
sandbox/src/main/resources/static/spa.html | 2 +-
2 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index e1a981a6..8fbee355 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -74,10 +74,7 @@ import org.slf4j.LoggerFactory
import org.w3c.dom.Document
import startServer
import tech.libeufin.util.*
-import java.io.ByteArrayInputStream
-import java.io.ByteArrayOutputStream
-import java.io.IOException
-import java.io.StringWriter
+import java.io.*
import java.lang.StringBuilder
import java.math.BigDecimal
import java.net.BindException
@@ -968,33 +965,27 @@ val sandboxApp: Application.() -> Unit = {
* Respond the SPA if the content type is not "application/json".
*/
if (call.request.headers["Content-Type"] != "application/json") {
- val spa =
ClassLoader.getSystemClassLoader().getResourceAsStream("static/spa.html")
+ val spa: InputStream? =
ClassLoader.getSystemClassLoader().getResourceAsStream("static/spa.html")
if (spa == null) throw internalServerError("SPA not found!")
-
- // load whole SPA from disk. Now <200KB, so fine to
block-reading it.
- val builder = StringBuilder()
- var buf: Int = spa.read();
- while (buf != -1) {
- builder.append(buf)
- buf = spa.read()
- }
- val content = builder.toString()
+ // load whole SPA from disk. Now <200KB, fine to block-read
it.
+ var content = String(spa.readBytes())
val landingUrl = System.getenv(
"TALER_ENV_URL_INTRO") ?: "https://demo.taler.net/"
- content.replace("%DEMO_SITE_LANDING_URL%", landingUrl)
+ content = content.replace("%DEMO_SITE_LANDING_URL%",
landingUrl)
val bankUrl = System.getenv(
"TALER_ENV_URL_BANK") ?:
"https://demo.taler.net/sandbox/demobanks/default/"
- content.replace("%DEMO_SITE_BANK_URL%", bankUrl)
+ content = content.replace("%DEMO_SITE_BANK_URL%", bankUrl)
val blogUrl = System.getenv(
"TALER_ENV_URL_MERCHANT_BLOG") ?:
"https://demo.taler.net/blog/"
- content.replace("%DEMO_SITE_BLOG_URL%", blogUrl)
+ content = content.replace("%DEMO_SITE_BLOG_URL%", blogUrl)
val donationsUrl = System.getenv(
"TALER_ENV_URL_MERCHANT_DONATIONS") ?:
"https://demo.taler.net/donations/"
- content.replace("%DEMO_SITE_MERCHANT_DONATIONS%", donationsUrl)
+ content = content.replace("%DEMO_SITE_MERCHANT_DONATIONS%",
donationsUrl)
val surveyUrl = System.getenv(
"TALER_ENV_URL_MERCHANT_SURVEY") ?:
"https://demo.taler.net/survey/"
- content.replace("%DEMO_SITE_MERCHANT_SURVEY%", surveyUrl)
- call.respondText(content)
+ content = content.replace("%DEMO_SITE_MERCHANT_SURVEY%",
surveyUrl)
+ logger.debug("after links replacement + $content")
+ call.respondText(content, ContentType.Text.Html)
return@get
}
expectAdmin(call.request.basicAuth())
diff --git a/sandbox/src/main/resources/static/spa.html
b/sandbox/src/main/resources/static/spa.html
index b12fcd5d..cf0cd8b6 100644
--- a/sandbox/src/main/resources/static/spa.html
+++ b/sandbox/src/main/resources/static/spa.html
@@ -6,4 +6,4 @@ https://github.com/yahoo/pure/blob/master/LICENSE.md
*//*!
normalize.css v^3.0 | MIT License | git.io/normalize
Copyright (c) Nicolas Gallagher and Jonathan Neal
-*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css
*/html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[
[...]
\ No newline at end of file
+*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css
*/html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[
[...]
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated: fix links placeholder replacement,
gnunet <=