From b1a00382a33f0572ac04f5ebb2e33394d77704c2 Mon Sep 17 00:00:00 2001 From: obadrawi <42137180+obadrawi@users.noreply.github.com> Date: Thu, 14 Mar 2019 09:32:55 +0100 Subject: [PATCH] Release v0.1 (#155) * adding logo to title (#149) * adding logo to the title (Issue #147 ) * v0.1.0 --- app-connector-client/package.json | 6 +++--- app-connector-client/server/app.js | 8 ++++++-- app-connector-client/server/config.js | 3 +++ app-connector-client/server/views/index.ejs | 5 +++-- app-connector-client/test/varkes_config.json | 1 + examples/combined-odata-mock/package.json | 8 ++++---- examples/combined-openapi-mock/package.json | 8 ++++---- examples/kyma-mock/package.json | 6 +++--- examples/odata-mock/package.json | 6 +++--- examples/openapi-mock/package.json | 6 +++--- examples/stress-mock/package.json | 10 +++++----- lerna.json | 2 +- odata-mock/package.json | 2 +- openapi-mock/package.json | 2 +- 14 files changed, 41 insertions(+), 32 deletions(-) diff --git a/app-connector-client/package.json b/app-connector-client/package.json index 07831446..6f8aeaaf 100644 --- a/app-connector-client/package.json +++ b/app-connector-client/package.json @@ -1,6 +1,6 @@ { "name": "@varkes/app-connector-client", - "version": "0.0.0", + "version": "0.1.0", "description": "Client for Kyma application connectivity", "main": "server/app.js", "scripts": { @@ -30,7 +30,7 @@ "winston": "^3.2.1" }, "devDependencies": { - "@varkes/example-kyma-mock": "^0.0.0", + "@varkes/example-kyma-mock": "^0.1.0", "mocha": "^6.0.2", "nyc": "^13.3.0", "supertest": "^3.4.2" @@ -43,4 +43,4 @@ "varkes-connector-cli": "./tools/cli.js", "varkes-connector-server": "./server/server.js" } -} \ No newline at end of file +} diff --git a/app-connector-client/server/app.js b/app-connector-client/server/app.js index 4b546a79..3e0add1a 100644 --- a/app-connector-client/server/app.js +++ b/app-connector-client/server/app.js @@ -13,7 +13,7 @@ const connector = require("./routes/connector"); const events = require("./routes/events") var apis = require("./routes/apis") var keys = require("./keys") - +const VARKES_LOGO = path.resolve(__dirname, 'views/static/logo.svg') module.exports = function (varkesConfigPath = null, nodePortParam = null) { var app = express() app.use(bodyParser.json()); @@ -36,7 +36,11 @@ module.exports = function (varkesConfigPath = null, nodePortParam = null) { app.get("/", function (req, res) { res.render('index', { appName: varkesConfig.name }) }) - + app.get("/logo", function (req, res) { + var img = fs.readFileSync(varkesConfig.logo || VARKES_LOGO); + res.writeHead(200, { 'Content-Type': "image/svg+xml" }); + res.end(img, 'binary'); + }); app.get("/metadata", function (req, res) { res.sendFile(path.resolve(__dirname, "resources/api.yaml")) }) diff --git a/app-connector-client/server/config.js b/app-connector-client/server/config.js index 54b4c220..d9bc2c13 100644 --- a/app-connector-client/server/config.js +++ b/app-connector-client/server/config.js @@ -56,6 +56,9 @@ function configValidation(configJson) { } } } + if (configJson.logo && !configJson.logo.match(/^.+\.(svg)$/)) { + error_message += "\nlogo image must be in svg format" + } if (error_message != "") { throw new Error("Validation of configuration failed: " + error_message); } diff --git a/app-connector-client/server/views/index.ejs b/app-connector-client/server/views/index.ejs index e148b4c4..2faf714c 100644 --- a/app-connector-client/server/views/index.ejs +++ b/app-connector-client/server/views/index.ejs @@ -21,8 +21,9 @@