mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
api: drop JSONP (#4835)
* api: drop JSONP * docs: drop JSONP * tests: drop JSONP * api: remove isValidJSONPName require
This commit is contained in:
parent
85231cb774
commit
0f16e518ff
4 changed files with 0 additions and 109 deletions
|
@ -1,85 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const RESERVED_WORDS = [
|
||||
'abstract',
|
||||
'arguments',
|
||||
'await',
|
||||
'boolean',
|
||||
'break',
|
||||
'byte',
|
||||
'case',
|
||||
'catch',
|
||||
'char',
|
||||
'class',
|
||||
'const',
|
||||
'continue',
|
||||
'debugger',
|
||||
'default',
|
||||
'delete',
|
||||
'do',
|
||||
'double',
|
||||
'else',
|
||||
'enum',
|
||||
'eval',
|
||||
'export',
|
||||
'extends',
|
||||
'false',
|
||||
'final',
|
||||
'finally',
|
||||
'float',
|
||||
'for',
|
||||
'function',
|
||||
'goto',
|
||||
'if',
|
||||
'implements',
|
||||
'import',
|
||||
'in',
|
||||
'instanceof',
|
||||
'int',
|
||||
'interface',
|
||||
'let',
|
||||
'long',
|
||||
'native',
|
||||
'new',
|
||||
'null',
|
||||
'package',
|
||||
'private',
|
||||
'protected',
|
||||
'public',
|
||||
'return',
|
||||
'short',
|
||||
'static',
|
||||
'super',
|
||||
'switch',
|
||||
'synchronized',
|
||||
'this',
|
||||
'throw',
|
||||
'throws',
|
||||
'transient',
|
||||
'true',
|
||||
'try',
|
||||
'typeof',
|
||||
'var',
|
||||
'void',
|
||||
'volatile',
|
||||
'while',
|
||||
'with',
|
||||
'yield',
|
||||
];
|
||||
|
||||
const regex = /^[a-zA-Z_$][0-9a-zA-Z_$]*(?:\[(?:".+"|'.+'|\d+)\])*?$/;
|
||||
|
||||
module.exports.check = (inputStr) => {
|
||||
let isValid = true;
|
||||
inputStr.split('.').forEach((part) => {
|
||||
if (!regex.test(part)) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (RESERVED_WORDS.indexOf(part) !== -1) {
|
||||
isValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
};
|
|
@ -22,7 +22,6 @@ const createHTTPError = require('http-errors');
|
|||
|
||||
const apiHandler = require('../../handler/APIHandler');
|
||||
const settings = require('../../utils/Settings');
|
||||
const isValidJSONPName = require('./isValidJSONPName');
|
||||
|
||||
const log4js = require('log4js');
|
||||
const logger = log4js.getLogger('API');
|
||||
|
@ -686,12 +685,6 @@ exports.expressCreateServer = (hookName, args, cb) => {
|
|||
}
|
||||
}
|
||||
|
||||
// support jsonp response format
|
||||
if (req.query.jsonp && isValidJSONPName.check(req.query.jsonp)) {
|
||||
res.header('Content-Type', 'application/javascript');
|
||||
response = `${req.query.jsonp}(${JSON.stringify(response)})`;
|
||||
}
|
||||
|
||||
// send response
|
||||
return res.send(response);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue