ugly-app 0.1.266 → 0.1.267

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,2 +1,2 @@
1
- export declare const CLI_VERSION = "0.1.266";
1
+ export declare const CLI_VERSION = "0.1.267";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by prebuild — do not edit manually
2
- export const CLI_VERSION = "0.1.266";
2
+ export const CLI_VERSION = "0.1.267";
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-app",
3
- "version": "0.1.266",
3
+ "version": "0.1.267",
4
4
  "type": "module",
5
5
  "main": "./dist/server/index.js",
6
6
  "exports": {
@@ -1,2 +1,2 @@
1
1
  // Auto-generated by prebuild — do not edit manually
2
- export const CLI_VERSION = "0.1.266";
2
+ export const CLI_VERSION = "0.1.267";
@@ -34,7 +34,6 @@ function ensureIframe(): Promise<void> {
34
34
  if (iframe && iframeReady) return Promise.resolve();
35
35
  return new Promise((resolve) => {
36
36
  if (iframe) {
37
- // Already created but not loaded yet
38
37
  const prev = iframe.onload;
39
38
  iframe.onload = (e) => {
40
39
  if (typeof prev === 'function') prev.call(iframe!, e);
@@ -99,7 +98,7 @@ export async function initPush(): Promise<{ registered: boolean }> {
99
98
 
100
99
  await ensureIframe();
101
100
  const result = await postAndWait(
102
- { func: 'pushInit', projectToken: token },
101
+ { func: 'pushInit', authToken: token },
103
102
  'pushStatus',
104
103
  );
105
104
  return { registered: result.registered as boolean };
@@ -119,7 +118,6 @@ export async function requestPushPermission(): Promise<{
119
118
 
120
119
  await ensureIframe();
121
120
 
122
- // Wait for either success or error response
123
121
  const successPromise = new Promise<{ success: boolean; error?: string }>(
124
122
  (resolve) => {
125
123
  pendingResolvers.push({
@@ -139,14 +137,12 @@ export async function requestPushPermission(): Promise<{
139
137
  },
140
138
  );
141
139
 
142
- // Send single message, race on two possible responses
143
140
  iframe!.contentWindow!.postMessage(
144
- { func: 'pushRequestPermission', projectToken: token },
141
+ { func: 'pushRequestPermission', authToken: token },
145
142
  PUSH_FRAME_ORIGIN,
146
143
  );
147
144
 
148
145
  const result = await Promise.race([successPromise, errorPromise]);
149
- // Clean up the losing resolver
150
146
  pendingResolvers = pendingResolvers.filter(
151
147
  (r) => r.func !== 'pushRegistered' && r.func !== 'pushError',
152
148
  );
@@ -46,7 +46,9 @@ export async function sendPush(
46
46
  return { sent: false };
47
47
  }
48
48
 
49
- const res = await fetch('https://ugly.bot/request', {
49
+ const uglyBotUrl = process.env['UGLY_BOT_LOCAL'] === '1' ? 'http://localhost:3000' : 'https://ugly.bot';
50
+ console.log(`[Push] Sending to ${uglyBotUrl}/request op=projectPush targetUserId=${input.targetUserId}`);
51
+ const res = await fetch(`${uglyBotUrl}/request`, {
50
52
  method: 'POST',
51
53
  headers: {
52
54
  'Authorization': `Bearer ${token}`,