Skip to content

Commit 1e9f8d1

Browse files
authored
Merge pull request #79 from subtype-space/dev
Release v1.17.5: shutdown hardening + TRMNL X full-card sizing + CI bumps
2 parents 4337b1f + 96335f0 commit 1e9f8d1

7 files changed

Lines changed: 44 additions & 11 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
build-and-release:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v5
1919
with:
2020
fetch-depth: 0 # ensures full history for changelog generation
2121

@@ -36,7 +36,7 @@ jobs:
3636
echo "tags=$TAGS" >> $GITHUB_OUTPUT
3737
3838
- name: Build and push Docker image
39-
uses: docker/build-push-action@v5
39+
uses: docker/build-push-action@v6
4040
with:
4141
context: .
4242
push: true

docker-compose.dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
22
subspace-api:
3+
init: true
34
build: ./
45
image: subspace-api:dev
56
container_name: subspace-api-dev

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
22
subspace-api:
3+
init: true
34
build: ./
45
image: ghcr.io/subtype-space/subspace-api:latest
56
container_name: subspace-api

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "subspace-api",
3-
"version": "1.17.4",
3+
"version": "1.17.5",
44
"description": "API service for subtype.space",
55
"repository": {
66
"type": "git",

scripts/renderFlightPreview.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// This is a helper script to generate mock HTML representative of TRMNL devices.
2+
// It should generate all forms, including TRMNL X dimensions
13
import { renderMarkup } from "../src/integrations/aerodatabox/formatters.js";
24
import { writeFileSync } from "node:fs";
35
import { config } from '../src/config.js'
@@ -29,6 +31,13 @@ const SIZES: Record<string, [number, number]> = {
2931
quadrant: [400, 240],
3032
}
3133

34+
const xSIZES: Record<string, [number, number]> = {
35+
full: [1040, 780],
36+
half_horizontal: [1040, 390],
37+
half_vertical: [520, 780],
38+
quadrant: [520, 390],
39+
}
40+
3241
/**
3342
*
3443
* @param fragment The markup fragment from renderMarkup
@@ -65,13 +74,15 @@ const baseUrl = new URL(config.auth.mcpServerUrl).origin
6574

6675
const variants = ['full', 'half_horizontal', 'half_vertical', 'quadrant'] as MarkupVariant[]
6776
const generatedVariants = variants.map(v => {
68-
const [w, h] = SIZES[v]
69-
return generateVariant(renderMarkup(sampleFlight, v, 0, baseUrl), v, w, h)
77+
const [w, h] = SIZES[v]
78+
return generateVariant(renderMarkup(sampleFlight, v, 0, baseUrl), v, w, h)
7079
}).join('')
7180

72-
// TRMNL X: full variant on the larger screen (screen--lg drives --s: 1.3)
73-
const xFull = generateVariant(renderMarkup(sampleFlight, 'full', 0, baseUrl), 'full', 1040, 780, 'screen--lg')
81+
const generatedXVariants = variants.map(v => {
82+
const [w, h] = xSIZES[v]
83+
return generateVariant(renderMarkup(sampleFlight, v, 0, baseUrl), v, w, h, 'screen--lg')
84+
})
7485

7586

76-
writeFileSync('flight-preview.html', generatePage(generatedVariants + xFull))
87+
writeFileSync('flight-preview.html', generatePage(generatedVariants + generatedXVariants))
7788

src/integrations/aerodatabox/formatters.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ export function renderMarkup(
134134
.stat-tile-label { font-size: ${s(15)}; font-weight: 700; letter-spacing: 1.5px; }
135135
.stat-tile-value { font-size: ${s(26)}; font-weight: 800; }
136136
137+
/* TRMNL X (screen--lg): the taller screen leaves room for a larger logo and
138+
header, so bump just those on the full variant (arc + tiles already fill the width). */
139+
.screen--lg .view--full .airline-logo { max-width: ${s(370)}; max-height: ${s(165)}; }
140+
.screen--lg .view--full .airline-name { font-size: ${s(34)}; }
141+
.screen--lg .view--full .flight-number { font-size: ${s(50)}; }
142+
.screen--lg .view--full .flight-aircraft { font-size: ${s(22)}; }
143+
.screen--lg .view--full .flight-status { font-size: ${s(27)}; }
144+
137145
.flight-card { margin: ${variant === 'full' ? '0' : variant === 'half_vertical' ? `${s(12)} 0 0` : variant === 'half_horizontal' ? `${s(8)} 0` : `${s(6)} ${s(8)}`}; padding: ${variant === 'full' ? `${s(12)} ${s(24)}` : '0'}; font-family: 'IBM Plex Sans', 'SF Pro Text', 'Segoe UI', sans-serif; display: flex; flex-direction: column; flex: 1; }
138146
.flight-details { margin-top: ${variant === 'full' ? s(60) : '0'}; }
139147
.flight-top { display: flex; align-items: center; gap: ${variant === 'quadrant' ? s(12) : s(20)}; width: 100%; }

src/server.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,23 @@ const httpServer = server.listen(PORT, () => {
126126
logger.info('subspace API now listening on PORT:', config.api.port)
127127
})
128128

129-
process.on('SIGTERM', () => {
130-
logger.info('SIGTERM received, shutting down gracefully')
129+
/**
130+
* Was having issues for the service taking too long to drain connections
131+
* So we force stop after after a determinate amount of time
132+
* @param signal The SIGXXX to intercept
133+
*/
134+
function shutdown(signal: string) {
135+
logger.info(`${signal} received, shutting down gracefully`)
131136
httpServer.closeAllConnections()
132137
httpServer.close(() => {
133138
logger.info('Server closed')
134139
process.exit(0)
135140
})
136-
})
141+
setTimeout(() => {
142+
logger.warn('service took too long to shut down, killing...')
143+
process.exit(1)
144+
}, 8000).unref()
145+
}
146+
147+
process.on('SIGTERM', () => shutdown('SIGTERM'))
148+
process.on('SIGINT', () => shutdown('SIGINT'))

0 commit comments

Comments
 (0)