massive code cleanup + replaced emojione with twemoji

This commit is contained in:
Evert Prants 2019-01-09 22:47:21 +02:00
parent 6e39b056c3
commit e7b9836df6
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
19 changed files with 2946 additions and 2095 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
/node_modules/ /node_modules/
/dist/ /app/
/lib/
/client.config.toml /client.config.toml
/webirc.data.json /webirc.data.json

View File

@ -7,7 +7,7 @@ This application requires [node.js](https://nodejs.org/) to be installed.
1. Install the dependencies `npm install` 1. Install the dependencies `npm install`
2. Copy the configuration `cp client.config.example.toml client.config.toml` 2. Copy the configuration `cp client.config.example.toml client.config.toml`
3. Build the project using `npm run build` 3. Build the project using `npm run build`
4. Run the server `./teemant.js` 4. Run the server `npm start`
The client will be accessible at http://localhost:9000/ The client will be accessible at http://localhost:9000/

8
index.js Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env node
const path = require('path')
try {
require(path.join(__dirname, 'app'))
} catch (e) {
console.error('Please build the application before running.')
}

611
package-lock.json generated
View File

@ -1055,6 +1055,12 @@
"integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=",
"dev": true "dev": true
}, },
"amdefine": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"dev": true
},
"ansi-align": { "ansi-align": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz",
@ -1149,6 +1155,21 @@
"es-abstract": "^1.7.0" "es-abstract": "^1.7.0"
} }
}, },
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
"dev": true,
"requires": {
"array-uniq": "^1.0.1"
}
},
"array-uniq": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
"integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
"dev": true
},
"array-unique": { "array-unique": {
"version": "0.3.2", "version": "0.3.2",
"resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
@ -1910,12 +1931,29 @@
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
"dev": true "dev": true
}, },
"cliui": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
"integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==",
"dev": true,
"requires": {
"string-width": "^2.1.1",
"strip-ansi": "^4.0.0",
"wrap-ansi": "^2.0.0"
}
},
"clone": { "clone": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
"dev": true "dev": true
}, },
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true
},
"collection-visit": { "collection-visit": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
@ -1986,6 +2024,76 @@
"typedarray": "^0.0.6" "typedarray": "^0.0.6"
} }
}, },
"concurrently": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-4.1.0.tgz",
"integrity": "sha512-pwzXCE7qtOB346LyO9eFWpkFJVO3JQZ/qU/feGeaAHiX1M3Rw3zgXKc5cZ8vSH5DGygkjzLFDzA/pwoQDkRNGg==",
"dev": true,
"requires": {
"chalk": "^2.4.1",
"date-fns": "^1.23.0",
"lodash": "^4.17.10",
"read-pkg": "^4.0.1",
"rxjs": "^6.3.3",
"spawn-command": "^0.0.2-1",
"supports-color": "^4.5.0",
"tree-kill": "^1.1.0",
"yargs": "^12.0.1"
},
"dependencies": {
"has-flag": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
"dev": true
},
"parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"dev": true,
"requires": {
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"read-pkg": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz",
"integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=",
"dev": true,
"requires": {
"normalize-package-data": "^2.3.2",
"parse-json": "^4.0.0",
"pify": "^3.0.0"
}
},
"rxjs": {
"version": "6.3.3",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz",
"integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
},
"supports-color": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
"dev": true,
"requires": {
"has-flag": "^2.0.0"
}
}
}
},
"configstore": { "configstore": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz",
@ -2070,6 +2178,127 @@
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
"dev": true "dev": true
}, },
"copy-webpack-plugin": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.6.0.tgz",
"integrity": "sha512-Y+SQCF+0NoWQryez2zXn5J5knmr9z/9qSQt7fbL78u83rxmigOy8X5+BFn8CFSuX+nKT8gpYwJX68ekqtQt6ZA==",
"dev": true,
"requires": {
"cacache": "^10.0.4",
"find-cache-dir": "^1.0.0",
"globby": "^7.1.1",
"is-glob": "^4.0.0",
"loader-utils": "^1.1.0",
"minimatch": "^3.0.4",
"p-limit": "^1.0.0",
"serialize-javascript": "^1.4.0"
},
"dependencies": {
"cacache": {
"version": "10.0.4",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz",
"integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==",
"dev": true,
"requires": {
"bluebird": "^3.5.1",
"chownr": "^1.0.1",
"glob": "^7.1.2",
"graceful-fs": "^4.1.11",
"lru-cache": "^4.1.1",
"mississippi": "^2.0.0",
"mkdirp": "^0.5.1",
"move-concurrently": "^1.0.1",
"promise-inflight": "^1.0.1",
"rimraf": "^2.6.2",
"ssri": "^5.2.4",
"unique-filename": "^1.1.0",
"y18n": "^4.0.0"
}
},
"find-cache-dir": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz",
"integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=",
"dev": true,
"requires": {
"commondir": "^1.0.1",
"make-dir": "^1.0.0",
"pkg-dir": "^2.0.0"
}
},
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"dev": true,
"requires": {
"locate-path": "^2.0.0"
}
},
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"dev": true,
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"mississippi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz",
"integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==",
"dev": true,
"requires": {
"concat-stream": "^1.5.0",
"duplexify": "^3.4.2",
"end-of-stream": "^1.1.0",
"flush-write-stream": "^1.0.0",
"from2": "^2.1.0",
"parallel-transform": "^1.1.0",
"pump": "^2.0.1",
"pumpify": "^1.3.3",
"stream-each": "^1.1.0",
"through2": "^2.0.0"
}
},
"pkg-dir": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz",
"integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=",
"dev": true,
"requires": {
"find-up": "^2.1.0"
}
},
"pump": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz",
"integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"ssri": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz",
"integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==",
"dev": true,
"requires": {
"safe-buffer": "^5.1.1"
}
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true
}
}
},
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -2215,6 +2444,12 @@
} }
} }
}, },
"css-parse": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz",
"integrity": "sha1-Mh9s9zeCpv91ERE5D8BeLGV9jJs=",
"dev": true
},
"css-select": { "css-select": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
@ -2308,6 +2543,12 @@
"es5-ext": "^0.10.9" "es5-ext": "^0.10.9"
} }
}, },
"date-fns": {
"version": "1.30.1",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz",
"integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==",
"dev": true
},
"date-now": { "date-now": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@ -2491,6 +2732,32 @@
"randombytes": "^2.0.0" "randombytes": "^2.0.0"
} }
}, },
"dir-glob": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.0.tgz",
"integrity": "sha512-YqrO+bduKFqPgspvpjDAaKk0qhmvY+SY7NjIRljCDAy6CX7Ft65irIduHbrYXhy+BxJnYKjWuREw6X42w9/+DQ==",
"dev": true,
"requires": {
"path-type": "^3.0.0"
},
"dependencies": {
"path-type": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
"integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
"dev": true,
"requires": {
"pify": "^3.0.0"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
}
}
},
"doctrine": { "doctrine": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
@ -4098,6 +4365,12 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true "dev": true
}, },
"get-caller-file": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
"integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
"dev": true
},
"get-stdin": { "get-stdin": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
@ -4166,6 +4439,40 @@
"integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==", "integrity": "sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ==",
"dev": true "dev": true
}, },
"globby": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz",
"integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"dir-glob": "^2.0.0",
"glob": "^7.1.2",
"ignore": "^3.3.5",
"pify": "^3.0.0",
"slash": "^1.0.0"
},
"dependencies": {
"ignore": {
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
"dev": true
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
"dev": true
}
}
},
"got": { "got": {
"version": "6.7.1", "version": "6.7.1",
"resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz",
@ -4609,6 +4916,12 @@
"loose-envify": "^1.0.0" "loose-envify": "^1.0.0"
} }
}, },
"invert-kv": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
"integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
"dev": true
},
"ipaddr.js": { "ipaddr.js": {
"version": "1.8.0", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
@ -4993,6 +5306,15 @@
"package-json": "^4.0.0" "package-json": "^4.0.0"
} }
}, },
"lcid": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
"integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
"dev": true,
"requires": {
"invert-kv": "^2.0.0"
}
},
"levn": { "levn": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
@ -5161,6 +5483,15 @@
} }
} }
}, },
"map-age-cleaner": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
"integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",
"dev": true,
"requires": {
"p-defer": "^1.0.0"
}
},
"map-cache": { "map-cache": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
@ -5204,6 +5535,17 @@
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
}, },
"mem": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz",
"integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==",
"dev": true,
"requires": {
"map-age-cleaner": "^0.1.1",
"mimic-fn": "^1.0.0",
"p-is-promise": "^1.1.0"
}
},
"memory-fs": { "memory-fs": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
@ -5659,6 +6001,12 @@
"boolbase": "~1.0.0" "boolbase": "~1.0.0"
} }
}, },
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true
},
"object-assign": { "object-assign": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz",
@ -5828,6 +6176,43 @@
"integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=",
"dev": true "dev": true
}, },
"os-locale": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
"integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
"dev": true,
"requires": {
"execa": "^1.0.0",
"lcid": "^2.0.0",
"mem": "^4.0.0"
},
"dependencies": {
"execa": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"dev": true,
"requires": {
"cross-spawn": "^6.0.0",
"get-stream": "^4.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
}
},
"get-stream": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"dev": true,
"requires": {
"pump": "^3.0.0"
}
}
}
},
"os-tmpdir": { "os-tmpdir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
@ -5845,12 +6230,24 @@
"mkdirp": "^0.5.1" "mkdirp": "^0.5.1"
} }
}, },
"p-defer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",
"integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=",
"dev": true
},
"p-finally": { "p-finally": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
"dev": true "dev": true
}, },
"p-is-promise": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz",
"integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=",
"dev": true
},
"p-limit": { "p-limit": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
@ -6667,6 +7064,18 @@
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
"dev": true "dev": true
}, },
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
"dev": true
},
"require-main-filename": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true
},
"require-uncached": { "require-uncached": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
@ -6802,6 +7211,12 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
}, },
"sax": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=",
"dev": true
},
"schema-utils": { "schema-utils": {
"version": "0.4.7", "version": "0.4.7",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz",
@ -6812,6 +7227,11 @@
"ajv-keywords": "^3.1.0" "ajv-keywords": "^3.1.0"
} }
}, },
"seedrandom": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz",
"integrity": "sha512-9A+PDmgm+2du77B5i0Ip2cxOqqHjgNxnBgglxLcX78A2D6c2rTo61z4jnVABpF4cKeDMDG+cmXXvdnqse2VqMA=="
},
"semver": { "semver": {
"version": "5.6.0", "version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
@ -6864,6 +7284,12 @@
"send": "0.16.2" "send": "0.16.2"
} }
}, },
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true
},
"set-value": { "set-value": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz",
@ -7184,6 +7610,12 @@
"integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
"dev": true "dev": true
}, },
"spawn-command": {
"version": "0.0.2-1",
"resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz",
"integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=",
"dev": true
},
"spdx-correct": { "spdx-correct": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
@ -7402,6 +7834,45 @@
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true "dev": true
}, },
"stylus": {
"version": "0.54.5",
"resolved": "https://registry.npmjs.org/stylus/-/stylus-0.54.5.tgz",
"integrity": "sha1-QrlWCTHKcJDOhRWnmLqeaqPW3Hk=",
"dev": true,
"requires": {
"css-parse": "1.7.x",
"debug": "*",
"glob": "7.0.x",
"mkdirp": "0.5.x",
"sax": "0.5.x",
"source-map": "0.1.x"
},
"dependencies": {
"glob": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz",
"integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.2",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"source-map": {
"version": "0.1.43",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz",
"integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=",
"dev": true,
"requires": {
"amdefine": ">=0.0.4"
}
}
}
},
"stylus-loader": { "stylus-loader": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/stylus-loader/-/stylus-loader-3.0.2.tgz", "resolved": "https://registry.npmjs.org/stylus-loader/-/stylus-loader-3.0.2.tgz",
@ -7639,6 +8110,12 @@
"integrity": "sha1-LmhELZ9k7HILjMieZEOsbKqVACk=", "integrity": "sha1-LmhELZ9k7HILjMieZEOsbKqVACk=",
"dev": true "dev": true
}, },
"tree-kill": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.1.tgz",
"integrity": "sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==",
"dev": true
},
"trim-newlines": { "trim-newlines": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz",
@ -8171,6 +8648,12 @@
"isexe": "^2.0.0" "isexe": "^2.0.0"
} }
}, },
"which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
"widest-line": { "widest-line": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz",
@ -8195,6 +8678,47 @@
"errno": "~0.1.7" "errno": "~0.1.7"
} }
}, },
"wrap-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"dev": true,
"requires": {
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1"
},
"dependencies": {
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
}
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
}
}
},
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@ -8264,6 +8788,93 @@
"integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
"dev": true "dev": true
}, },
"yargs": {
"version": "12.0.5",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz",
"integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==",
"dev": true,
"requires": {
"cliui": "^4.0.0",
"decamelize": "^1.2.0",
"find-up": "^3.0.0",
"get-caller-file": "^1.0.1",
"os-locale": "^3.0.0",
"require-directory": "^2.1.1",
"require-main-filename": "^1.0.1",
"set-blocking": "^2.0.0",
"string-width": "^2.0.0",
"which-module": "^2.0.0",
"y18n": "^3.2.1 || ^4.0.0",
"yargs-parser": "^11.1.1"
},
"dependencies": {
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"dev": true,
"requires": {
"locate-path": "^3.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"dev": true,
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz",
"integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==",
"dev": true,
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"dev": true,
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz",
"integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==",
"dev": true
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"dev": true
},
"yargs-parser": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
"integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"yargs-parser": { "yargs-parser": {
"version": "10.1.0", "version": "10.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",

View File

@ -2,9 +2,19 @@
"name": "teemantirc", "name": "teemantirc",
"version": "2.0.0", "version": "2.0.0",
"description": "Web-based IRC client", "description": "Web-based IRC client",
"main": "teemant.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1",
"css": "mkdir -p app/public/style && stylus -o app/public/style src/style/*.styl",
"css:watch": "mkdir -p app/public/style && stylus -w -o app/public/style src/style/*.styl",
"js": "webpack -p --config webpack.config.js",
"js:watch": "webpack -w --mode=development --config webpack.config.js",
"app": "babel src/server -d app",
"app:watch": "babel src/server -d app -w",
"build": "npm run app && npm run js && npm run css",
"watch": "concurrently --kill-others \"npm run app:watch\" \"npm run css:watch\" \"npm run js:watch\"",
"clean": "rm -rf app",
"start": "node index.js"
}, },
"keywords": [ "keywords": [
"irc" "irc"
@ -13,6 +23,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"express": "^4.16.4", "express": "^4.16.4",
"seedrandom": "^2.4.4",
"socket.io": "^2.2.0", "socket.io": "^2.2.0",
"toml": "^2.3.5" "toml": "^2.3.5"
}, },
@ -25,11 +36,14 @@
"@babel/core": "^7.2.2", "@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3", "@babel/preset-env": "^7.2.3",
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"concurrently": "^4.1.0",
"copy-webpack-plugin": "^4.6.0",
"css-loader": "^2.1.0", "css-loader": "^2.1.0",
"file-loader": "^3.0.1", "file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^0.5.0",
"standard": "^12.0.1", "standard": "^12.0.1",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2", "stylus-loader": "^3.0.2",
"webpack": "^4.28.1", "webpack": "^4.28.1",
"webpack-command": "^0.4.2" "webpack-command": "^0.4.2"

View File

@ -6,11 +6,10 @@
<title>TeemantIRC</title> <title>TeemantIRC</title>
<script src=//cdnjs.cloudflare.com/ajax/libs/seedrandom/2.3.10/seedrandom.min.js></script> <script src="//twemoji.maxcdn.com/2/twemoji.min.js?11.2"></script>
<script src=//cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/lib/js/emojione.min.js></script>
<script type="text/javascript" src="/socket.io/socket.io.js"></script> <script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="script/main.js"></script> <script type="text/javascript" src="main.js"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="style/layout.css"> <link rel="stylesheet" type="text/css" href="style/layout.css">

View File

@ -1,83 +1,90 @@
/* eslint-disable no-useless-escape, no-control-regex */
// Shamelessly copied from https://github.com/megawac/irc-style-parser/ // Shamelessly copied from https://github.com/megawac/irc-style-parser/
// Lol, I just gave credit, didn't I.. // Lol, I just gave credit, didn't I..
// Dammit, well, there's that. // Dammit, well, there's that.
const styleCheck_Re = /[\x00-\x1F]/; import { el } from './utility'
const back_re = /^(\d{1,2})(,(\d{1,2}))?/;
const colourKey = '\x03'; const styleCheckRe = /[\x00-\x1F]/
const colour_re = /\x03/g; const backRe = /^(\d{1,2})(,(\d{1,2}))?/
const styleBreak = '\x0F'; // breaks all open styles ^O (\x0F) const colourKey = '\x03'
const colourRe = /\x03/g
const styleBreak = '\x0F' // breaks all open styles ^O (\x0F)
let styles = [ let styles = [
['normal', '\x00', ''], ['underline', '\x1F'], ['normal', '\x00', ''], ['underline', '\x1F'],
['bold', '\x02'], ['italic', '\x1D'] ['bold', '\x02'], ['italic', '\x1D']
].map(function(style) { ].map(function (style) {
var escaped = encodeURI(style[1]).replace('%', '\\x'); var escaped = encodeURI(style[1]).replace('%', '\\x')
return { return {
name: style[0], name: style[0],
style: style[2] != null ? style[2] : 'irc-' + style[0], style: style[2] != null ? style[2] : 'irc-' + style[0],
key: style[1], key: style[1],
keyregex: new RegExp(escaped + '(.*?)(' + escaped + '|$)') keyregex: new RegExp(escaped + '(.*?)(' + escaped + '|$)')
}; }
}); })
//http://www.mirc.com/colors.html // http://www.mirc.com/colors.html
let colors = [ let colors = [
'white', 'black', 'navy', 'green', 'red', 'brown', 'white', 'black', 'navy', 'green', 'red', 'brown',
'purple', 'olive', 'yellow', 'lightgreen', 'teal', 'purple', 'olive', 'yellow', 'lightgreen', 'teal',
'cyan', 'blue', 'pink', 'gray', 'lightgrey' 'cyan', 'blue', 'pink', 'gray', 'lightgrey'
].reduce(function(memo, name, index) { ].reduce(function (memo, name, index) {
memo[index] = { memo[index] = {
name: name, name: name,
fore: 'irc-fg' + index, fore: 'irc-fg' + index,
back: 'irc-bg' + index, back: 'irc-bg' + index,
key: index key: index
}; }
return memo; return memo
}, {}); }, {})
function stylize(line) { function stylize (line) {
// Recheck // Recheck
if (!styleCheck_Re.test(line)) return line; if (!styleCheckRe.test(line)) return line
// split up by the irc style break character ^O // split up by the irc style break character ^O
if (line.indexOf(styleBreak) >= 0) { if (line.indexOf(styleBreak) >= 0) {
return line.split(styleBreak).map(stylize).join(''); return line.split(styleBreak).map(stylize).join('')
} }
var result = line; let result = line
var parseArr = result.split(colourKey); let parseArr = result.split(colourKey)
var text, match, colour, background = '';
for (var i = 0; i < parseArr.length; i++) {
text = parseArr[i];
match = text.match(back_re);
colour = match && colors[+match[1]];
if (!match || !colour) {
// ^C (no colour) ending. Escape current colour and carry on
background = '';
continue;
}
// set the background colour
// we don't overide the background local var to support nesting
if (colors[+match[3]]) {
background = ' ' + colors[+match[3]].back;
}
// update the parsed text result
result = result.replace(colourKey + text,
'<span class="{0}">{1}</span>'.format(colour.fore + background, text.slice(match[0].length)));
}
// Matching styles (italics/bold/underline) let text
// if only colors were this easy... let match
styles.forEach(function(style) { let colour
if (result.indexOf(style.key) < 0) return; let background = ''
result = result.replace(style.keyregex, function(match, text) { for (let i = 0; i < parseArr.length; i++) {
return '<span class="{0}">{1}</span>'.format(style.style, text); text = parseArr[i]
}); match = text.match(backRe)
}); colour = match && colors[+match[1]]
if (!match || !colour) {
// ^C (no colour) ending. Escape current colour and carry on
background = ''
continue
}
// set the background colour
// we don't overide the background local var to support nesting
if (colors[+match[3]]) {
background = ' ' + colors[+match[3]].back
}
// update the parsed text result
result = result.replace(colourKey + text, el('span', text.slice(match[0].length), [colour.fore + background]))
}
//replace the reminent colour terminations and be done with it // Matching styles (italics/bold/underline)
return result.replace(colour_re, ''); // if only colors were this easy...
styles.forEach(function (style) {
if (result.indexOf(style.key) < 0) return
result = result.replace(style.keyregex, function (match, text) {
return el('span', text, [style.style])
})
})
// replace the reminent colour terminations and be done with it
return result.replace(colourRe, '')
} }
module.exports = stylize; export default stylize

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +1,46 @@
function swapSheet(name) { function swapSheet (name) {
document.querySelector('#theme_stylesheet').setAttribute('href', 'style/'+name+'.css'); document.querySelector('#theme_stylesheet').setAttribute('href', 'style/' + name + '.css')
} }
const themes = module.exports = { window.themes = module.exports = {
available: { available: {
default: { default: {
name: 'Default', name: 'Default',
type: 'bright', type: 'bright',
nick_pallete: { nick_pallete: {
H: [1, 360], H: [1, 360],
S: [30, 100], S: [30, 100],
L: [30, 70] L: [30, 70]
}, },
stylesheet: 'theme_default', stylesheet: 'theme_default',
default: true, default: true,
colorSamples: { colorSamples: {
toolbar: '#00c7e0', toolbar: '#00c7e0',
background: '#f5f5f5' background: '#f5f5f5'
} }
}, },
night: { night: {
name: 'Night', name: 'Night',
type: 'dark', type: 'dark',
nick_pallete: { nick_pallete: {
H: [1, 360], H: [1, 360],
S: [30, 100], S: [30, 100],
L: [50, 100] L: [50, 100]
}, },
stylesheet: 'theme_night', stylesheet: 'theme_night',
default: false, default: false,
colorSamples: { colorSamples: {
toolbar: '#008e8e', toolbar: '#008e8e',
background: '#1d1d1d' background: '#1d1d1d'
} }
} }
}, },
change_theme: function(name) { change_theme: function (name) {
if(name in themes.available) { if (name in window.themes.available) {
swapSheet(themes.available[name].stylesheet); swapSheet(window.themes.available[name].stylesheet)
window.irc.config.theme = name; window.irc.config.theme = name
} }
} }
}; }

185
src/js/utility.js Normal file
View File

@ -0,0 +1,185 @@
import util from 'util'
// Create element
export function el (element, content, classes, id) {
let _el = document.createElement(element)
_el.innerHTML = content
_el.classList = classes || []
if (id) _el.id = id
return _el.outerHTML
}
export function span (content, classes, id) {
return el('span', content, classes, id)
}
// String format
export function sf () {
return util.format.apply(null, arguments)
}
export function formatDate (date, format, utc) {
var MMMM = ['\x00', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
var MMM = ['\x01', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
var dddd = ['\x02', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
var ddd = ['\x03', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
function ii (i, len) { var s = i + ''; len = len || 2; while (s.length < len) s = '0' + s; return s }
var y = utc ? date.getUTCFullYear() : date.getFullYear()
format = format.replace(/(^|[^\\])yyyy+/g, '$1' + y)
format = format.replace(/(^|[^\\])yy/g, '$1' + y.toString().substr(2, 2))
format = format.replace(/(^|[^\\])y/g, '$1' + y)
var M = (utc ? date.getUTCMonth() : date.getMonth()) + 1
format = format.replace(/(^|[^\\])MMMM+/g, '$1' + MMMM[0])
format = format.replace(/(^|[^\\])MMM/g, '$1' + MMM[0])
format = format.replace(/(^|[^\\])MM/g, '$1' + ii(M))
format = format.replace(/(^|[^\\])M/g, '$1' + M)
var d = utc ? date.getUTCDate() : date.getDate()
format = format.replace(/(^|[^\\])dddd+/g, '$1' + dddd[0])
format = format.replace(/(^|[^\\])ddd/g, '$1' + ddd[0])
format = format.replace(/(^|[^\\])dd/g, '$1' + ii(d))
format = format.replace(/(^|[^\\])d/g, '$1' + d)
var H = utc ? date.getUTCHours() : date.getHours()
format = format.replace(/(^|[^\\])HH+/g, '$1' + ii(H))
format = format.replace(/(^|[^\\])H/g, '$1' + H)
var h = H > 12 ? H - 12 : H === 0 ? 12 : H
format = format.replace(/(^|[^\\])hh+/g, '$1' + ii(h))
format = format.replace(/(^|[^\\])h/g, '$1' + h)
var m = utc ? date.getUTCMinutes() : date.getMinutes()
format = format.replace(/(^|[^\\])mm+/g, '$1' + ii(m))
format = format.replace(/(^|[^\\])m/g, '$1' + m)
var s = utc ? date.getUTCSeconds() : date.getSeconds()
format = format.replace(/(^|[^\\])ss+/g, '$1' + ii(s))
format = format.replace(/(^|[^\\])s/g, '$1' + s)
var f = utc ? date.getUTCMilliseconds() : date.getMilliseconds()
format = format.replace(/(^|[^\\])fff+/g, '$1' + ii(f, 3))
f = Math.round(f / 10)
format = format.replace(/(^|[^\\])ff/g, '$1' + ii(f))
f = Math.round(f / 10)
format = format.replace(/(^|[^\\])f/g, '$1' + f)
var T = H < 12 ? 'AM' : 'PM'
format = format.replace(/(^|[^\\])TT+/g, '$1' + T)
format = format.replace(/(^|[^\\])T/g, '$1' + T.charAt(0))
var t = T.toLowerCase()
format = format.replace(/(^|[^\\])tt+/g, '$1' + t)
format = format.replace(/(^|[^\\])t/g, '$1' + t.charAt(0))
var tz = -date.getTimezoneOffset()
var K = utc || !tz ? 'Z' : tz > 0 ? '+' : '-'
if (!utc) {
tz = Math.abs(tz)
var tzHrs = Math.floor(tz / 60)
var tzMin = tz % 60
K += ii(tzHrs) + ':' + ii(tzMin)
}
format = format.replace(/(^|[^\\])K/g, '$1' + K)
var day = (utc ? date.getUTCDay() : date.getDay()) + 1
format = format.replace(new RegExp(dddd[0], 'g'), dddd[day])
format = format.replace(new RegExp(ddd[0], 'g'), ddd[day])
format = format.replace(new RegExp(MMMM[0], 'g'), MMMM[M])
format = format.replace(new RegExp(MMM[0], 'g'), MMM[M])
format = format.replace(/\\(.)/g, '$1')
return format
}
export function rand (randgen, min, max) {
return parseInt(randgen() * (max - min + 1), 10) + min
}
export function removeStr (arr, str) {
let index = arr.indexOf(str)
if (index > -1) {
arr.splice(index, 1)
return arr
}
return arr
}
export function grep (items, callback) {
let filtered = []
for (let i in items) {
let item = items[i]
let cond = callback(item)
if (cond) {
filtered.push(item)
}
}
return filtered
}
export function match (word, array) {
return grep(
array,
function (w) {
return w.toLowerCase().indexOf(word.toLowerCase()) === 0
}
)
}
export function serialize (obj) {
let str = []
for (let p in obj) {
if (obj.hasOwnProperty(p)) {
str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]))
}
}
return str.join('&')
}
export function removeClass (element, cl) {
let classList = element.className.split(' ')
if (classList.indexOf(cl) !== -1) {
classList.splice(classList.indexOf(cl), 1)
}
element.className = classList.join(' ')
}
export function addClass (element, cl) {
let classList = element.className.split(' ')
if (classList.indexOf(cl) !== -1) {
return
}
classList.push(cl)
element.className = classList.join(' ')
}
export function toggleClass (element, cl) {
let classList = element.className.split(' ')
if (classList.indexOf(cl) !== -1) {
removeClass(element, cl)
} else {
addClass(element, cl)
}
}
export function objectGetKey (obj, value) {
let key = null
for (let f in obj) {
if (obj[f] === value) {
key = f
}
}
return key
}

28
teemant.js → src/server/index.js Executable file → Normal file
View File

@ -1,20 +1,19 @@
#!/usr/bin/env node
'use strict' 'use strict'
import express from 'express' import express from 'express'
import path from 'path' import path from 'path'
import sockio from 'socket.io' import sockio from 'socket.io'
import dns from 'dns' import dns from 'dns'
import pkginfo from './package.json' import pkginfo from '../package.json'
import irclib from './server/irc' import irclib from './irc'
import webirc from './server/webirc' import webirc from './webirc'
import config from './server/config' import config from './config'
import logger from './server/logger' import logger from './logger'
const app = express() const app = express()
const router = express.Router() const router = express.Router()
const pubdir = path.join(__dirname, 'build') const pubdir = path.join(__dirname, 'public')
const port = config.server.port || 8080 const port = config.server.port || 8080
const cacheAge = 365 * 24 * 60 * 60 * 1000 const cacheAge = 365 * 24 * 60 * 60 * 1000
@ -36,16 +35,16 @@ let customCTCPs = {
process.stdin.resume() process.stdin.resume()
router.get('/', function (req, res) { router.get('/', function (req, res) {
res.sendFile(path.join(pubdir, '/document/index.html')) res.sendFile(path.join(pubdir, '/index.html'))
}) })
router.get('/:server?*', function (req, res) { router.get('/:server?*', function (req, res) {
res.sendFile(path.join(pubdir, '/document/index.html')) res.sendFile(path.join(pubdir, '/index.html'))
}) })
app.use('/', express.static(pubdir, { maxAge: cacheAge })) app.use('/', express.static(pubdir, { maxAge: cacheAge }))
app.use('/', express.static(path.join(pubdir, 'icons'), { maxAge: cacheAge })) app.use('/', express.static(path.join(pubdir, 'icons'), { maxAge: cacheAge }))
app.use('/', express.static(path.join(__dirname, 'static'), { maxAge: cacheAge })) app.use('/', express.static(path.join(pubdir, 'static'), { maxAge: cacheAge }))
app.use('/:server', express.static(pubdir, { maxAge: cacheAge })) app.use('/:server', express.static(pubdir, { maxAge: cacheAge }))
app.use('/:server', express.static(path.join(pubdir, 'icons'), { maxAge: cacheAge })) app.use('/:server', express.static(path.join(pubdir, 'icons'), { maxAge: cacheAge }))
@ -116,7 +115,7 @@ io.sockets.on('connection', function (socket) {
delete connections[socket.id] delete connections[socket.id]
logger.debugLog('clientID: {0} disconnect'.format(socket.id)) logger.debugLog(`clientID: ${socket.id} disconnect`)
}) })
socket.on('error', (e) => { socket.on('error', (e) => {
@ -130,7 +129,12 @@ io.sockets.on('connection', function (socket) {
logger.debugLog(`[${socket.id}] ->`, data) logger.debugLog(`[${socket.id}] ->`, data)
serv.handler.handleUserLine(data) try {
serv.handler.handleUserLine(data)
} catch (e) {
console.error('An error occured while handling message from client', data)
console.error(e.stack)
}
}) })
socket.on('irc_create', function (connectiondata) { socket.on('irc_create', function (connectiondata) {

View File

@ -471,7 +471,7 @@ class IRCConnectionHandler {
// start whois queue // start whois queue
list = { list = {
nickname: line.arguments[1], nickname: line.arguments[1],
hostmask: '%s!%s@%s'.format(line.arguments[1], line.arguments[2], line.arguments[3]), hostmask: util.format('%s!%s@%s', line.arguments[1], line.arguments[2], line.arguments[3]),
realname: line.trailing || '' realname: line.trailing || ''
} }
this.whoisManage(line.arguments[1], list) this.whoisManage(line.arguments[1], list)
@ -652,7 +652,7 @@ class IRCConnection extends EventEmitter {
buffer = data.pop() buffer = data.pop()
data.forEach((line) => { data.forEach((line) => {
if (line.indexOf('PING') === 0) { if (line.indexOf('PING') === 0) {
this.socket.write('PONG %s\r\n', line.substring(4)) this.write('PONG %s\r\n', line.substring(4))
return return
} }
@ -660,7 +660,13 @@ class IRCConnection extends EventEmitter {
let parsed = parse(line) let parsed = parse(line)
this.emit('line', parsed) this.emit('line', parsed)
this.handler.handleServerLine(parsed)
try {
this.handler.handleServerLine(parsed)
} catch (e) {
console.error('An error occured while handling parsed server line', parsed)
console.error(e.stack)
}
}) })
}) })
@ -676,7 +682,7 @@ class IRCConnection extends EventEmitter {
authenticate () { authenticate () {
if (this.config.password) { if (this.config.password) {
this.socket.write('PASS %s\r\n', this.config.password) this.write('PASS %s\r\n', this.config.password)
} }
if (this.extras.authenticationSteps) { if (this.extras.authenticationSteps) {
@ -686,8 +692,8 @@ class IRCConnection extends EventEmitter {
} }
} }
this.socket.write('USER %s 8 * :%s\r\n', this.config.username, this.config.realname) this.write('USER %s 8 * :%s\r\n', this.config.username, this.config.realname)
this.socket.write('NICK %s\r\n', this.config.nickname) this.write('NICK %s\r\n', this.config.nickname)
} }
disconnect (message) { disconnect (message) {
@ -697,7 +703,7 @@ class IRCConnection extends EventEmitter {
} }
this.queue['close'] = true this.queue['close'] = true
this.socket.write('QUIT :%s\r\n', (message != null ? message : this.globalConfig.default_quit_msg)) this.write('QUIT :%s\r\n', (message != null ? message : this.globalConfig.default_quit_msg))
} }
write () { write () {

View File

@ -2,8 +2,8 @@ import dns from 'dns'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
import config from './server/config' import config from './config'
import logger from './server/logger' import logger from './logger'
const webircDataPath = path.join(__dirname, '..', 'webirc.data.json') const webircDataPath = path.join(__dirname, '..', 'webirc.data.json')

View File

@ -181,7 +181,7 @@ body
margin-left: 4px; margin-left: 4px;
border-radius: 5px; border-radius: 5px;
vertical-align: bottom; vertical-align: bottom;
.emojione .emoji
width: 20px; width: 20px;
height: 20px; height: 20px;
vertical-align: sub; vertical-align: sub;

View File

@ -2,13 +2,14 @@
const webpack = require('webpack') const webpack = require('webpack')
const path = require('path') const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = { module.exports = {
entry: { entry: {
main: './src/js/main' main: './src/js/main'
}, },
output: { output: {
path: path.join(__dirname, 'dist', 'js'), path: path.join(__dirname, 'app', 'public'),
filename: '[name].js' filename: '[name].js'
}, },
module: { module: {
@ -22,10 +23,6 @@ module.exports = {
presets: [ '@babel/preset-env' ] presets: [ '@babel/preset-env' ]
} }
} }
},
{
test: /src\/style\/.+\.styl$/,
loader: 'file-loader?name=./dist/style/[name].css!css-loader!stylus-loader'
} }
] ]
}, },
@ -33,7 +30,15 @@ module.exports = {
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
// Detect and inject // Detect and inject
_: 'underscore' _: 'underscore'
}) }),
new CopyWebpackPlugin([{
from: 'src/document/index.html',
to: '.'
},
{
from: 'static',
to: 'static'
}])
], ],
devtool: 'inline-source-map' devtool: 'inline-source-map'
} }