Updating to redirect to correct domain

This commit is contained in:
Glitch (jasonsplant) 2020-05-06 02:20:43 +00:00
parent d0b78e45a7
commit 713909baf1
4 changed files with 38 additions and 23 deletions

View File

@ -7,6 +7,10 @@ const app = express();
// Handle requests for the root page by serving the static index.html from the views folder // Handle requests for the root page by serving the static index.html from the views folder
app.get("/", function(req, res) { app.get("/", function(req, res) {
if (!req.headers['x-real-host'] && req.headers.host.includes('glitch.me')) {
return res.redirect('https://www.jasonsplant.ml' + req.url);
}
res.sendFile(__dirname + "/views/index.html"); res.sendFile(__dirname + "/views/index.html");
}); });

View File

@ -3,7 +3,6 @@ const twit = require('twit')
require('dotenv').config({path: path.join(__dirname, '../../.env')}) require('dotenv').config({path: path.join(__dirname, '../../.env')})
const alert = (type) => { const alert = (type) => {
console.log('Alert triggered for type: ' + type)
var tweet = false var tweet = false
switch(type) { switch(type) {

View File

@ -54,7 +54,7 @@ const Readings = sequelize.define('readings', {
// If the first low reading was more than 4 days ago, send an alert // If the first low reading was more than 4 days ago, send an alert
if (lowtriggered > fourdays) { if (lowtriggered > fourdays) {
// Send alert that water is needed // Send alert that water is needed
message('needwater') message('wantwater')
// Flag that an alert has been sent // Flag that an alert has been sent
Settings.update({ value: new Date().toISOString() }, { where: { key: 'alert' } }) Settings.update({ value: new Date().toISOString() }, { where: { key: 'alert' } })

View File

@ -1,27 +1,28 @@
dependencies: dependencies:
dotenv: 8.2.0 dotenv: 8.2.0
express: 4.17.1 express: 4.17.1
sequelize: 5.21.6 sequelize: 5.21.7
sqlite3: 4.1.1 sqlite3: 4.1.1
twit: 2.2.11
packages: packages:
/@types/node/13.11.1: /@types/node/13.13.2:
dev: false dev: false
resolution: resolution:
integrity: sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g== integrity: sha512-LB2R1Oyhpg8gu4SON/mfforE525+Hi/M1ineICEDftqNVTyFg1aRIeGuTvXAoWHc4nbrFncWtJgMmoyRvuGh7A==
/abbrev/1.1.1: /abbrev/1.1.1:
dev: false dev: false
resolution: resolution:
integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
/accepts/1.3.7: /accepts/1.3.7:
dependencies: dependencies:
mime-types: 2.1.26 mime-types: 2.1.27
negotiator: 0.6.2 negotiator: 0.6.2
dev: false dev: false
engines: engines:
node: '>= 0.6' node: '>= 0.6'
resolution: resolution:
integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==
/ajv/6.12.0: /ajv/6.12.2:
dependencies: dependencies:
fast-deep-equal: 3.1.1 fast-deep-equal: 3.1.1
fast-json-stable-stringify: 2.1.0 fast-json-stable-stringify: 2.1.0
@ -29,7 +30,7 @@ packages:
uri-js: 4.2.2 uri-js: 4.2.2
dev: false dev: false
resolution: resolution:
integrity: sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== integrity: sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==
/ansi-regex/2.1.1: /ansi-regex/2.1.1:
dev: false dev: false
engines: engines:
@ -373,7 +374,7 @@ packages:
dependencies: dependencies:
asynckit: 0.4.0 asynckit: 0.4.0
combined-stream: 1.0.8 combined-stream: 1.0.8
mime-types: 2.1.26 mime-types: 2.1.27
dev: false dev: false
engines: engines:
node: '>= 0.12' node: '>= 0.12'
@ -439,7 +440,7 @@ packages:
integrity: sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= integrity: sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=
/har-validator/5.1.3: /har-validator/5.1.3:
dependencies: dependencies:
ajv: 6.12.0 ajv: 6.12.2
har-schema: 2.0.0 har-schema: 2.0.0
dev: false dev: false
engines: engines:
@ -609,20 +610,20 @@ packages:
node: '>= 0.6' node: '>= 0.6'
resolution: resolution:
integrity: sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= integrity: sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
/mime-db/1.43.0: /mime-db/1.44.0:
dev: false dev: false
engines: engines:
node: '>= 0.6' node: '>= 0.6'
resolution: resolution:
integrity: sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ== integrity: sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==
/mime-types/2.1.26: /mime-types/2.1.27:
dependencies: dependencies:
mime-db: 1.43.0 mime-db: 1.44.0
dev: false dev: false
engines: engines:
node: '>= 0.6' node: '>= 0.6'
resolution: resolution:
integrity: sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ== integrity: sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==
/mime/1.6.0: /mime/1.6.0:
dev: false dev: false
engines: engines:
@ -682,10 +683,10 @@ packages:
dev: false dev: false
resolution: resolution:
integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
/nan/2.14.0: /nan/2.14.1:
dev: false dev: false
resolution: resolution:
integrity: sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== integrity: sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
/needle/2.4.1: /needle/2.4.1:
dependencies: dependencies:
debug: 3.2.6 debug: 3.2.6
@ -911,7 +912,7 @@ packages:
is-typedarray: 1.0.0 is-typedarray: 1.0.0
isstream: 0.1.2 isstream: 0.1.2
json-stringify-safe: 5.0.1 json-stringify-safe: 5.0.1
mime-types: 2.1.26 mime-types: 2.1.27
oauth-sign: 0.9.0 oauth-sign: 0.9.0
performance-now: 2.1.0 performance-now: 2.1.0
qs: 6.5.2 qs: 6.5.2
@ -990,7 +991,7 @@ packages:
node: '>= 6.0.0' node: '>= 6.0.0'
resolution: resolution:
integrity: sha512-Ibz08vnXvkZ8LJTiUOxRcj1Ckdn7qafNZ2t59jYHMX1VIebTAOYefWdRYFt6z6+hy52WGthAHAoLc9hvk3onqA== integrity: sha512-Ibz08vnXvkZ8LJTiUOxRcj1Ckdn7qafNZ2t59jYHMX1VIebTAOYefWdRYFt6z6+hy52WGthAHAoLc9hvk3onqA==
/sequelize/5.21.6: /sequelize/5.21.7:
dependencies: dependencies:
bluebird: 3.7.2 bluebird: 3.7.2
cls-bluebird: 2.1.0 cls-bluebird: 2.1.0
@ -1011,7 +1012,7 @@ packages:
engines: engines:
node: '>=6.0.0' node: '>=6.0.0'
resolution: resolution:
integrity: sha512-RsgEpP2PP7txeoTWxoLLoe3xX8R2WYQAO7LNba2Ok3/pV5EFfKZry4fJXH56DUHJB909msMCHg0CJKDsQVbjcQ== integrity: sha512-+JrS5Co7CN53cOFFFaUb+xqQP00wD1Ag9xGLBLoUko2KhRZxjm+UDkqAVPHTUp87McLwJaCPkKv61GPhBVloRQ==
/serve-static/1.14.1: /serve-static/1.14.1:
dependencies: dependencies:
encodeurl: 1.0.2 encodeurl: 1.0.2
@ -1041,7 +1042,7 @@ packages:
integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
/sqlite3/4.1.1: /sqlite3/4.1.1:
dependencies: dependencies:
nan: 2.14.0 nan: 2.14.1
node-pre-gyp: 0.11.0 node-pre-gyp: 0.11.0
request: 2.88.2 request: 2.88.2
dev: false dev: false
@ -1161,10 +1162,20 @@ packages:
dev: false dev: false
resolution: resolution:
integrity: sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= integrity: sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
/twit/2.2.11:
dependencies:
bluebird: 3.7.2
mime: 1.6.0
request: 2.88.2
dev: false
engines:
node: '>=0.10.0'
resolution:
integrity: sha512-BkdwvZGRVoUTcEBp0zuocuqfih4LB+kEFUWkWJOVBg6pAE9Ebv9vmsYTTrfXleZGf45Bj5H3A1/O9YhF2uSYNg==
/type-is/1.6.18: /type-is/1.6.18:
dependencies: dependencies:
media-typer: 0.3.0 media-typer: 0.3.0
mime-types: 2.1.26 mime-types: 2.1.27
dev: false dev: false
engines: engines:
node: '>= 0.6' node: '>= 0.6'
@ -1227,7 +1238,7 @@ packages:
integrity: sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== integrity: sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==
/wkx/0.4.8: /wkx/0.4.8:
dependencies: dependencies:
'@types/node': 13.11.1 '@types/node': 13.13.2
dev: false dev: false
resolution: resolution:
integrity: sha512-ikPXMM9IR/gy/LwiOSqWlSL3X/J5uk9EO2hHNRXS41eTLXaUFEVw9fn/593jW/tE5tedNg8YjT5HkCa4FqQZyQ== integrity: sha512-ikPXMM9IR/gy/LwiOSqWlSL3X/J5uk9EO2hHNRXS41eTLXaUFEVw9fn/593jW/tE5tedNg8YjT5HkCa4FqQZyQ==
@ -1247,3 +1258,4 @@ specifiers:
express: ^4.17.1 express: ^4.17.1
sequelize: '*' sequelize: '*'
sqlite3: '*' sqlite3: '*'
twit: ^2.2.11