-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewritten project in Node.js from PHP
- Loading branch information
Ernest Paśnik
committed
Dec 10, 2023
1 parent
c0970d8
commit 7aabc3d
Showing
118 changed files
with
2,376 additions
and
3,713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,8 @@ jobs: | |
|
||
- name: Deploy with rsync | ||
# WATCH OUT!!! DO NOT ADD SPACES INSIDE BRACES BETWEEN ARGUMENTS OR THE ENTIRE WEBSITE WILL BE WIPED OUT! | ||
run: rsync --exclude={'src/data','vendor','builds','.git','.github','.env'} -avzP . [email protected]:/var/www/html --delete-after | ||
run: rsync --exclude={'public/arenas','private','node_modules','.git','.github','.env'} -avzP . [email protected]:/var/www/app --delete-after | ||
|
||
- name: Restart PM2 | ||
run: | | ||
ssh [email protected] "pm2 restart app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,131 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.vscode | ||
cache | ||
vendor | ||
src/data | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
# Extra | ||
private | ||
public/arenas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,30 @@ | ||
# Hypersomnia homepage | ||
|
||
Currently hosted at https://hypersomnia.xyz | ||
# Hypersomnia Website | ||
https://hypersomnia.xyz/ | ||
|
||
## Installation | ||
|
||
Node.js | ||
```bash | ||
sudo add-apt-repository ppa:ondrej/php | ||
sudo apt update | ||
sudo apt install -y curl memcached php8.2-fpm php8.2-{zip,curl,xml,memcached} | ||
curl -sSL https://getcomposer.org/installer | php | ||
sudo mv composer.phar /usr/local/bin/composer | ||
cd /var/www/html && composer update | ||
sudo apt-get update | ||
sudo apt-get install -y ca-certificates curl gnupg | ||
sudo mkdir -p /etc/apt/keyrings | ||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | ||
NODE_MAJOR=20 | ||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list | ||
sudo apt-get update | ||
sudo apt-get install nodejs -y | ||
``` | ||
|
||
## Configuration | ||
|
||
`/etc/memcached.conf` | ||
```conf | ||
-d | ||
logfile /var/log/memcached.log | ||
-s /var/run/memcached/memcached.sock | ||
-a 666 | ||
-m 64 | ||
-u memcache | ||
-P /var/run/memcached/memcached.pid | ||
Website | ||
```bash | ||
cd /var/www/app | ||
npm install | ||
sudo npm install -g pm2 | ||
pm2 start app.js | ||
``` | ||
|
||
`/var/www/html/.env` | ||
## Configuration | ||
.env | ||
```env | ||
# Cache (true or false) | ||
CACHE=false | ||
# Memcached | ||
MEMCACHED_HOST=/var/run/memcached/memcached.sock | ||
MEMCACHED_PORT=0 | ||
# Path to arenas | ||
ARENAS_PATH=C:\hypersomnia\content\arenas | ||
# YouTube API Key | ||
APIKEY_YOUTUBE= | ||
# Admins (comma-separated format) | ||
ADMINS=550080230161645592,231574084931026944 | ||
# Discord OAuth settings | ||
DISCORD_CLIENT_ID= | ||
DISCORD_CLIENT_SECRET= | ||
STEAM_APIKEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
SESSION_SECRET="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require('dotenv').config(); | ||
const express = require('express'); | ||
const session = require('express-session'); | ||
const passport = require('passport'); | ||
const passportSteam = require('passport-steam'); | ||
const SteamStrategy = passportSteam.Strategy; | ||
const app = express(); | ||
|
||
passport.serializeUser(function (user, done) { | ||
done(null, user); | ||
}); | ||
|
||
passport.deserializeUser(function (obj, done) { | ||
done(null, obj); | ||
}); | ||
|
||
passport.use(new SteamStrategy({ | ||
returnURL: 'https://hypersomnia.xyz/auth/steam/return', | ||
realm: 'https://hypersomnia.xyz/', | ||
apiKey: process.env.STEAM_APIKEY | ||
}, | ||
function (identifier, profile, done) { | ||
process.nextTick(function () { | ||
profile.identifier = identifier; | ||
return done(null, profile); | ||
}); | ||
} | ||
)); | ||
|
||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'ejs'); | ||
app.use(session({ | ||
secret: process.env.SESSION_SECRET, | ||
resave: true, | ||
saveUninitialized: true | ||
})); | ||
app.use(passport.initialize()); | ||
app.use(passport.session()); | ||
app.use(express.static(__dirname + '/public')); | ||
app.locals = { | ||
arena: false, | ||
version: 3, | ||
alert: 'Wishlist now. <a href="https://store.steampowered.com/app/2660970/Hypersomnia/" target="_blank">https://store.steampowered.com/app/2660970/Hypersomnia/</a>' | ||
}; | ||
require(__dirname + '/src/routes')(app, passport); | ||
app.listen(3000); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.