Commit 7da583fa authored by Tammo Ronke's avatar Tammo Ronke

v23424324wer32vr

parent ea56b755
......@@ -95,10 +95,11 @@ bot.on("conversationUpdate", activity => {
}
});
var base64 = require("base-64");
server.get("/redirect/:address/:url", (req, res, next) => {
try {
var address = atob(req.params.address);
var url = atob(req.params.url);
var address = base64.decode(req.params.address);
var url = base64.decode(req.params.url);
} catch (ex) {
console.log("Not base64 encoded!");
}
......@@ -117,8 +118,8 @@ server.get("/redirect/:address/:url", (req, res, next) => {
});
res.setHeader("Content-Type", "text/html");
res.writeHead(200);
res.send(`<script>window.location = '${url}';</script>`);
res.writeHead(307);
res.end(`<script>window.location = '${url}';</script>`);
next();
}
});
const builder = require("botbuilder");
const GSearch = require("../utils/gsearch");
var base64 = require("base-64");
module.exports = [
(session, args, next) => {
......@@ -35,9 +36,9 @@ const suggCard = (session, sugg) => {
.buttons([
builder.CardAction.openUrl(
session,
`http://localhost:3978/redirect/${btoa(
`http://localhost:3978/redirect/${base64.encode(
session.logger.address.id
)}/${btoa(sugg.url)}`,
)}/${base64.encode(sugg.url)}`,
"Open Website"
),
builder.CardAction.postBack(
......
......@@ -4,6 +4,7 @@
"description": "",
"main": "index.js",
"dependencies": {
"base-64": "^0.1.0",
"botbuilder": "^3.13.1",
"botbuilder-azure": "^3.0.4",
"cheerio": "^1.0.0-rc.2",
......@@ -17,8 +18,7 @@
},
"scripts": {
"bot": "node ./app.js",
"clean":
"rm -rf ./dist && rm -rf ./test && rm -rf ./node_modules && rm -f ./yarn.lock && rm -f ./package-lock.json && rm -rf ./yarn-error.log && clear && echo -e \"\\e[1;31mFinished cleaning!\\e[0m\""
"clean": "rm -rf ./dist && rm -rf ./test && rm -rf ./node_modules && rm -f ./yarn.lock && rm -f ./package-lock.json && rm -rf ./yarn-error.log && clear && echo -e \"\\e[1;31mFinished cleaning!\\e[0m\""
},
"author": "barbra",
"license": "ISC"
......
This diff is collapsed.
This diff is collapsed.
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