Fixes at Xaekai's request
This commit is contained in:
parent
c8684d58ed
commit
7b00ba10b9
2 changed files with 48 additions and 44 deletions
|
|
@ -148,54 +148,53 @@ OptionsModule.prototype.handleSetOptions = function (user, data) {
|
|||
var link = (""+data.externalcss).substring(0, 255);
|
||||
if (!link) {
|
||||
this.opts.externalcss = "";
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var data = url.parse(link);
|
||||
if (!data.protocol || !data.protocol.match(/^(https?|ftp):/)) {
|
||||
throw "Unacceptable protocol " + data.protocol;
|
||||
} else if (!data.host) {
|
||||
throw "URL is missing host";
|
||||
} else {
|
||||
link = data.href;
|
||||
} else {
|
||||
try {
|
||||
var data = url.parse(link);
|
||||
if (!data.protocol || !data.protocol.match(/^(https?|ftp):/)) {
|
||||
throw "Unacceptable protocol " + data.protocol;
|
||||
} else if (!data.host) {
|
||||
throw "URL is missing host";
|
||||
} else {
|
||||
link = data.href;
|
||||
}
|
||||
} catch (e) {
|
||||
user.socket.emit("errorMsg", {
|
||||
msg: "Invalid URL for external CSS: " + e,
|
||||
alert: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
user.socket.emit("errorMsg", {
|
||||
msg: "Invalid URL for external CSS: " + e,
|
||||
alert: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.opts.externalcss = link;
|
||||
this.opts.externalcss = link;
|
||||
}
|
||||
}
|
||||
|
||||
if ("externaljs" in data && user.account.effectiveRank >= 3) {
|
||||
var link = (""+data.externaljs).substring(0, 255);
|
||||
if (!link) {
|
||||
this.opts.externaljs = "";
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
try {
|
||||
var data = url.parse(link);
|
||||
if (!data.protocol || !data.protocol.match(/^(https?|ftp):/)) {
|
||||
throw "Unacceptable protocol " + data.protocol;
|
||||
} else if (!data.host) {
|
||||
throw "URL is missing host";
|
||||
} else {
|
||||
link = data.href;
|
||||
try {
|
||||
var data = url.parse(link);
|
||||
if (!data.protocol || !data.protocol.match(/^(https?|ftp):/)) {
|
||||
throw "Unacceptable protocol " + data.protocol;
|
||||
} else if (!data.host) {
|
||||
throw "URL is missing host";
|
||||
} else {
|
||||
link = data.href;
|
||||
}
|
||||
} catch (e) {
|
||||
user.socket.emit("errorMsg", {
|
||||
msg: "Invalid URL for external JS: " + e,
|
||||
alert: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
user.socket.emit("errorMsg", {
|
||||
msg: "Invalid URL for external JS: " + e,
|
||||
alert: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.opts.externaljs = link;
|
||||
this.opts.externaljs = link;
|
||||
}
|
||||
}
|
||||
|
||||
if ("chat_antiflood" in data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue