diff --git a/VERSION b/VERSION
index 9325c3cc..1cc5f657 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.0
\ No newline at end of file
+1.1.0
\ No newline at end of file
diff --git a/WORKLOG.md b/WORKLOG.md
index 5d23e2e2..999f1afa 100644
--- a/WORKLOG.md
+++ b/WORKLOG.md
@@ -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
+* 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
diff --git a/acp/package.json b/acp/package.json
index ef344ba8..cc7a1379 100644
--- a/acp/package.json
+++ b/acp/package.json
@@ -1,6 +1,6 @@
{
"name": "mnml-client",
- "version": "0.3.0",
+ "version": "1.1.0",
"description": "",
"main": "index.js",
"scripts": {
diff --git a/bin/deploy.sh b/bin/deploy.sh
index 0c9362f1..dcf11a59 100755
--- a/bin/deploy.sh
+++ b/bin/deploy.sh
@@ -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
diff --git a/bin/version.sh b/bin/version.sh
new file mode 100755
index 00000000..dd50de69
--- /dev/null
+++ b/bin/version.sh
@@ -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"
diff --git a/client/package.json b/client/package.json
index 96196e8e..a0ecb408 100644
--- a/client/package.json
+++ b/client/package.json
@@ -1,6 +1,6 @@
{
"name": "mnml-client",
- "version": "0.3.0",
+ "version": "1.1.0",
"description": "",
"main": "index.js",
"scripts": {
diff --git a/client/src/app.jsx b/client/src/app.jsx
index ddd7a1ea..ab17520c 100644
--- a/client/src/app.jsx
+++ b/client/src/app.jsx
@@ -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 = () => (
-
+
diff --git a/client/src/components/stripe.buttons.jsx b/client/src/components/stripe.buttons.jsx
index 7d15770e..ef72c5a9 100644
--- a/client/src/components/stripe.buttons.jsx
+++ b/client/src/components/stripe.buttons.jsx
@@ -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,
});
}
diff --git a/client/src/socket.jsx b/client/src/socket.jsx
index b8e919b9..d4a0c421 100644
--- a/client/src/socket.jsx
+++ b/client/src/socket.jsx
@@ -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
diff --git a/etc/nginx/sites-available/mnml.gg.PRODUCTION.nginx.conf b/etc/nginx/sites-available/mnml.gg.PRODUCTION.nginx.conf
index cce73707..73941ae9 100644
--- a/etc/nginx/sites-available/mnml.gg.PRODUCTION.nginx.conf
+++ b/etc/nginx/sites-available/mnml.gg.PRODUCTION.nginx.conf
@@ -6,7 +6,6 @@ upstream mnml_ws {
server 127.0.0.1:40055;
}
-
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
diff --git a/etc/nginx/sites-available/mnml.gg.STAGING.SAMPLE.nginx.conf b/etc/nginx/sites-available/mnml.gg.STAGING.SAMPLE.nginx.conf
index 5e3fab85..8383b79d 100644
--- a/etc/nginx/sites-available/mnml.gg.STAGING.SAMPLE.nginx.conf
+++ b/etc/nginx/sites-available/mnml.gg.STAGING.SAMPLE.nginx.conf
@@ -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
}
diff --git a/ops/package.json b/ops/package.json
index 2b7cd67a..ce9cd791 100755
--- a/ops/package.json
+++ b/ops/package.json
@@ -1,6 +1,6 @@
{
"name": "mnml-ops",
- "version": "0.3.0",
+ "version": "1.1.0",
"description": "",
"main": "index.js",
"scripts": {
diff --git a/server/Cargo.toml b/server/Cargo.toml
index ab043db4..2b528b9b 100644
--- a/server/Cargo.toml
+++ b/server/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "mnml"
-version = "0.3.0"
+version = "1.1.0"
authors = ["ntr "]
[dependencies]
diff --git a/server/src/account.rs b/server/src/account.rs
index a33b6b02..716c9b10 100644
--- a/server/src/account.rs
+++ b/server/src/account.rs
@@ -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;
diff --git a/server/src/events.rs b/server/src/events.rs
index f37b97bd..c6cf57a5 100644
--- a/server/src/events.rs
+++ b/server/src/events.rs
@@ -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)),
+ }
},
};
diff --git a/server/src/instance.rs b/server/src/instance.rs
index eb2c35d7..5443eac9 100644
--- a/server/src/instance.rs
+++ b/server/src/instance.rs
@@ -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 {
+pub fn instance_state(tx: &mut Transaction, instance_id: Uuid) -> Result {
let instance = instance_get(tx, instance_id)?;
if let Some(game_id) = instance.current_game_id() {
diff --git a/server/src/pg.rs b/server/src/pg.rs
index 88e05a87..3afabde6 100644
--- a/server/src/pg.rs
+++ b/server/src/pg.rs
@@ -88,7 +88,7 @@ fn handle_notification(n: Notification, pool: &PgPool, events: &Sender) {
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()))),
_ => {
diff --git a/server/src/rpc.rs b/server/src/rpc.rs
index df7a503c..01579c23 100644
--- a/server/src/rpc.rs
+++ b/server/src/rpc.rs
@@ -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)?)),