tide-commander 0.84.2 → 0.84.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as s}from"./main-
|
|
1
|
+
import{W as s}from"./main-Cl7abmzo.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-DJ4p3FLF.js";class f extends s{constructor(){super(...arguments),this.pending=[],this.deliveredNotifications=[],this.hasNotificationSupport=()=>{if(!("Notification"in window)||!Notification.requestPermission)return!1;if(Notification.permission!=="granted")try{new Notification("")}catch(i){if(i instanceof Error&&i.name==="TypeError")return!1}return!0}}async getDeliveredNotifications(){const i=[];for(const t of this.deliveredNotifications){const e={title:t.title,id:parseInt(t.tag),body:t.body};i.push(e)}return{notifications:i}}async removeDeliveredNotifications(i){for(const t of i.notifications){const e=this.deliveredNotifications.find(n=>n.tag===String(t.id));e==null||e.close(),this.deliveredNotifications=this.deliveredNotifications.filter(()=>!e)}}async removeAllDeliveredNotifications(){for(const i of this.deliveredNotifications)i.close();this.deliveredNotifications=[]}async createChannel(){throw this.unimplemented("Not implemented on web.")}async deleteChannel(){throw this.unimplemented("Not implemented on web.")}async listChannels(){throw this.unimplemented("Not implemented on web.")}async schedule(i){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");for(const t of i.notifications)this.sendNotification(t);return{notifications:i.notifications.map(t=>({id:t.id}))}}async getPending(){return{notifications:this.pending}}async registerActionTypes(){throw this.unimplemented("Not implemented on web.")}async cancel(i){this.pending=this.pending.filter(t=>!i.notifications.find(e=>e.id===t.id))}async areEnabled(){const{display:i}=await this.checkPermissions();return{value:i==="granted"}}async changeExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async checkExactNotificationSetting(){throw this.unimplemented("Not implemented on web.")}async requestPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(await Notification.requestPermission())}}async checkPermissions(){if(!this.hasNotificationSupport())throw this.unavailable("Notifications not supported in this browser.");return{display:this.transformNotificationPermission(Notification.permission)}}transformNotificationPermission(i){switch(i){case"granted":return"granted";case"denied":return"denied";default:return"prompt"}}sendPending(){var i;const t=[],e=new Date().getTime();for(const n of this.pending)!((i=n.schedule)===null||i===void 0)&&i.at&&n.schedule.at.getTime()<=e&&(this.buildNotification(n),t.push(n));this.pending=this.pending.filter(n=>!t.find(o=>o===n))}sendNotification(i){var t;if(!((t=i.schedule)===null||t===void 0)&&t.at){const e=i.schedule.at.getTime()-new Date().getTime();this.pending.push(i),setTimeout(()=>{this.sendPending()},e);return}this.buildNotification(i)}buildNotification(i){const t=new Notification(i.title,{body:i.body,tag:String(i.id)});return t.addEventListener("click",this.onClick.bind(this,i),!1),t.addEventListener("show",this.onShow.bind(this,i),!1),t.addEventListener("close",()=>{this.deliveredNotifications=this.deliveredNotifications.filter(()=>!this)},!1),this.deliveredNotifications.push(t),t}onClick(i){const t={actionId:"tap",notification:i};this.notifyListeners("localNotificationActionPerformed",t)}onShow(i){this.notifyListeners("localNotificationReceived",i)}}export{f as LocalNotificationsWeb};
|
package/dist/index.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png" />
|
|
23
23
|
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png" />
|
|
24
24
|
<title>Tide Commander</title>
|
|
25
|
-
<script type="module" crossorigin src="/assets/main-
|
|
25
|
+
<script type="module" crossorigin src="/assets/main-Cl7abmzo.js"></script>
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-B5Qt9EMX.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-uS-d4TUT.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/vendor-three-DJ4p3FLF.js">
|
|
@@ -251,12 +251,18 @@ function installLocalCert(host) {
|
|
|
251
251
|
fs.mkdirSync(TLS_DIR, { recursive: true });
|
|
252
252
|
const mkcertBin = findSystemMkcert();
|
|
253
253
|
if (!mkcertBin) {
|
|
254
|
-
throw new Error('mkcert (Go binary) is required for
|
|
254
|
+
throw new Error('mkcert (Go binary) is required for HTTPS but was not found in PATH.\n'
|
|
255
255
|
+ 'Install it from: https://github.com/FiloSottile/mkcert\n'
|
|
256
256
|
+ 'Note: the npm "mkcert" package is not the same tool.');
|
|
257
257
|
}
|
|
258
|
+
const dim = '\x1b[2m';
|
|
259
|
+
const cyan = '\x1b[36m';
|
|
260
|
+
const reset = '\x1b[0m';
|
|
261
|
+
console.log(`\n${cyan}Installing local CA with mkcert...${reset}`);
|
|
262
|
+
console.log(`${dim}Running: ${mkcertBin} -install${reset}`);
|
|
263
|
+
console.log(`${dim}This may require your password to trust the local CA.${reset}\n`);
|
|
258
264
|
try {
|
|
259
|
-
|
|
265
|
+
execSync(`"${mkcertBin}" -install`, { stdio: 'inherit' });
|
|
260
266
|
}
|
|
261
267
|
catch {
|
|
262
268
|
throw new Error(`mkcert -install failed. You may need to run: sudo ${mkcertBin} -install`);
|
|
@@ -266,14 +272,18 @@ function installLocalCert(host) {
|
|
|
266
272
|
hostArgs.push(host);
|
|
267
273
|
}
|
|
268
274
|
const mkcertGenCmd = `"${mkcertBin}" -cert-file "${DEFAULT_TLS_CERT_FILE}" -key-file "${DEFAULT_TLS_KEY_FILE}" ${hostArgs.join(' ')}`;
|
|
269
|
-
|
|
275
|
+
console.log(`${dim}Running: ${mkcertBin} ${hostArgs.join(' ')}${reset}`);
|
|
276
|
+
try {
|
|
277
|
+
execSync(mkcertGenCmd, { stdio: 'inherit' });
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
throw new Error(`Failed to generate TLS certificates with mkcert`);
|
|
281
|
+
}
|
|
270
282
|
ensureFileExists(DEFAULT_TLS_CERT_FILE, 'TLS cert');
|
|
271
283
|
ensureFileExists(DEFAULT_TLS_KEY_FILE, 'TLS key');
|
|
284
|
+
console.log(`${cyan}Local certificates generated at ${TLS_DIR}${reset}\n`);
|
|
272
285
|
return { keyPath: DEFAULT_TLS_KEY_FILE, certPath: DEFAULT_TLS_CERT_FILE };
|
|
273
286
|
}
|
|
274
|
-
function spawnSyncOrThrow(command) {
|
|
275
|
-
execSync(command, { stdio: 'ignore' });
|
|
276
|
-
}
|
|
277
287
|
function readPidFile() {
|
|
278
288
|
try {
|
|
279
289
|
const raw = fs.readFileSync(PID_FILE, 'utf8').trim();
|
|
@@ -585,15 +595,25 @@ async function main() {
|
|
|
585
595
|
if (shouldEnableHttps) {
|
|
586
596
|
process.env.HTTPS = '1';
|
|
587
597
|
}
|
|
598
|
+
if (options.tlsKey && options.tlsCert) {
|
|
599
|
+
process.env.TLS_KEY_PATH = resolveFromCwd(options.tlsKey);
|
|
600
|
+
process.env.TLS_CERT_PATH = resolveFromCwd(options.tlsCert);
|
|
601
|
+
}
|
|
588
602
|
if (options.installLocalCert) {
|
|
589
603
|
const host = process.env.HOST || 'localhost';
|
|
590
604
|
const generated = installLocalCert(host);
|
|
591
605
|
process.env.TLS_KEY_PATH = generated.keyPath;
|
|
592
606
|
process.env.TLS_CERT_PATH = generated.certPath;
|
|
593
607
|
}
|
|
594
|
-
if (
|
|
595
|
-
|
|
596
|
-
|
|
608
|
+
if (process.env.HTTPS === '1' && !process.env.TLS_KEY_PATH && !process.env.TLS_CERT_PATH) {
|
|
609
|
+
const defaultKeyExists = fs.existsSync(DEFAULT_TLS_KEY_FILE);
|
|
610
|
+
const defaultCertExists = fs.existsSync(DEFAULT_TLS_CERT_FILE);
|
|
611
|
+
if (!defaultKeyExists || !defaultCertExists) {
|
|
612
|
+
const host = process.env.HOST || 'localhost';
|
|
613
|
+
const generated = installLocalCert(host);
|
|
614
|
+
process.env.TLS_KEY_PATH = generated.keyPath;
|
|
615
|
+
process.env.TLS_CERT_PATH = generated.certPath;
|
|
616
|
+
}
|
|
597
617
|
}
|
|
598
618
|
if (process.env.HTTPS === '1') {
|
|
599
619
|
const tlsKeyPath = resolveFromCwd(process.env.TLS_KEY_PATH || DEFAULT_TLS_KEY_FILE);
|