2019-09-27 19:49:30 +00:00
|
|
|
import { tall } from 'tall';
|
|
|
|
|
|
|
|
|
|
|
|
export default function (context) {
|
|
|
|
return tall(process.env.SHORTENER_BASE+context.route.path).then(function(unshortenedUrl) {
|
2019-09-28 09:45:11 +00:00
|
|
|
if(unshortenedUrl == process.env.SHORTENER_BASE) {
|
2019-09-28 11:00:59 +00:00
|
|
|
context.error({ statusCode: 404, message: "The page cannot be found"});
|
|
|
|
} else {
|
|
|
|
context.redirect(unshortenedUrl);
|
2019-09-28 09:45:11 +00:00
|
|
|
}
|
2019-09-27 19:49:30 +00:00
|
|
|
});
|
|
|
|
// context.redirect("https://nanao.moe");
|
|
|
|
}
|