Add http:// to target if it is not exist
This commit is contained in:
10
src/app.ts
10
src/app.ts
@ -8,7 +8,15 @@ const app = express();
|
||||
app.use(morgan('common'))
|
||||
|
||||
app.get('/*', async (req, res) => {
|
||||
const target = req.url.slice(1);
|
||||
const rawTarget = req.url.slice(1);
|
||||
|
||||
let target: string;
|
||||
if (!rawTarget.includes('://')) {
|
||||
target = 'http://' + rawTarget;
|
||||
}
|
||||
else {
|
||||
target = rawTarget;
|
||||
}
|
||||
|
||||
const location = await getLocationOfTarget(target);
|
||||
if (location) {
|
||||
|
Reference in New Issue
Block a user