diff --git a/controllers/scriptStorage.js b/controllers/scriptStorage.js index 067e94db2..68c8399d3 100644 --- a/controllers/scriptStorage.js +++ b/controllers/scriptStorage.js @@ -1124,28 +1124,6 @@ exports.getMeta = function (aBufs, aCallback) { aCallback(null); }; -function isEqualKeyset(aOpenUserJSKeyset, aUserSriptKeyset) { - var aOpenUserJSKey = null; - var aUserScriptKey = null; - var i = null; - - if (!aUserSriptKeyset || aUserSriptKeyset.length !== aOpenUserJSKeyset.length) { - // No UserScript block keyset or not mirrored exactly. - return false; - } else { - for (i = 0; (aOpenUserJSKey = aOpenUserJSKeyset[i]) && - (aUserScriptKey = aUserSriptKeyset[i]); i++) { - - if (aOpenUserJSKey !== aUserScriptKey) { - // Keyset must exist exactly positioned in both - return false; - } - } - } - - return true; -} - exports.storeScript = function (aUser, aMeta, aBuf, aCallback, aUpdate) { var isLibrary = typeof aMeta === 'string'; var name = null; @@ -1156,7 +1134,6 @@ exports.storeScript = function (aUser, aMeta, aBuf, aCallback, aUpdate) { var downloadURL = null; var userscriptKeyset = null; var userscriptKey = null; - var openuserjsKeyset = null; var thisKeyComponents = null; var thatSPDX = null; var htmlStub = null; @@ -1233,69 +1210,8 @@ exports.storeScript = function (aUser, aMeta, aBuf, aCallback, aUpdate) { } - // `name` validations including localizations - userscriptKeyset = findMeta(aMeta, 'UserScript.name.value'); - openuserjsKeyset = findMeta(aMeta, 'OpenUserJS.name.value'); - - if (openuserjsKeyset) { - if (!isEqualKeyset(openuserjsKeyset, userscriptKeyset)) { - // Keysets in both blocks do not match exactly... reject - aCallback(null); - return; - } - } - - - // `description` validations including localizations - userscriptKeyset = findMeta(aMeta, 'UserScript.description.value'); - openuserjsKeyset = findMeta(aMeta, 'OpenUserJS.description.value'); - - if (openuserjsKeyset) { - if (!isEqualKeyset(openuserjsKeyset, userscriptKeyset)) { - // Keysets in both blocks do not match exactly... reject - aCallback(null); - return; - } - } - - - // `version` validations - userscriptKeyset = findMeta(aMeta, 'UserScript.version.0.value'); - openuserjsKeyset = findMeta(aMeta, 'OpenUserJS.version.0.value'); - - if (openuserjsKeyset) { - if (!isEqualKeyset(openuserjsKeyset, userscriptKeyset)) { - // Keysets in both blocks do not match exactly... reject - aCallback(null); - return; - } - } - - - // `copyright` validations - userscriptKeyset = findMeta(aMeta, 'UserScript.copyright.value'); - openuserjsKeyset = findMeta(aMeta, 'OpenUserJS.copyright.value'); - - if (openuserjsKeyset) { - if (!isEqualKeyset(openuserjsKeyset, userscriptKeyset)) { - // Keysets in both blocks do not match exactly... reject - aCallback(null); - return; - } - } - - // `license` validations userscriptKeyset = findMeta(aMeta, 'UserScript.license.value'); - openuserjsKeyset = findMeta(aMeta, 'OpenUserJS.license.value'); - - if (openuserjsKeyset) { - if (!isEqualKeyset(openuserjsKeyset, userscriptKeyset)) { - // Keysets in both block do not match exactly... reject - aCallback(null); - return; - } - } if (userscriptKeyset) { thatSPDX = userscriptKeyset[userscriptKeyset.length - 1].split('; ')[0].replace(/\+$/, ''); diff --git a/public/pegjs/blockOpenUserJS.pegjs b/public/pegjs/blockOpenUserJS.pegjs index dc4be3cbd..0e35de002 100644 --- a/public/pegjs/blockOpenUserJS.pegjs +++ b/public/pegjs/blockOpenUserJS.pegjs @@ -7,16 +7,6 @@ Test the generated parser with some input for peg.js site at https://pegjs.org/o // @author Marti // @collaborator sizzle // @unstableMinify Some reason -// @name RFC 2606§3 - Hello, World! -// @name:es ¡Hola mundo! -// @name:fr Salut tout le monde! -// @description Test values with known UserScript metadata keys. -// @description:es Prueba de valores con UserScript metadatos llaves conocidas. -// @description:fr Valeurs d'essai avec des clés de métadonnées UserScript connues. -// @version 1.2.3 -// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html -// @licence (CC); https://creativecommons.org/licenses/by-nc-sa/3.0/ -// @copyright 2013+, OpenUserJS Group (https://github.com/orgs/OpenUserJs/people) // ==/OpenUserJS== */ @@ -48,8 +38,7 @@ line = data: ( item1 / - items1 / - item1Localized + items1 ) '\n'? { @@ -64,8 +53,7 @@ item1 = keyword: ( 'author' / - 'unstableMinify' / - 'version' + 'unstableMinify' ) whitespace value: non_newline @@ -78,43 +66,10 @@ item1 = }; } -item1Localized = - keyword: - ( - 'name' / - 'description' - ) - locale: (':' localeValue:$[a-zA-Z-]+ { - return localeValue; - })? - whitespace - value: non_newline - { - var keywordUpmixed = upmix(keyword); - - var obj = { - unique: true, - - key: keywordUpmixed, - value: value.replace(/\s+$/, '') - } - - if (locale) { - obj.key += ':' + locale; - obj.keyword = keywordUpmixed; - obj.locale = locale; - } - - return obj; - } - items1 = keyword: ( - 'collaborator' / - 'license' / - 'licence' / - 'copyright' + 'collaborator' ) whitespace value: non_newline diff --git a/views/includes/scripts/scriptEditor.html b/views/includes/scripts/scriptEditor.html index 9c3016257..7bdc31fa0 100644 --- a/views/includes/scripts/scriptEditor.html +++ b/views/includes/scripts/scriptEditor.html @@ -85,21 +85,8 @@ ? [ '// ==UserScript==', '// @exclude *', - '// @namespace https://openuserjs.org/users/' + username, - '', - '// ==OpenUserJS==', - '// @name Getting Started with a Library', - '// @description ' - + 'Showing the current basic and recommended format for a Library script.', - '// @copyright ' + year + ', ' + username - + ' (https://openuserjs.org/users/' + username + ')', - '// @license GPL-3.0+; http://www.gnu.org/licenses/gpl-3.0.txt', - '// @version 0.0.0', '// ==/UserScript==', '', - '// @author ' + username, - '// ==/OpenUserJS==', - '', '/**', ' *', ' * Please begin typing or paste your Library now.', @@ -113,7 +100,7 @@ 'Showing the current basic and recommended format for a User script.', '// @copyright ' + year + ', ' + username + ' (https://openuserjs.org/users/' + username + ')', - '// @license GPL-3.0+; http://www.gnu.org/licenses/gpl-3.0.txt', + '// @license OSI-SPDX-Short-Identifier', '// @version 0.0.0', '// @include https://www.example.com/*', '// @grant none',