pi-deck 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pi-deck.js +4 -0
- package/dist/server.js +26 -1
- package/dist/server.js.map +2 -2
- package/package.json +1 -1
- package/packages/client/dist/assets/{MarkdownContent-D7i8glJy.js → MarkdownContent-CaLXPq7W.js} +1 -1
- package/packages/client/dist/assets/{index-C2Zq6AKt.js → index-C6QC_auV.js} +129 -124
- package/packages/client/dist/assets/index-Uft_WPvr.css +1 -0
- package/packages/client/dist/index.html +2 -2
- package/packages/client/dist/assets/index-vhbgYHbc.css +0 -1
package/bin/pi-deck.js
CHANGED
|
@@ -147,6 +147,10 @@ function startServer() {
|
|
|
147
147
|
// Tell the bundled server where the client dist lives
|
|
148
148
|
process.env.PI_DECK_CLIENT_DIST = clientDist;
|
|
149
149
|
|
|
150
|
+
// Pass version so the bundled server doesn't need to find package.json
|
|
151
|
+
const pkgJson = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'));
|
|
152
|
+
process.env.PI_DECK_VERSION = pkgJson.version;
|
|
153
|
+
|
|
150
154
|
console.log('[pi-deck] Starting server...');
|
|
151
155
|
const child = fork(bundledServer, [], {
|
|
152
156
|
cwd: ROOT,
|
package/dist/server.js
CHANGED
|
@@ -5180,6 +5180,30 @@ var syncDbPath = join7(homedir5(), ".pi", "pi-deck-sync.db");
|
|
|
5180
5180
|
var syncIntegration = new SyncIntegration(syncDbPath);
|
|
5181
5181
|
console.log(`[Sync] Initialized sync database at ${syncDbPath}`);
|
|
5182
5182
|
var PORT = config.port;
|
|
5183
|
+
var CURRENT_VERSION = process.env.PI_DECK_VERSION || "0.0.0";
|
|
5184
|
+
var updateAvailable = null;
|
|
5185
|
+
async function checkForUpdate() {
|
|
5186
|
+
try {
|
|
5187
|
+
const res = await fetch("https://registry.npmjs.org/pi-deck/latest", {
|
|
5188
|
+
signal: AbortSignal.timeout(5e3)
|
|
5189
|
+
});
|
|
5190
|
+
if (!res.ok)
|
|
5191
|
+
return;
|
|
5192
|
+
const data = await res.json();
|
|
5193
|
+
const latest = data.version;
|
|
5194
|
+
if (!latest)
|
|
5195
|
+
return;
|
|
5196
|
+
const cur = CURRENT_VERSION.split(".").map(Number);
|
|
5197
|
+
const lat = latest.split(".").map(Number);
|
|
5198
|
+
const isNewer = lat[0] > cur[0] || lat[0] === cur[0] && lat[1] > cur[1] || lat[0] === cur[0] && lat[1] === cur[1] && lat[2] > cur[2];
|
|
5199
|
+
if (isNewer) {
|
|
5200
|
+
updateAvailable = { current: CURRENT_VERSION, latest };
|
|
5201
|
+
console.log(`[Update] New version available: ${CURRENT_VERSION} \u2192 ${latest}`);
|
|
5202
|
+
}
|
|
5203
|
+
} catch {
|
|
5204
|
+
}
|
|
5205
|
+
}
|
|
5206
|
+
checkForUpdate();
|
|
5183
5207
|
var app = express();
|
|
5184
5208
|
app.use(cors());
|
|
5185
5209
|
app.use(express.json());
|
|
@@ -5347,7 +5371,8 @@ wss.on("connection", async (ws) => {
|
|
|
5347
5371
|
workspaces: existingWorkspaces,
|
|
5348
5372
|
allowedRoots: config.allowedDirectories,
|
|
5349
5373
|
homeDirectory: homedir5(),
|
|
5350
|
-
uiState
|
|
5374
|
+
uiState,
|
|
5375
|
+
...updateAvailable ? { updateAvailable } : {}
|
|
5351
5376
|
});
|
|
5352
5377
|
ws.on("message", async (data) => {
|
|
5353
5378
|
try {
|