diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ddfe44..d0d1acc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Changelog ========= +### v1.1.1, 25 Mar 2020, node.js `v12.16.1` +* Added cryptoRandomString pattern for more unpredictable room names + ### v1.1.0, 21 Mar 2020, node.js `v12.16.1` * Restructured code base * Added travis-ci auto release build for executables (mac, linux, win) diff --git a/README.md b/README.md index 592224a..e612945 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,16 @@ After installing it, run jitsi --help without arguments to see list of options. --pattern or -p : Select the desired generation pattern. - = [beautifulFungiOrSpaghetti, amazinglyScaryToy, + = [cryptoRandomString, beautifulFungiOrSpaghetti, amazinglyScaryToy, neitherTrashNorRifle, eitherCopulateOrInvestigate, wolvesComputeBadly uniteFacilitateAndMerge, nastyWitchesAtThePub, defaultPattern] ``` +## Pre-build executable +We are pre-building executables for the cli tool that you can use in MacOS, Linux and Windows. For building the executable we are using the single-command node.js binary compiler called Pkg from zeit. This command line interface enables us to package the complete project into an executable that then can be run even on devices without node.js installed. Thanks to Travis-CI this perfectly integrates into the deployment pipeline, which means that on every push to the master branch a new release is created and pushed into the release section. + +You can find the latest release here: https://github.com/fklement/jitsi-cli/releases/latest + ## General Informations I started to develop this CLI-Tool because I really love jitsi and use it a lot in my daily life. Since I mainly work with the terminal, I found it useful to start a jitsi-meet session quickly with one command. Feel free to add more useful things to this tool (e.g. more name generators). diff --git a/package-lock.json b/package-lock.json index 0945c6e..6208f7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "@fklement/jitsi", - "version": "1.0.0", + "name": "jitsi", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -286,14 +286,6 @@ "delayed-stream": "~1.0.0" } }, - "copy-to-clipboard": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz", - "integrity": "sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==", - "requires": { - "toggle-selection": "^1.0.6" - } - }, "core-js": { "version": "2.6.11", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", @@ -316,6 +308,21 @@ "which": "^1.2.9" } }, + "crypto-random-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-3.2.0.tgz", + "integrity": "sha512-8vPu5bsKaq2uKRy3OL7h1Oo7RayAWB8sYexLKAqvCXVib8SxgbmoF1IN4QMKjBv8uI8mp5gPPMbiRah25GMrVQ==", + "requires": { + "type-fest": "^0.8.1" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==" + } + } + }, "cssom": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", @@ -900,11 +907,6 @@ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" }, - "random-words": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/random-words/-/random-words-1.1.0.tgz", - "integrity": "sha512-GyV8PlSmQE08S/RSCjG9Uh0uQaUC7iRpA18PWk9OSnvNCzKQ+B2NxqqN/cYBej4t7dfBWxh10KFBYSiNcg1jlg==" - }, "regenerator-runtime": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", @@ -1104,11 +1106,6 @@ "os-tmpdir": "~1.0.2" } }, - "toggle-selection": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", - "integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI=" - }, "tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", diff --git a/package.json b/package.json index 1c95431..3433e93 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "arg": "^4.1.3", "boxen": "^4.2.0", "clipboardy": "^2.3.0", + "crypto-random-string": "^3.2.0", "esm": "^3.2.25", "inquirer": "^7.1.0", "opener": "^1.5.1", diff --git a/src/cli.js b/src/cli.js index fe60a5a..43c9a0d 100644 --- a/src/cli.js +++ b/src/cli.js @@ -6,16 +6,19 @@ const boxen = require("boxen"); const generateRoomName = require("./roomNameGenerator"); function parseArgumentsIntoOptions(rawArgs) { - const args = arg({ - "--help": Boolean, - "--pattern": String, - "--clipboard": Boolean, - "-c": "--clipboard", - "-p": "--pattern", - "-h": "--help" - }, { - argv: rawArgs.slice(2) - }); + const args = arg( + { + "--help": Boolean, + "--pattern": String, + "--clipboard": Boolean, + "-c": "--clipboard", + "-p": "--pattern", + "-h": "--help" + }, + { + argv: rawArgs.slice(2) + } + ); return { help: args["--help"] || false, pattern: args["--pattern"] || false, @@ -29,10 +32,11 @@ async function promptForMissingOptions(options) { console.log( boxen( "๐Ÿงช How to use the jitsi-cli tool:\n\n" + - ":\n Uses the given as input for creating the room\n\n" + - "--clipboard or -c:\n Copies the generated jitsi room URL into your clipboard.\n\n" + - "--pattern or -p :\n Select the desired generation pattern.\n" + - " = [beautifulFungiOrSpaghetti, amazinglyScaryToy,\n neitherTrashNorRifle, eitherCopulateOrInvestigate, wolvesComputeBadly,\n uniteFacilitateAndMerge, nastyWitchesAtThePub, defaultPattern]", { + ":\n Uses the given as input for creating the room\n\n" + + "--clipboard or -c:\n Copies the generated jitsi room URL into your clipboard.\n\n" + + "--pattern or -p :\n Select the desired generation pattern.\n" + + " = [cryptoRandomString, beautifulFungiOrSpaghetti, amazinglyScaryToy,\n neitherTrashNorRifle, eitherCopulateOrInvestigate, wolvesComputeBadly,\n uniteFacilitateAndMerge, nastyWitchesAtThePub, defaultPattern]", + { padding: 1, margin: 1, borderStyle: "round" @@ -47,7 +51,12 @@ async function promptForMissingOptions(options) { type: "list", name: "pattern", message: "Please choose which pattern you would like", - choices: [{ + choices: [ + { + name: "๐Ÿ”‘ Generate cryptoRandomString", + value: "cryptoRandomString" + }, + { name: "๐Ÿ Beautiful Fungi Or Spaghetti", value: "beautifulFungiOrSpaghetti" }, @@ -97,7 +106,7 @@ async function promptForMissingOptions(options) { }; } -exports.start = async function (args) { +exports.start = async function(args) { let slug = ""; let boxenOptions = { padding: 1, @@ -105,6 +114,7 @@ exports.start = async function (args) { borderStyle: "round" }; let possiblePatterns = [ + "cryptoRandomString", "beautifulFungiOrSpaghetti", "amazinglyScaryToy", "neitherTrashNorRifle", @@ -122,7 +132,8 @@ exports.start = async function (args) { process.exit(); } - if (!options.roomName) slug = generateRoomName.generateRoomName(options.pattern); + if (!options.roomName) + slug = generateRoomName.generateRoomName(options.pattern); else slug = options.roomName; let jitsiURL = "https://meet.jit.si/" + slug; @@ -134,4 +145,5 @@ exports.start = async function (args) { boxenOptions ) ); -} \ No newline at end of file +}; + diff --git a/src/roomNameGenerator.js b/src/roomNameGenerator.js index cbd95ad..c0f039c 100644 --- a/src/roomNameGenerator.js +++ b/src/roomNameGenerator.js @@ -1,4 +1,5 @@ const rnd = require("./randomUtil"); +const cryptoRandomString = require("crypto-random-string"); // TODO: think of some more nouns const _NOUN_ = ["Cat", "Mountain", "Speaker", "Snow", "Rain", "Ship"]; @@ -726,24 +727,28 @@ const PATTERNS = { * * @returns {string} A newly-generated room name. */ -exports.generateRoomName = function (pattern) { +exports.generateRoomName = function(pattern) { // XXX Note that if more than one pattern is available, the choice of 'name' // won't have a uniform distribution amongst all patterns (names from // patterns with fewer options will have higher probability of being chosen // that names from patterns with more options). - let name = rnd.randomElement(PATTERNS[pattern]); + let name = ""; + if (pattern == "cryptoRandomString") { + name = cryptoRandomString({ length: 25, type: "url-safe" }); + } else { + name = rnd.randomElement(PATTERNS[pattern]); - while (_hasTemplate(name)) { - for (const template in CATEGORIES) { - // eslint-disable-line guard-for-in - const word = rnd.randomElement(CATEGORIES[template]); + while (_hasTemplate(name)) { + for (const template in CATEGORIES) { + // eslint-disable-line guard-for-in + const word = rnd.randomElement(CATEGORIES[template]); - name = name.replace(template, word); + name = name.replace(template, word); + } } } - return name; -} +}; /** * Determines whether a specific string contains at least one of the @@ -762,4 +767,4 @@ function _hasTemplate(s) { } return false; -} \ No newline at end of file +}