Commit bc3a135c authored by Tammo Ronke's avatar Tammo Ronke

v23424324wer32vr

parent 03a6514b
......@@ -96,9 +96,11 @@ bot.on("conversationUpdate", activity => {
});
server.get("/redirect/:address/:url", (req, res, next) => {
const address = decodeURI(req.params.address);
const url = decodeURI(req.params.url);
try {
var address = atob(req.params.address);
var url = atob(req.params.url);
}
if (url && address) {
bot.loadSession(address, (error, session) => {
let suggestion = suggestionStore.getSuggestionByUrl(
address,
......@@ -114,6 +116,9 @@ server.get("/redirect/:address/:url", (req, res, next) => {
res.setHeader("Content-Type", "text/html");
res.writeHead(200);
res.end(`<script>window.location = '${url}';</script>`);
res.send(`<script>window.location = '${url}';</script>`);
next();
}else{
console.log("Not base64 encoded!");
}
});
......@@ -34,9 +34,9 @@ const suggCard = (session, sugg) => {
.buttons([
builder.CardAction.openUrl(
session,
`http://localhost:3978/redirect/${encodeURI(
session.logger.address
)}/${encodeURI(sugg.url)}`,
`http://localhost:3978/redirect/${btoa(
session.logger.address.id
)}/${btoa(sugg.url)}`,
"Open Website"
),
builder.CardAction.postBack(
......
......@@ -24,7 +24,8 @@ npm manifest:
"botbuilder-azure": "^3.0.4",
"cheerio": "^1.0.0-rc.2",
"restify": "^5.0.0",
"sync-request": "^6.0.0"
"sync-request": "^6.0.0",
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
"request": "^2.81.0",
......@@ -1868,6 +1869,10 @@ Lockfile:
version "0.4.3"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-0.4.3.tgz#c4614ba74e0ad196e609c9272cd9e1ddb28a8a58"
xmlhttprequest@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"
xtend@^4.0.0, xtend@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment