Skip to content

Commit 4b9c9b4

Browse files
committed
chore: update dependencies and configurations
- update python version to 3.12 - update node version to 20 - remove devcontainer.json - fix content security policy to allow websocket connections - fix mollweide projection to handle poles correctly - fix a bug in the mollweide projection that caused the y-axis to be inverted - refactor VirtualizedList to fix a type issue - set RAW_ENDPOINT to ngrok URL
1 parent 699d1a3 commit 4b9c9b4

7 files changed

Lines changed: 23 additions & 49 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
uses: actions/checkout@v4
2323

2424
- name: Setup Python
25-
uses: actions/setup-python@v4
25+
uses: actions/setup-python@v5
2626
with:
27-
python-version: '3.11'
27+
python-version: '3.12'
2828

2929
- name: Setup Node.js
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: '18'
32+
node-version: '20'
3333
cache: 'npm'
3434
cache-dependency-path: 'dashboard/package-lock.json'
3535

dashboard/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<meta name="description" content="LaStBeRu Explorer - Interactive dashboard for astronomical data exploration" />
77
<meta name="author" content="CosmoObs" />
8-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data: blob: https: http:; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self' https: http:; object-src 'none';" />
8+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data: blob: https: http:; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self' https: http: ws: wss:; worker-src 'self' blob:; object-src 'none';" />
99
<title>The LaStBeRu Explorer</title>
10-
<link rel="icon" type="image/png" href="/telescope.png" />
10+
<link rel="icon" type="image/png" href="telescope.png" />
1111
<style>
1212
body {
1313
background: radial-gradient(circle at 20% 20%, #13242d 0%, #091015 60%, #060b0f 100%);

dashboard/src/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export const loadCutouts = async (): Promise<CutoutRecord[]> => {
3131
// - If VITE_MINIO_ENDPOINT includes scheme (http:// or https://) we use it verbatim.
3232
// - Else we prepend scheme from VITE_MINIO_SCHEME (default 'https').
3333
// - This allows using plain HTTP during local dev / tunnels without mixed content surprises.
34-
const RAW_ENDPOINT: string | undefined = (import.meta as { env?: Record<string, string> }).env?.VITE_MINIO_ENDPOINT;
34+
// const RAW_ENDPOINT: string | undefined = (import.meta as { env?: Record<string, string> }).env?.VITE_MINIO_ENDPOINT;
35+
const RAW_ENDPOINT: string | undefined = "nonarithmetically-undeliberating-janelle.ngrok-free.app";
3536
const ENDPOINT_SCHEME: string = ((import.meta as { env?: Record<string, string> }).env?.VITE_MINIO_SCHEME || 'https').replace(/:$/,'');
3637
export const buildCutoutUrl = (objectKey: string): string => {
3738
const cleaned = objectKey.trim().replace(/^\/+/, '');

dashboard/src/components/SkyMap.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ const deg2rad = (d:number)=> d * Math.PI / 180;
2727

2828
// Solve for theta in Mollweide projection: 2θ + sin 2θ = π sin φ
2929
function solveTheta(phi: number){
30-
let theta = phi; // initial guess
31-
for(let i=0;i<10;i++){
32-
const f = 2*theta + Math.sin(2*theta) - Math.PI * Math.sin(phi);
33-
const fp = 2 + 2*Math.cos(2*theta);
30+
// Handle poles explicitly to avoid 0/0 in Newton step
31+
const HALF_PI = Math.PI / 2;
32+
if (Math.abs(Math.abs(phi) - HALF_PI) < 1e-12) {
33+
return Math.sign(phi) * HALF_PI;
34+
}
35+
let theta = Math.max(-HALF_PI, Math.min(HALF_PI, phi)); // clamp initial guess
36+
for (let i = 0; i < 12; i++) {
37+
const f = 2 * theta + Math.sin(2 * theta) - Math.PI * Math.sin(phi);
38+
const fp = 2 + 2 * Math.cos(2 * theta); // 4·cos²θ
39+
if (Math.abs(fp) < 1e-12) break; // avoid blow-ups near poles
3440
const delta = f / fp;
3541
theta -= delta;
36-
if(Math.abs(delta) < 1e-7) break;
42+
if (Math.abs(delta) < 1e-10) break;
3743
}
3844
return theta;
3945
}
@@ -160,7 +166,7 @@ export const SkyMap: React.FC<Props> = memo(({ objects, height=360, width=600, o
160166
const lat = deg2rad(latDeg);
161167
const theta = solveTheta(lat);
162168
const x = (2*Math.SQRT2/Math.PI) * lon * Math.cos(theta);
163-
const y = Math.SQRT2 * Math.sin(theta);
169+
const y = -Math.SQRT2 * Math.sin(theta)
164170
seg.push([x,y,latDeg===-90?1:0]);
165171
}
166172
worldLine(seg,'rgba(255,255,255,0.08)');

dashboard/src/components/VirtualizedList.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface VirtualizedListProps<T = unknown> {
88
overscan?: number;
99
}
1010

11-
export const VirtualizedList = memo(<T,>({
11+
const VirtualizedListInner = <T,>({
1212
items,
1313
renderItem,
1414
itemHeight,
@@ -79,4 +79,6 @@ export const VirtualizedList = memo(<T,>({
7979
</div>
8080
</div>
8181
);
82-
});
82+
};
83+
84+
export const VirtualizedList = memo(VirtualizedListInner) as typeof VirtualizedListInner;

dashboard/src/env.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
interface ImportMetaEnv {
44
readonly VITE_MINIO_ENDPOINT: string;
5-
readonly VITE_MINIO_ACCESS_KEY: string;
6-
readonly VITE_MINIO_SECRET_KEY: string;
75
readonly VITE_MINIO_BUCKET: string;
86
}
97

0 commit comments

Comments
 (0)