raylu il y a 1 mois
Parent
commit
de36b481b0
5 fichiers modifiés avec 36 ajouts et 5 suppressions
  1. 1 1
      .gitignore
  2. 1 1
      newbies.py
  3. 6 2
      ts/newbies.ts
  4. 4 1
      www/ci_newbies.html
  5. 24 0
      www/ic_newbies.html

+ 1 - 1
.gitignore

@@ -4,7 +4,7 @@ config.toml
 node_modules/
 uv.lock
 www/buy.js*
-www/ci_newbies.js*
+www/newbies.js*
 www/coop.js*
 www/corps.js*
 www/gov.js*

+ 1 - 1
newbies.py

@@ -53,7 +53,7 @@ def main() -> None:
 	
 	for username, join_ts in sorted(joined.items(), key=lambda i: i[1]):
 		join_str = datetime.datetime.fromtimestamp(join_ts/1000, tz=datetime.UTC).strftime('%Y-%m-%d %H:%M:%S')
-		print(username, join_str, '', '', rep.get(username, ''), sep='\t')
+		print(username, join_str, '', rep.get(username, ''), sep='\t')
 
 class Message(typing.TypedDict):
 	Type: typing.Literal['JOINED', 'LEFT', 'MESSAGE']

+ 6 - 2
ts/ci_newbies.ts → ts/newbies.ts

@@ -8,8 +8,13 @@ const newbies = document.querySelector('textarea#newbies') as HTMLTextAreaElemen
 	sinceInput.value = twoDaysAgo.toISOString().slice(0, 10);
 }
 
+let planets: string[];
+export function setupNewbies(setPlanets: string[]): void {
+	planets = setPlanets;
+	render();
+}
+
 sinceInput.addEventListener('change', () => void render());
-render();
 
 async function render(): Promise<void> {
 	const loader = document.querySelector('#loader') as HTMLElement;
@@ -30,7 +35,6 @@ async function _render(): Promise<void> {
 	}
 	newbies.style.display = 'none';
 
-	const planets = ['Katoa', 'Etherwind', 'Nemesis', 'Proxion', 'Umbra', 'Gibson'];
 	const joined: Map<string, Join> = new Map();
 	for (const planet of planets) {
 		const messages: Message[] = await fetchJSON('https://api.fnar.net/chat/messages?' +

+ 4 - 1
www/ci_newbies.html

@@ -16,6 +16,9 @@
 		<br><textarea id="newbies"></textarea>
 		<br><input type="button" id="copy" value="copy">
 	</main>
-	<script src="ci_newbies.js"></script>
+	<script type="module">
+		import {setupNewbies} from './newbies.js';
+		setupNewbies(['Katoa', 'Etherwind', 'Nemesis', 'Proxion', 'Umbra', 'Gibson']);
+	</script>
 </body>
 </html>

+ 24 - 0
www/ic_newbies.html

@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="UTF-8">
+	<title>PrUn IC newbies</title>
+	<link rel="stylesheet" type="text/css" href="style.css">
+	<link rel="icon" href="https://www.raylu.net/hammer-man.svg" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<meta name="theme-color" content="#222">
+</head>
+<body>
+	<a href="/">← back</a>
+	<main class="newbies">
+		<input type="date" id="since">
+		<section id="loader"></section>
+		<br><textarea id="newbies"></textarea>
+		<br><input type="button" id="copy" value="copy">
+	</main>
+	<script type="module">
+		import {setupNewbies} from './newbies.js';
+		setupNewbies(['Avalon', 'Berthier', 'Boucher', 'Nova Honshu', 'Promitor']);
+	</script>
+</body>
+</html>