-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement random room generator, login page tweaks
- Loading branch information
Showing
11 changed files
with
110 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Generate random, pronounceable room names | ||
// Based on https://github.com/lpar/kpwgen and https://shorl.com/koremutake.php | ||
|
||
Cryptodog.roomName = function () { | ||
const numSyllables = 12; | ||
const separator = '-'; | ||
|
||
const syllables = ['ba', 'be', 'bi', 'bo', 'bu', 'by', 'da', 'de', 'di', 'do', 'du', 'dy', 'fe', 'fi', 'fo', 'fu', 'fy', 'ga', 'ge', 'gi', 'go', 'gu', 'gy', 'ha', 'he', 'hi', 'ho', 'hu', 'hy', 'ja', 'je', 'ji', 'jo', 'ju', 'jy', 'ka', 'ke', 'ko', 'ku', 'ky', 'la', 'le', 'li', 'lo', 'lu', 'ly', 'ma', 'me', 'mi', 'mo', 'mu', 'my', 'na', 'ne', 'ni', 'no', 'nu', 'ny', 'pa', 'pe', 'pi', 'po', 'pu', 'py', 'ra', 're', 'ri', 'ro', 'ru', 'ry', 'sa', 'se', 'si', 'so', 'su', 'sy', 'ta', 'te', 'ti', 'to', 'tu', 'ty', 'va', 've', 'vi', 'vo', 'vu', 'vy', 'bra', 'bre', 'bri', 'bro', 'bru', 'bry', 'dra', 'dre', 'dri', 'dro', 'dru', 'dry', 'fra', 'fre', 'fri', 'fro', 'fru', 'fry', 'gra', 'gre', 'gri', 'gro', 'gru', 'gry', 'pra', 'pre', 'pri', 'pro', 'pru', 'pry', 'sta', 'ste', 'sti', 'sto', 'stu', 'sty', 'tra', 'tre', 'er', 'ed', 'in', 'ex', 'al', 'en', 'an', 'ad', 'or', 'at', 'ca', 'ap', 'el', 'ci', 'et', 'it', 'ob', 'of', 'af', 'au', 'cy', 'im', 'op', 'co', 'up', 'ing', 'con', 'ter', 'com', 'per', 'ble', 'der', 'cal', 'man', 'est', 'for', 'mer', 'col', 'ful', 'get', 'low', 'son', 'tle', 'day', 'pen', 'ten', 'tor', 'ver', 'ber', 'can', 'ple', 'fer', 'gen', 'den', 'mag', 'sub', 'sur', 'men', 'min', 'out', 'tal', 'but', 'cit', 'cle', 'cov', 'dif', 'ern', 'eve', 'hap', 'ket', 'nal', 'sup', 'ted', 'tem', 'tin', 'tro']; | ||
|
||
if (syllables.length > 256) { | ||
throw new Error('syllables list too large for RNG'); | ||
} | ||
|
||
function generate() { | ||
let name = ''; | ||
|
||
for (let i = 0; i < numSyllables; i++) { | ||
if (i > 0 && i % 3 == 0) { | ||
name += separator; | ||
} | ||
|
||
// select a syllable without bias | ||
let rand; | ||
do { | ||
rand = randByte(); | ||
} while (rand >= syllables.length); | ||
|
||
const s = syllables[rand]; | ||
name += s; | ||
} | ||
return name; | ||
} | ||
|
||
function randByte() { | ||
const array = new Uint8Array(1); | ||
crypto.getRandomValues(array); | ||
return array[0]; | ||
} | ||
|
||
return { | ||
generate | ||
}; | ||
}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,14 @@ | |
"fonts": "\"Helvetica Neue\", Helvetica, Arial, Verdana", | ||
"loginWindow": { | ||
"introHeader": "Welcome to Cryptodog", | ||
"introParagraph": "Here are some tips: <ul><li>Cryptodog is experimental software. Don't use Cryptodog if you have a critical need for secure messaging.</li><li>We recommend installing the <a href=\"https://chrome.google.com/webstore/detail/cryptodog/blnkmmamdbladdaaddkjbecbphngeiec\">Chrome extension</a> to ensure you always have the official, most recent version.</li><li>Choose a room name that others can't easily guess.</li><li>Want to meet new people? Try joining room <b><code>lobby</code></b>.</li><li>Bug reports and feature requests are welcome! Please open an issue on <a href=\"https://github.com/Cryptodog/cryptodog/issues\">GitHub</a>.</li><li>If you've found a security vulnerability, please email us at <a href=\"mailto:[email protected]\">[email protected]</a>.</li><li>For other questions and concerns, email us at <a href=\"mailto:[email protected]\">[email protected]</a>.</li></ul>", | ||
"introParagraph": "Cryptodog is experimental software that may have vulnerabilities. Please don't rely on it to protect your messages. Here are some tips on using it as safely as possible:<ul><li>Install the <a href=\"https://chrome.google.com/webstore/detail/cryptodog/blnkmmamdbladdaaddkjbecbphngeiec\">Chrome extension</a> to ensure you always have the official, most up-to-date version.</li><li>Treat the room name like a password—choose one that can't be easily guessed, and only share it with trusted people. Try clicking the dice icon to generate a random room name.</li><li>Nicknames are currently <b>not encrypted end-to-end</b>. For now, please don't use your real name or anything that personally identifies you.</li></ul>", | ||
"blog": "Blog", | ||
"customServer": "Custom server", | ||
"reset": "Reset", | ||
"conversationName": "conversation name", | ||
"conversationName": "room name", | ||
"nickname": "nickname", | ||
"connect": "connect", | ||
"conversationNameTooltip": "Enter a name for your conversation and share it with people you'd like to talk to, or join <strong>lobby</strong> to meet new people!", | ||
"enterConversation": "Enter the name of a conversation to join." | ||
"conversationNameTooltip": "Choose a room name that's hard to guess, and share it with people you'd like to talk to. If you just want to meet new people, try joining <strong>lobby</strong>." | ||
}, | ||
"loginMessage": { | ||
"enterConversation": "Please enter a conversation name.", | ||
|
@@ -21,7 +20,6 @@ | |
"nicknameInUse": "Nickname in use.", | ||
"authenticationFailure": "Authentication failure.", | ||
"connectionFailed": "Connection failed.", | ||
"thankYouUsing": "Thank you for using Cryptodog.", | ||
"registering": "Registering...", | ||
"connecting": "Connecting...", | ||
"connected": "Connected.", | ||
|