From 7c91b96395e325af144e571fe4d28615a75d2c8f Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 11 Sep 2024 14:15:20 -0400 Subject: prepare for release --- server/getfeaturedpictures.py | 2 +- server/potd.py | 2 +- server/src/main.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/getfeaturedpictures.py b/server/getfeaturedpictures.py index af534d7..e5dd8fd 100755 --- a/server/getfeaturedpictures.py +++ b/server/getfeaturedpictures.py @@ -4,7 +4,7 @@ import json import time from urllib.parse import quote -headers = {'Accept-Encoding':'gzip', 'User-Agent': 'contact pommicket+jigsaw @ gmail.com '} +headers = {'Accept-Encoding':'gzip', 'User-Agent': 'https://github.com/pommicket/jigsaw / contact pommicket+jigsaw @ gmail.com '} def make_file_request(cmcontinue): URL = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&list=categorymembers&cmlimit=500&cmtitle=Category:Featured_pictures_on_Wikimedia_Commons&cmtype=file&cmprop=title&maxlag=5' while True: diff --git a/server/potd.py b/server/potd.py index 8c31c76..d7abc4e 100755 --- a/server/potd.py +++ b/server/potd.py @@ -4,7 +4,7 @@ from xml.etree import ElementTree from getfeaturedpictures import get_urls_of_images from urllib.parse import unquote -headers = {'Accept-Encoding':'gzip', 'User-Agent': 'contact pommicket+jigsaw @ gmail.com '} +headers = {'Accept-Encoding':'gzip', 'User-Agent': 'https://github.com/pommicket/jigsaw / contact pommicket+jigsaw @ gmail.com '} URL = 'https://commons.wikimedia.org/w/api.php?action=featuredfeed&feed=potd&feedformat=rss&maxlag=5' diff --git a/server/src/main.rs b/server/src/main.rs index c019a2a..e5c9848 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -13,6 +13,7 @@ use tokio::io::AsyncWriteExt; use tokio::sync::{Mutex, RwLock}; use tungstenite::protocol::Message; +const PORT: u16 = 54472; const PUZZLE_ID_CHARSET: &[u8] = b"23456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; const PUZZLE_ID_LEN: usize = 7; const MAX_PLAYERS: u32 = 20; @@ -524,12 +525,11 @@ async fn create_table_if_doesnt_exist(database: &tokio_postgres::Client) -> Resu #[tokio::main] async fn main() { - let port = 54472; - let host_addr = SocketAddr::from(([127, 0, 0, 1], port)); + let host_addr = SocketAddr::from(([127, 0, 0, 1], PORT)); let listener = match tokio::net::TcpListener::bind(host_addr).await { Ok(l) => l, Err(e) => { - eprintln!("Couldn't bind to localhost:{port}: {e}"); + eprintln!("Couldn't bind to localhost:{PORT}: {e}"); return; } }; -- cgit v1.2.3