mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2025-02-22 16:05:03 +08:00
better urls, no more #
This commit is contained in:
parent
73c724fff3
commit
9f4a204fe9
@ -1,4 +1,4 @@
|
|||||||
if (!location.hash) {
|
if (window.location.pathname === "/") {
|
||||||
// Generate random room name if needed
|
// Generate random room name if needed
|
||||||
var adjectives = ["small", "big", "large", "smelly", "new", "happy", "shiny", "old", "clean", "nice", "bad", "cool",
|
var adjectives = ["small", "big", "large", "smelly", "new", "happy", "shiny", "old", "clean", "nice", "bad", "cool",
|
||||||
"hot", "cold", "warm", "hungry", "slow", "fast", "red", "white", "black", "blue", "green"];
|
"hot", "cold", "warm", "hungry", "slow", "fast", "red", "white", "black", "blue", "green"];
|
||||||
@ -7,9 +7,11 @@ if (!location.hash) {
|
|||||||
"couch", "towel"];
|
"couch", "towel"];
|
||||||
var adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
|
var adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
|
||||||
var noun = nouns[Math.floor(Math.random() * nouns.length)];
|
var noun = nouns[Math.floor(Math.random() * nouns.length)];
|
||||||
location.hash = adjective + noun
|
noun = noun.charAt(0).toUpperCase() + noun.substring(1);
|
||||||
|
adjective = adjective.charAt(0).toUpperCase() + adjective.substring(1);
|
||||||
|
window.location.href = window.location.href + adjective + noun;
|
||||||
}
|
}
|
||||||
const roomHash = location.hash.substring(1);
|
const roomHash = window.location.pathname;
|
||||||
|
|
||||||
function logIt(message, error) {
|
function logIt(message, error) {
|
||||||
// console.log(message);
|
// console.log(message);
|
||||||
|
@ -18,6 +18,11 @@ app.get('/landing', function (req, res) {
|
|||||||
res.sendFile(path.join(public, 'landing/landing.html'));
|
res.sendFile(path.join(public, 'landing/landing.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/*', function (req, res) {
|
||||||
|
res.sendFile(path.join(public, 'chat.html'));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function log(msg, room) {
|
function log(msg, room) {
|
||||||
console.log(room + ": " + msg)
|
console.log(room + ": " + msg)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user