Merge branch 'develop' into menu-tabs

This commit is contained in:
ntr 2019-09-03 17:02:18 +10:00
commit b8c1380f88
18 changed files with 70 additions and 40 deletions

View File

@ -1 +1 @@
0.3.0 1.1.0

View File

@ -4,18 +4,18 @@
* ACP * ACP
* essential * essential
* serde serialize privatise * serde serialize privatise
* DO postgres
* mobile styles * mobile styles
* can't reset password without knowing password =\
* treats * treats
* constructs jiggle when clicked * constructs jiggle when clicked
* background colour changes depending on time of day * background colour changes depending on time of day
* other * bug fixes
* skill pane bigger * pvp 1st round doesn't resolve until warden timer completes
* add colours and speed -> Skill > <B></B>B
* bot game grind * bot game grind
* stress test
* change score to enum * change score to enum
* pct based translates for combat animation * pct based translates for combat animation
@ -23,6 +23,8 @@
* send account_instances on players update * send account_instances on players update
* convert PlusPlus to ++ or rename * convert PlusPlus to ++ or rename
* add speed to descriptions
* add components to description e.g. Strike (red circle red circle attack)
* clear skill (if currently targetted) * clear skill (if currently targetted)
* increase power to speed up early rounds * increase power to speed up early rounds
@ -60,12 +62,6 @@ mobile info page
reconnect based on time delta reconnect based on time delta
consolidate game and instance consolidate game and instance
ah man
the ready screen should totally be
your constructs facing off against the other guy
the chatwheel
and a ready button
*SERVER* *SERVER*
* vbox drops chances * vbox drops chances
* 50% spec, 25% colour etc * 50% spec, 25% colour etc
@ -73,7 +69,6 @@ and a ready button
* mnml tv * mnml tv
## LATER ## LATER
* chat
* elo + leaderboards * elo + leaderboards
* constants * constants
* change to ownership pattern * change to ownership pattern

View File

@ -1,6 +1,6 @@
{ {
"name": "mnml-client", "name": "mnml-client",
"version": "0.3.0", "version": "1.1.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -23,6 +23,7 @@ ssh -q "$TARGET" ls -lah "$SERVER_BIN_DIR"
echo "syncing client $VERSION" echo "syncing client $VERSION"
rsync -a --delete --delete-excluded "$MNML_PATH/client/dist/" "$TARGET:$CLIENT_DIST_DIR/$VERSION/" rsync -a --delete --delete-excluded "$MNML_PATH/client/dist/" "$TARGET:$CLIENT_DIST_DIR/$VERSION/"
ssh -q "$TARGET" ln -nfs "$CLIENT_DIST_DIR/$VERSION" "$CLIENT_PUBLIC_DIR" ssh -q "$TARGET" ln -nfs "$CLIENT_DIST_DIR/$VERSION" "$CLIENT_PUBLIC_DIR"
ssh -q "$TARGET" ls -lah "$CLIENT_DIST_DIR"
echo "restarting mnml service" echo "restarting mnml service"
ssh -q -t "$TARGET" sudo service mnml restart && sleep 1 && systemctl --no-pager status mnml ssh -q -t "$TARGET" sudo service mnml restart && sleep 1 && systemctl --no-pager status mnml

15
bin/version.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# bless you chris and andy <3
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
MNML_PATH=$(realpath "$DIR/../")
VERSION=$1
echo "Setting version to $VERSION"
echo $VERSION | tr -d '\n' > VERSION
cd $MNML_PATH/server && sed -i "/^version/c\version = \"$VERSION\"" Cargo.toml
cd $MNML_PATH/ops && npm --allow-same-version --no-git-tag-version version "$VERSION"
cd $MNML_PATH/client && npm --allow-same-version --no-git-tag-version version "$VERSION"
cd $MNML_PATH/acp && npm --allow-same-version --no-git-tag-version version "$VERSION"

View File

@ -1,6 +1,6 @@
{ {
"name": "mnml-client", "name": "mnml-client",
"version": "0.3.0", "version": "1.1.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -13,6 +13,11 @@ const registerEvents = require('./events');
const Mnml = require('./components/mnml'); const Mnml = require('./components/mnml');
function stripeKey() {
if (window.location.host === 'mnml.gg') return 'pk_live_fQGrL1uWww2ot8W1G7vTySAv004ygmnMXq';
return 'pk_test_Cb49tTqTXpzk7nEmlGzRrNJg00AU0aNZDj';
}
// Redux Store // Redux Store
const store = createStore( const store = createStore(
combineReducers(reducers), combineReducers(reducers),
@ -30,7 +35,7 @@ document.fonts.load('16pt "Jura"').then(() => {
const App = () => ( const App = () => (
<Provider store={store}> <Provider store={store}>
<StripeProvider apiKey="pk_test_Cb49tTqTXpzk7nEmlGzRrNJg00AU0aNZDj"> <StripeProvider apiKey={stripeKey()}>
<Mnml /> <Mnml />
</StripeProvider> </StripeProvider>
</Provider> </Provider>

View File

@ -1,6 +1,16 @@
const preact = require('preact'); const preact = require('preact');
const { injectStripe } = require('react-stripe-elements'); const { injectStripe } = require('react-stripe-elements');
function subPlan() {
if (window.location.host === 'mnml.gg') return 'plan_Fjdtsd4i7aVLe1';
return 'prod_FWSA8RoyMMV3st';
}
function bitsSku() {
if (window.location.host === 'mnml.gg') return 'sku_Fjdu7zOy3sLGc5';
return 'sku_FjuNxONdWewjH2';
}
function BitsBtn(args) { function BitsBtn(args) {
const { const {
stripe, stripe,
@ -8,18 +18,18 @@ function BitsBtn(args) {
} = args; } = args;
function subscribeClick() { function subscribeClick() {
stripe.redirectToCheckout({ stripe.redirectToCheckout({
items: [{ plan: 'plan_Fhl9r7UdMadjGi', quantity: 1 }], items: [{ plan: subPlan(), quantity: 1 }],
successUrl: 'http://localhost', successUrl: window.location.origin,
cancelUrl: 'http://localhost', cancelUrl: window.location.origin,
clientReferenceId: account.id, clientReferenceId: account.id,
}); });
} }
function bitsClick() { function bitsClick() {
stripe.redirectToCheckout({ stripe.redirectToCheckout({
items: [{ sku: 'sku_FHUfNEhWQaVDaT', quantity: 1 }], items: [{ sku: bitsSku(), quantity: 1 }],
successUrl: 'http://localhost', successUrl: window.location.origin,
cancelUrl: 'http://localhost', cancelUrl: window.location.origin,
clientReferenceId: account.id, clientReferenceId: account.id,
}); });
} }

View File

@ -1,11 +1,8 @@
const toast = require('izitoast'); const toast = require('izitoast');
const cbor = require('borc'); const cbor = require('borc');
const socketUrl = () => { const SOCKET_URL =
if (process.env.NODE_ENV === 'production') return 'wss://mnml.gg/api/ws'; `${window.location.protocol === 'https:' ? 'wss://' : 'ws://'}${window.location.host}/api/ws`;
if (process.env.NODE_ENV === 'staging') return 'wss://sixtysix.pro/api/ws';
return 'ws://localhost/api/ws';
};
function errorToast(err) { function errorToast(err) {
console.error(err); console.error(err);
@ -226,8 +223,8 @@ function createSocket(events) {
ItemInfo: onItemInfo, ItemInfo: onItemInfo,
Pong: onPong, Pong: onPong,
QueueRequested: () => console.log('pvp queue request received'), QueueRequested: () => events.notify('pvp queue request received'),
QueueJoined: () => console.log('you have joined the pvp queue'), QueueJoined: () => events.notify('you have joined the pvp queue'),
Error: errHandler, Error: errHandler,
}; };
@ -299,7 +296,7 @@ function createSocket(events) {
ws = null; ws = null;
} }
ws = new WebSocket(socketUrl()); ws = new WebSocket(SOCKET_URL);
ws.binaryType = 'arraybuffer'; ws.binaryType = 'arraybuffer';
// Listen for messages // Listen for messages

View File

@ -6,7 +6,6 @@ upstream mnml_ws {
server 127.0.0.1:40055; server 127.0.0.1:40055;
} }
map $http_upgrade $connection_upgrade { map $http_upgrade $connection_upgrade {
default upgrade; default upgrade;
'' close; '' close;

View File

@ -12,8 +12,9 @@ map $http_upgrade $connection_upgrade {
'' close; '' close;
} }
# DEV
server { server {
server_name sixtysix.pro;
location / { location / {
root /var/lib/mnml/public/current; root /var/lib/mnml/public/current;
index index.html; index index.html;
@ -40,8 +41,8 @@ server {
listen [::]:443 ssl ipv6only=on; # managed by Certbot listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mnml.gg/fullchain.pem; # managed by Certbot ssl_certificate /etc/letsencrypt/live/sixtysix.pro/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mnml.gg/privkey.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/sixtysix.pro/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "mnml-ops", "name": "mnml-ops",
"version": "0.3.0", "version": "1.1.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mnml" name = "mnml"
version = "0.3.0" version = "1.1.0"
authors = ["ntr <ntr@smokestack.io>"] authors = ["ntr <ntr@smokestack.io>"]
[dependencies] [dependencies]

View File

@ -185,8 +185,9 @@ pub fn set_password(tx: &mut Transaction, id: Uuid, current: &String, password:
let id: Uuid = row.get(0); let id: Uuid = row.get(0);
let db_pw: String = row.get(1); let db_pw: String = row.get(1);
// return bad request to prevent being logged out
if !verify(current, &db_pw)? { if !verify(current, &db_pw)? {
return Err(MnmlHttpError::PasswordNotMatch); return Err(MnmlHttpError::BadRequest);
} }
let rounds = 8; let rounds = 8;

View File

@ -192,7 +192,13 @@ impl Events {
}, },
None => { None => {
info!("joined game queue id={:?} account={:?}", req.id, req.account); info!("joined game queue id={:?} account={:?}", req.id, req.account);
Some(req) match self.clients.get(&req.id) {
Some(ref c) => {
c.tx.send(RpcMessage::QueueJoined(()))?;
Some(req)
},
None => return Err(format_err!("missing client client={:?}", req.id)),
}
}, },
}; };

View File

@ -724,7 +724,7 @@ pub fn instance_ready(tx: &mut Transaction, account: &Account, instance_id: Uuid
Ok(RpcMessage::InstanceState(instance_update(tx, instance)?)) Ok(RpcMessage::InstanceState(instance_update(tx, instance)?))
} }
pub fn instance_state(tx: &mut Transaction, _account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> { pub fn instance_state(tx: &mut Transaction, instance_id: Uuid) -> Result<RpcMessage, Error> {
let instance = instance_get(tx, instance_id)?; let instance = instance_get(tx, instance_id)?;
if let Some(game_id) = instance.current_game_id() { if let Some(game_id) = instance.current_game_id() {

View File

@ -88,7 +88,7 @@ fn handle_notification(n: Notification, pool: &PgPool, events: &Sender<Event>) {
Table::Accounts => Table::Accounts =>
Some(Event::Push(n.id, RpcMessage::AccountState(account::select(&db, n.id).unwrap()))), Some(Event::Push(n.id, RpcMessage::AccountState(account::select(&db, n.id).unwrap()))),
Table::Instances => Table::Instances =>
Some(Event::Push(n.id, RpcMessage::InstanceState(instance::instance_get(&mut tx, n.id).unwrap()))), Some(Event::Push(n.id, instance::instance_state(&mut tx, n.id).unwrap())),
Table::Games => Table::Games =>
Some(Event::Push(n.id, RpcMessage::GameState(game::game_get(&mut tx, n.id).unwrap()))), Some(Event::Push(n.id, RpcMessage::GameState(game::game_get(&mut tx, n.id).unwrap()))),
_ => { _ => {

View File

@ -180,7 +180,7 @@ impl Connection {
RpcRequest::InstanceReady { instance_id } => RpcRequest::InstanceReady { instance_id } =>
Ok(instance_ready(&mut tx, account, instance_id)?), Ok(instance_ready(&mut tx, account, instance_id)?),
RpcRequest::InstanceState { instance_id } => RpcRequest::InstanceState { instance_id } =>
Ok(instance_state(&mut tx, account, instance_id)?), Ok(instance_state(&mut tx, instance_id)?),
RpcRequest::VboxAccept { instance_id, group, index } => RpcRequest::VboxAccept { instance_id, group, index } =>
Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)), Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)),