aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-03-25 23:16:02 +0200
committermarzavec <admin@marzavec.com>2018-03-25 23:16:02 +0200
commitce766fa1db1a6c3cc83f588373c927ffa04733ba (patch)
treec5f4f86b8df1808cb4f14ca3e77ba411927db306
parentAdded unban by hash (diff)
downloadhackchat-ce766fa1db1a6c3cc83f588373c927ffa04733ba.tar.gz
hackchat-ce766fa1db1a6c3cc83f588373c927ffa04733ba.zip
Rolled client back to legacy & synced prod modules
-rw-r--r--client/client.js20
-rw-r--r--client/index.html69
-rw-r--r--client/structure.css137
-rw-r--r--server/src/commands/core/invite.js1
-rw-r--r--server/src/commands/mod/ban.js1
-rw-r--r--server/src/commands/mod/kick.js2
6 files changed, 15 insertions, 215 deletions
diff --git a/client/client.js b/client/client.js
index e8c3b79..254480d 100644
--- a/client/client.js
+++ b/client/client.js
@@ -19,14 +19,13 @@ var frontpage = [
"Whitespace is preserved, so source code can be pasted verbatim.",
"Surround LaTeX with a dollar sign for inline style $\\zeta(2) = \\pi^2/6$, and two dollars for display. $$\\int_0^1 \\int_0^1 \\frac{1}{1-xy} dx dy = \\frac{\\pi^2}{6}$$",
"",
- "GitHub: https://github.com/AndrewBelt/hack.chat",
- "Android apps: https://goo.gl/UkbKYy https://goo.gl/qasdSu https://goo.gl/fGQFQN",
+ "Current Github: https://github.com/hack-chat includes server and client source along with other resources",
"",
- "Server and web client released under the MIT open source license.",
- "No message history is retained on the hack.chat server.",
+ "Legacy GitHub: https://github.com/AndrewBelt/hack.chat",
+ "Android apps: https://goo.gl/UkbKYy https://goo.gl/qasdSu https://goo.gl/fGQFQN",
"",
- "[03/03/2018] Please note that the server is currently undergoing changes, expect random downtime or disconnections!",
- "[03/03/2018] Hack.chat is now under new management by the core community; @raf924 @bacon @wwandrew @Rut @_0x17 @M4GNV5 @MinusGix @nanotech",
+ "Server and web client released under the WTFPL and MIT open source license.",
+ "No message history is retained on the hack.chat server."
].join("\n")
function $(query) {return document.querySelector(query)}
@@ -60,8 +59,13 @@ window.setInterval(function() {
function join(channel) {
-
- ws = new WebSocket('ws://127.0.0.1:6060')
+ if (document.domain == 'hack.chat') {
+ // For https://hack.chat/
+ ws = new WebSocket('wss://hack.chat/chat-ws')
+ } else {
+ // for local installs
+ ws = new WebSocket('ws://' + document.domain + ':6060')
+ }
var wasConnected = false
diff --git a/client/index.html b/client/index.html
index 3b56bd5..d71c62d 100644
--- a/client/index.html
+++ b/client/index.html
@@ -1,68 +1 @@
-<!DOCTYPE html>
-<html>
-
-<head>
-
-
-
-
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
- <title>hack.chat</title>
-
- <meta name="application-name" content="Hack.Chat">
- <meta name="author" content="Marzavec, admin@marzavec.com">
- <meta name="description" content="A minimal, accountless, anonymous, distraction-free chat application">
- <meta name="keywords" content="minimal, accountless, anonymous, distraction-free, chat">
- <meta name="robots" content="index, follow">
- <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-touch-icon-57x57.png">
- <link rel="apple-touch-icon" sizes="114x114" href="/favicons/apple-touch-icon-114x114.png">
- <link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-touch-icon-72x72.png">
- <link rel="apple-touch-icon" sizes="144x144" href="/favicons/apple-touch-icon-144x144.png">
- <link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-touch-icon-60x60.png">
- <link rel="apple-touch-icon" sizes="120x120" href="/favicons/apple-touch-icon-120x120.png">
- <link rel="apple-touch-icon" sizes="76x76" href="/favicons/apple-touch-icon-76x76.png">
- <link rel="apple-touch-icon" sizes="152x152" href="/favicons/apple-touch-icon-152x152.png">
- <meta name="apple-mobile-web-app-title" content="Rubix">
- <link rel="icon" type="image/png" href="/favicons/favicon-196x196.png" sizes="196x196">
- <link rel="icon" type="image/png" href="/favicons/favicon-160x160.png" sizes="160x160">
- <link rel="icon" type="image/png" href="/favicons/favicon-96x96.png" sizes="96x96">
- <link rel="icon" type="image/png" href="/favicons/favicon-16x16.png" sizes="16x16">
- <link rel="icon" type="image/png" href="/favicons/favicon-32x32.png" sizes="32x32">
- <meta name="msapplication-TileColor" content="#E76049">
- <meta name="msapplication-TileImage" content="/favicons/mstile-144x144.png">
-
- <link rel="stylesheet" href="style.css">
- <link rel="stylesheet" href="katex/katex.min.css">
- <link id="scheme-link" rel="stylesheet" href="schemes/atelier-dune.css">
- <script src="katex/katex.min.js"></script>
- <script src="katex/contrib/auto-render.min.js"></script>
-</head>
-
-<body>
- <article class="container">
- <div id="messages" class="messages"></div>
- </article>
- <footer id="footer">
- <div class="container">
- <form id="chatform" class="messages"><textarea id="chatinput" type="text" autocomplete="off" autofocus></textarea></form>
- </div>
- </footer>
- <nav id="sidebar">
- <div id="sidebar-content" class="hidden">
- <p><input id="pin-sidebar" type="checkbox"><label for="pin-sidebar">Pin sidebar</label></p>
- <h4>Settings</h4>
- <p><input id="joined-left" type="checkbox" checked><label for="joined-left">Join/left notify</label></p>
- <p><input id="parse-latex" type="checkbox" checked><label for="parse-latex">Parse LaTeX</label></p>
- <p><button id="clear-messages">Clear messages</button></p>
- <h4>Color scheme</h4><select id="scheme-selector"></select>
- <h4>Users online</h4>
- <p>(Click user to invite)</p>
- <ul id="users"></ul>
- </div>
- </nav>
- <script src="client.js"></script>
-</body>
-
-</html>
+<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><title>hack.chat</title><link rel="stylesheet" href="style.css"><link rel="stylesheet" href="katex/katex.min.css"><link id="scheme-link" rel="stylesheet" href="schemes/atelier-dune.css"><script src="katex/katex.min.js"></script><script src="katex/contrib/auto-render.min.js"></script></head><body><article class="container"><div id="messages" class="messages"></div></article><footer id="footer"><div class="container"><form id="chatform" class="messages"><textarea id="chatinput" type="text" autocomplete="off" autofocus></textarea></form></div></footer><nav id="sidebar"><div id="sidebar-content" class="hidden"><p><input id="pin-sidebar" type="checkbox"><label for="pin-sidebar">Pin sidebar</label></p><h4>Settings</h4><p><input id="joined-left" type="checkbox" checked><label for="joined-left">Join/left notify</label></p><p><input id="parse-latex" type="checkbox" checked><label for="parse-latex">Parse LaTeX</label></p><p><button id="clear-messages">Clear messages</button></p><h4>Color scheme</h4><select id="scheme-selector"></select><h4>Users online</h4><p>(Click user to invite)</p><ul id="users"></ul></div></nav><script src="client.js"></script></body></html> \ No newline at end of file
diff --git a/client/structure.css b/client/structure.css
deleted file mode 100644
index 18abc33..0000000
--- a/client/structure.css
+++ /dev/null
@@ -1,137 +0,0 @@
-body {
- padding: 0;
- margin: 0;
- overflow-y: scroll;
-}
-body,
-input,
-textarea {
- font-family: 'DejaVu Sans Mono', monospace;
- font-size: 12px;
-}
-input[type="checkbox"] {
- margin: 0;
- margin-right: 1em;
-}
-label {
- vertical-align: 3px;
-}
-input,
-textarea {
- background: none;
- border: none;
- outline: none;
- resize: none;
-}
-h4 {
- font-size: 12px;
- margin: 1em 0;
- font-weight: bold;
-}
-pre {
- tab-size: 2;
- white-space: pre-wrap;
- word-wrap: break-word;
- tab-size: 4;
- -moz-tab-size: 4;
-}
-a {
- color: inherit;
- text-decoration: none;
- cursor: pointer;
-}
-a:hover {
- text-decoration: underline;
-}
-ul {
- padding-left: 0;
-}
-ul li {
- list-style: inside;
-}
-.hidden {
- display: none;
-}
-.container {
- max-width: 600px;
- margin: 0 auto;
-}
-.messages {
- border-left: 1px solid;
-}
-#messages {
- padding-top: 2em;
-}
-.message {
- padding-bottom: 1em;
-}
-.nick {
- float: left;
- width: 16em;
- margin-left: -17em;
- margin-right: 1em;
- text-align: right;
- white-space: nowrap;
- overflow: hidden;
-}
-.trip {
- font-size: 10px;
-}
-.text {
- margin: 0;
- margin-left: 1em;
-}
-.text p {
- margin: 0;
-}
-#footer {
- position: fixed;
- bottom: 0;
- width: 100%;
-}
-#chatform {
- border-top: 1px solid;
-}
-#chatinput {
- width: 100%;
- padding: 1em;
- box-sizing: border-box;
-}
-#sidebar {
- position: fixed;
- top: 0;
- bottom: 0;
- right: 0;
- padding: 1em;
- border-left: solid 1px;
- overflow-y: auto;
-}
-#sidebar-content {
- width: 180px;
-}
-@media only screen and (max-width: 600px) {
- .messages {
- border: none;
- }
- #messages {
- padding: 0.5em;
- }
- .message {
- padding-bottom: 0.5em;
- }
- .nick {
- margin: 0;
- float: none;
- text-align: left;
- display: inline;
- }
- .text {
- display: inline;
- }
- #sidebar {
- top: 0.5em;
- bottom: auto;
- right: 0.5em;
- border: none;
- }
-}
diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js
index 5889562..a6412e1 100644
--- a/server/src/commands/core/invite.js
+++ b/server/src/commands/core/invite.js
@@ -36,6 +36,7 @@ exports.run = async (core, server, socket, data) => {
let payload = {
cmd: 'info',
+ invite: channel,
text: `${socket.nick} invited you to ?${channel}`
};
let inviteSent = server.broadcast( payload, { channel: socket.channel, nick: data.nick });
diff --git a/server/src/commands/mod/ban.js b/server/src/commands/mod/ban.js
index 19f297a..409217a 100644
--- a/server/src/commands/mod/ban.js
+++ b/server/src/commands/mod/ban.js
@@ -37,7 +37,6 @@ exports.run = async (core, server, socket, data) => {
return;
}
- // TODO unban by hash
let clientHash = server.getSocketHash(badClient);
server._police.arrest(badClient.remoteAddress, clientHash);
diff --git a/server/src/commands/mod/kick.js b/server/src/commands/mod/kick.js
index f51d576..1958ef3 100644
--- a/server/src/commands/mod/kick.js
+++ b/server/src/commands/mod/kick.js
@@ -52,7 +52,7 @@ exports.run = async (core, server, socket, data) => {
server.broadcast({
cmd: 'info',
text: `Kicked ${targetNick}`
- }, { channel: socket.channel });
+ }, { channel: socket.channel, uType: 'user' });
// inform mods with where they were sent
server.broadcast({