Skip to content

Commit

Permalink
Alts & flags
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jan 25, 2024
1 parent 4839328 commit f894139
Show file tree
Hide file tree
Showing 24 changed files with 718 additions and 415 deletions.
9 changes: 2 additions & 7 deletions config-sample.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"listen": 8080,
"pg": {
"user": "postgres",
"host": "localhost",
"port": 5432,
"database": "oetg"
},
"pg": "user=postgres host=localhost port=5432 database=oetg",
"certs": null
}
}
6 changes: 3 additions & 3 deletions src/Quest.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ export function mkQuestAi(quest, datafn) {
const drawpower = quest.drawpower ?? 1;
const hp = quest.hp ?? 100;
const playerHPstart = quest.urhp ?? 100;
const { user } = store.state;
const { user, username } = store.state;
let urdeck = quest.urdeck;
if (!urdeck) {
urdeck = store.getDeck();
Expand All @@ -749,8 +749,8 @@ export function mkQuestAi(quest, datafn) {
players: [
{
idx: 1,
name: user.name,
user: user.name,
name: username,
user: username,
deck: urdeck,
hp: playerHPstart,
},
Expand Down
6 changes: 3 additions & 3 deletions src/mkAi.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export function mkPremade(level, daily, datafn = null) {
players: [
{
idx: 1,
name: user.name,
user: user.name,
name: store.state.username,
user: store.state.username,
deck: urdeck,
},
{
Expand Down Expand Up @@ -84,7 +84,7 @@ export function mkAi(level, daily, datafn = null) {
{
idx: 1,
name: user?.name,
user: user ? user.name : '',
user: store.state.username ?? '',
deck: urdeck,
},
{
Expand Down
6 changes: 3 additions & 3 deletions src/parseChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export default function parseChat(e) {
} else if (msg === '/who') {
sock.emit({ x: 'who' });
} else if (msg === '/deleteme') {
if (storeState.opts.foename === user.name + 'yesdelete') {
if (storeState.opts.foename === storeState.username + 'yesdelete') {
sock.userEmit('delete');
store.setUser(null);
store.logout();
store.setOpt('remember', false);
store.doNav(store.Login);
} else {
store.chatMsg(
`Input '${user.name}yesdelete' into Player's Name to delete your account`,
`Input '${storeState.username}yesdelete' into Player's Name to delete your account`,
'System',
);
}
Expand Down
15 changes: 11 additions & 4 deletions src/rs/server/src/handleget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use std::collections::{BTreeMap, HashMap};
use std::convert::Infallible;
use std::fmt::Write;
use std::time::SystemTime;
use std::sync::RwLock;
use std::time::SystemTime;

use http_body_util::Full;
use httpdate::HttpDate;
Expand Down Expand Up @@ -95,7 +95,11 @@ pub async fn compress_and_cache(
content: Bytes::from(compressed.into_boxed_slice()),
file: resp.file,
};
cache.write().unwrap_or_else(|e| e.into_inner()).get_map_mut(encoding).insert(path, cached_resp.clone());
cache
.write()
.unwrap_or_else(|e| e.into_inner())
.get_map_mut(encoding)
.insert(path, cached_resp.clone());
cached_resp
}
Err(content) => CachedResponse {
Expand Down Expand Up @@ -388,8 +392,11 @@ async fn handle_get_core(
if let Ok(client) = pgpool.get().await {
if let Some(user) = users.write().await.load(&*client, name).await {
let user = user.lock().await;
let pool = &user.data.pool;
let bound = &user.data.accountbound;
let Some(userdata) = user.data.get("") else {
return response::Builder::new().status(404).body(Bytes::new());
};
let pool = &userdata.pool;
let bound = &userdata.accountbound;
let mut cards: BTreeMap<i16, [u16; 8]> = BTreeMap::new();
for i in 0..2 {
let (cards0, counts) = if i == 0 { (0, pool) } else { (4, bound) };
Expand Down
Loading

0 comments on commit f894139

Please sign in to comment.