diff options
| author | 8cy <[email protected]> | 2020-05-05 17:20:56 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-05-05 17:20:56 -0700 |
| commit | a9736fde2706e37aac691184e78f7686e1dd76aa (patch) | |
| tree | 941e121d9df6bf56e0bef3e9f887cbc56a843946 /spike | |
| parent | update dependencies (diff) | |
| download | dep-core-a9736fde2706e37aac691184e78f7686e1dd76aa.tar.xz dep-core-a9736fde2706e37aac691184e78f7686e1dd76aa.zip | |
add api, change sementic version tag
because of adding an api, a change was need to Procfile, making it a web process in heroku
i also removed unused dependencies from the webserver file and made responses into json objects
dont worry, i am using uptime robot ;)
- renamed ws to server
-changed sementic version from v10.0.0 to v1.10.0, minecraft versions :D
Diffstat (limited to 'spike')
| -rw-r--r-- | spike/ws/css/main.css (renamed from spike/ws/public/css/main.css) | 0 | ||||
| -rw-r--r-- | spike/ws/layouts/layout.hbs | 20 | ||||
| -rw-r--r-- | spike/ws/views/error.hbs | 1 | ||||
| -rw-r--r-- | spike/ws/views/index.hbs | 2 | ||||
| -rw-r--r-- | spike/ws/ws.ts | 54 |
5 files changed, 2 insertions, 75 deletions
diff --git a/spike/ws/public/css/main.css b/spike/ws/css/main.css index 993c46a..993c46a 100644 --- a/spike/ws/public/css/main.css +++ b/spike/ws/css/main.css diff --git a/spike/ws/layouts/layout.hbs b/spike/ws/layouts/layout.hbs index 844e9da..7d0785a 100644 --- a/spike/ws/layouts/layout.hbs +++ b/spike/ws/layouts/layout.hbs @@ -1,19 +1 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>{{title}}</title> - <link rel="stylesheet" href="css/main.css"> - <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> - </head> - <body> - <div title="Status: Online"> - {{body}} - </div> - - <div class="footer"> - <p>Copyright © 2020 - <a href="https://cyne.cf">s1nical</a></p> - </div> - </body> -</html>
\ No newline at end of file +{{body}}
\ No newline at end of file diff --git a/spike/ws/views/error.hbs b/spike/ws/views/error.hbs deleted file mode 100644 index fe49573..0000000 --- a/spike/ws/views/error.hbs +++ /dev/null @@ -1 +0,0 @@ -Error: {{errtype}}
\ No newline at end of file diff --git a/spike/ws/views/index.hbs b/spike/ws/views/index.hbs index 5253033..b815c9b 100644 --- a/spike/ws/views/index.hbs +++ b/spike/ws/views/index.hbs @@ -1 +1 @@ -Status: Online
\ No newline at end of file +{{response}}
\ No newline at end of file diff --git a/spike/ws/ws.ts b/spike/ws/ws.ts deleted file mode 100644 index 08f9581..0000000 --- a/spike/ws/ws.ts +++ /dev/null @@ -1,54 +0,0 @@ -import express from 'express'; -import hbs from 'express-handlebars'; -import bodyParser from 'body-parser'; -import path from 'path'; - -class WebSocket { - constructor(token, port, client) { - this.token = token; - this.client = client; - - this.app = express() - this.app.engine('hbs', hbs({ - extname: 'hbs', - defaultLayout: 'layout', - layoutsDir: __dirname + '/layouts' - })) - this.app.set('views', path.join(__dirname, 'views')) - this.app.set('view engine', 'hbs') - this.app.use(express.static(path.join(__dirname, 'public'))) - this.app.use(bodyParser.urlencoded({ extended: false })) - this.app.use(bodyParser.json()) - - this.registerRoots() - - this.server = this.app.listen(port, () => { - console.log(`Websocket listening on port ${this.server.address().port}`) - }) - } - - checkToken(_token) { - return (_token == this.token) - } - - // http://localhost:port?token=123456 - registerRoots() { - this.app.get('/', (req, res) => { - var _token = req.query.token - // if (!this.checkToken(_token)) { - // res.render('error', { - // title: 's1nical - Error', - // errtype: 'INVALID TOKEN' - // }) - // return - // } - - res.render('index', { - title: 'Uwufier - Status', - token: _token - }) - }) - } -} - -module.exports = WebSocket
\ No newline at end of file |