mirror of
https://github.com/bitinflow/server.git
synced 2026-03-13 13:35:53 +00:00
bump length of subdomain to 10
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
|
// all url safe
|
||||||
|
// can't use uppercase because hostnames are lowercased
|
||||||
|
var chars = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
||||||
var chars = 'abcdefghiklmnopqrstuvwxyz';
|
|
||||||
module.exports = function rand_id() {
|
module.exports = function rand_id() {
|
||||||
var randomstring = '';
|
var randomstring = '';
|
||||||
for (var i=0; i<4; ++i) {
|
for (var i=0; i<10; ++i) {
|
||||||
var rnum = Math.floor(Math.random() * chars.length);
|
var rnum = Math.floor(Math.random() * chars.length);
|
||||||
randomstring += chars[rnum];
|
randomstring += chars[rnum];
|
||||||
}
|
}
|
||||||
|
|
||||||
return randomstring;
|
return randomstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function maybe_bounce(req, res, bounce) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var match = hostname.match(/^([a-z]{4})[.].*/);
|
var match = hostname.match(/^([a-z0-9]{4,10})[.].*/);
|
||||||
|
|
||||||
// not for a specific client
|
// not for a specific client
|
||||||
// pass on to regular server
|
// pass on to regular server
|
||||||
@@ -180,7 +180,7 @@ module.exports = function(opt) {
|
|||||||
app.get('/:req_id', function(req, res, next) {
|
app.get('/:req_id', function(req, res, next) {
|
||||||
var req_id = req.param('req_id');
|
var req_id = req.param('req_id');
|
||||||
|
|
||||||
if (! /[a-z]{4}/.test(req_id)) {
|
if (! /[A-Za-z0-9]{4,10}/.test(req_id)) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user