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
* essential
* serde serialize privatise
* DO postgres
* mobile styles
* can't reset password without knowing password =\
* treats
* constructs jiggle when clicked
* background colour changes depending on time of day
* other
* skill pane bigger
* add colours and speed -> Skill > <B></B>B
* bug fixes
* pvp 1st round doesn't resolve until warden timer completes
* bot game grind
* stress test
* change score to enum
* pct based translates for combat animation
@ -23,6 +23,8 @@
* send account_instances on players update
* 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)
* increase power to speed up early rounds
@ -60,12 +62,6 @@ mobile info page
reconnect based on time delta
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*
* vbox drops chances
* 50% spec, 25% colour etc
@ -73,7 +69,6 @@ and a ready button
* mnml tv
## LATER
* chat
* elo + leaderboards
* constants
* change to ownership pattern

View File

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

View File

@ -23,6 +23,7 @@ ssh -q "$TARGET" ls -lah "$SERVER_BIN_DIR"
echo "syncing client $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" ls -lah "$CLIENT_DIST_DIR"
echo "restarting mnml service"
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",
"version": "0.3.0",
"version": "1.1.0",
"description": "",
"main": "index.js",
"scripts": {

View File

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

View File

@ -1,6 +1,16 @@
const preact = require('preact');
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) {
const {
stripe,
@ -8,18 +18,18 @@ function BitsBtn(args) {
} = args;
function subscribeClick() {
stripe.redirectToCheckout({
items: [{ plan: 'plan_Fhl9r7UdMadjGi', quantity: 1 }],
successUrl: 'http://localhost',
cancelUrl: 'http://localhost',
items: [{ plan: subPlan(), quantity: 1 }],
successUrl: window.location.origin,
cancelUrl: window.location.origin,
clientReferenceId: account.id,
});
}
function bitsClick() {
stripe.redirectToCheckout({
items: [{ sku: 'sku_FHUfNEhWQaVDaT', quantity: 1 }],
successUrl: 'http://localhost',
cancelUrl: 'http://localhost',
items: [{ sku: bitsSku(), quantity: 1 }],
successUrl: window.location.origin,
cancelUrl: window.location.origin,
clientReferenceId: account.id,
});
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
[package]
name = "mnml"
version = "0.3.0"
version = "1.1.0"
authors = ["ntr <ntr@smokestack.io>"]
[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 db_pw: String = row.get(1);
// return bad request to prevent being logged out
if !verify(current, &db_pw)? {
return Err(MnmlHttpError::PasswordNotMatch);
return Err(MnmlHttpError::BadRequest);
}
let rounds = 8;

View File

@ -192,7 +192,13 @@ impl Events {
},
None => {
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)?))
}
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)?;
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 =>
Some(Event::Push(n.id, RpcMessage::AccountState(account::select(&db, n.id).unwrap()))),
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 =>
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 } =>
Ok(instance_ready(&mut tx, account, 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 } =>
Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)),