@noldova/desktop.electron 0.0.0-stage → 0.0.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.
Files changed (590) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -2
  3. package/api/index.d.ts +11138 -0
  4. package/api/index.js +144 -0
  5. package/api/index.js.map +1 -0
  6. package/enums/file-save-outcome.js +14 -0
  7. package/enums/file-save-outcome.js.map +1 -0
  8. package/enums/main-process-failure-kind.js +13 -0
  9. package/enums/main-process-failure-kind.js.map +1 -0
  10. package/enums/menu-bar-row-type.js +14 -0
  11. package/enums/menu-bar-row-type.js.map +1 -0
  12. package/enums/menu-check.js +14 -0
  13. package/enums/menu-check.js.map +1 -0
  14. package/enums/path-command-outcome.js +16 -0
  15. package/enums/path-command-outcome.js.map +1 -0
  16. package/enums/quit-choice.js +14 -0
  17. package/enums/quit-choice.js.map +1 -0
  18. package/enums/quit-outcome.js +14 -0
  19. package/enums/quit-outcome.js.map +1 -0
  20. package/enums/startup-state-kind.js +19 -0
  21. package/enums/startup-state-kind.js.map +1 -0
  22. package/enums/tray-icon-state.js +16 -0
  23. package/enums/tray-icon-state.js.map +1 -0
  24. package/enums/update-state-kind.js +18 -0
  25. package/enums/update-state-kind.js.map +1 -0
  26. package/enums/web-address-kind.js +16 -0
  27. package/enums/web-address-kind.js.map +1 -0
  28. package/enums/window-error-admission.js +14 -0
  29. package/enums/window-error-admission.js.map +1 -0
  30. package/exceptions/app-image-folder-unwritable.exception.js +18 -0
  31. package/exceptions/app-image-folder-unwritable.exception.js.map +1 -0
  32. package/exceptions/app-image-leftover-not-removed.exception.js +17 -0
  33. package/exceptions/app-image-leftover-not-removed.exception.js.map +1 -0
  34. package/exceptions/app-image-not-replaced.exception.js +18 -0
  35. package/exceptions/app-image-not-replaced.exception.js.map +1 -0
  36. package/exceptions/app-image-unreadable.exception.js +18 -0
  37. package/exceptions/app-image-unreadable.exception.js.map +1 -0
  38. package/exceptions/databases-not-backed-up.exception.js +18 -0
  39. package/exceptions/databases-not-backed-up.exception.js.map +1 -0
  40. package/exceptions/debian-installer-missing.exception.js +15 -0
  41. package/exceptions/debian-installer-missing.exception.js.map +1 -0
  42. package/exceptions/debian-package-not-installed.exception.js +18 -0
  43. package/exceptions/debian-package-not-installed.exception.js.map +1 -0
  44. package/exceptions/device-identity.exception.js +17 -0
  45. package/exceptions/device-identity.exception.js.map +1 -0
  46. package/exceptions/electron.exception.js +14 -0
  47. package/exceptions/electron.exception.js.map +1 -0
  48. package/exceptions/installer-not-copied.exception.js +15 -0
  49. package/exceptions/installer-not-copied.exception.js.map +1 -0
  50. package/exceptions/installer-not-held.exception.js +17 -0
  51. package/exceptions/installer-not-held.exception.js.map +1 -0
  52. package/exceptions/installer-not-started.exception.js +18 -0
  53. package/exceptions/installer-not-started.exception.js.map +1 -0
  54. package/exceptions/installer-unsigned.exception.js +19 -0
  55. package/exceptions/installer-unsigned.exception.js.map +1 -0
  56. package/exceptions/not-an-app-image.exception.js +15 -0
  57. package/exceptions/not-an-app-image.exception.js.map +1 -0
  58. package/exceptions/path-command.exception.js +18 -0
  59. package/exceptions/path-command.exception.js.map +1 -0
  60. package/exceptions/processes-not-exited.exception.js +19 -0
  61. package/exceptions/processes-not-exited.exception.js.map +1 -0
  62. package/exceptions/program.exception.js +18 -0
  63. package/exceptions/program.exception.js.map +1 -0
  64. package/exceptions/restart-arguments-not-written.exception.js +15 -0
  65. package/exceptions/restart-arguments-not-written.exception.js.map +1 -0
  66. package/exceptions/runtime-starter-ended.exception.js +15 -0
  67. package/exceptions/runtime-starter-ended.exception.js.map +1 -0
  68. package/exceptions/runtime-starter-failed.exception.js +17 -0
  69. package/exceptions/runtime-starter-failed.exception.js.map +1 -0
  70. package/exceptions/ship-it-not-found.exception.js +15 -0
  71. package/exceptions/ship-it-not-found.exception.js.map +1 -0
  72. package/exceptions/ship-it-not-removed.exception.js +16 -0
  73. package/exceptions/ship-it-not-removed.exception.js.map +1 -0
  74. package/exceptions/ship-it-unreadable.exception.js +16 -0
  75. package/exceptions/ship-it-unreadable.exception.js.map +1 -0
  76. package/exceptions/stale-update.exception.js +14 -0
  77. package/exceptions/stale-update.exception.js.map +1 -0
  78. package/exceptions/unusable-folder.exception.js +18 -0
  79. package/exceptions/unusable-folder.exception.js.map +1 -0
  80. package/exceptions/update-changed-before-handoff.exception.js +15 -0
  81. package/exceptions/update-changed-before-handoff.exception.js.map +1 -0
  82. package/exceptions/update-checker-unknown.exception.js +15 -0
  83. package/exceptions/update-checker-unknown.exception.js.map +1 -0
  84. package/exceptions/update-download-interrupted.exception.js +15 -0
  85. package/exceptions/update-download-interrupted.exception.js.map +1 -0
  86. package/exceptions/update-download-mismatch.exception.js +15 -0
  87. package/exceptions/update-download-mismatch.exception.js.map +1 -0
  88. package/exceptions/update-failed-unexpectedly.exception.js +15 -0
  89. package/exceptions/update-failed-unexpectedly.exception.js.map +1 -0
  90. package/exceptions/update-feed-redirected.exception.js +15 -0
  91. package/exceptions/update-feed-redirected.exception.js.map +1 -0
  92. package/exceptions/update-feed-refused.exception.js +17 -0
  93. package/exceptions/update-feed-refused.exception.js.map +1 -0
  94. package/exceptions/update-feed-unreachable.exception.js +15 -0
  95. package/exceptions/update-feed-unreachable.exception.js.map +1 -0
  96. package/exceptions/update-handoff.exception.js +14 -0
  97. package/exceptions/update-handoff.exception.js.map +1 -0
  98. package/exceptions/update-holder-not-found.exception.js +15 -0
  99. package/exceptions/update-holder-not-found.exception.js.map +1 -0
  100. package/exceptions/update-info-invalid.exception.js +15 -0
  101. package/exceptions/update-info-invalid.exception.js.map +1 -0
  102. package/exceptions/update-no-longer-offered.exception.js +17 -0
  103. package/exceptions/update-no-longer-offered.exception.js.map +1 -0
  104. package/exceptions/update-not-signed.exception.js +15 -0
  105. package/exceptions/update-not-signed.exception.js.map +1 -0
  106. package/exceptions/update-not-staged-in-time.exception.js +15 -0
  107. package/exceptions/update-not-staged-in-time.exception.js.map +1 -0
  108. package/exceptions/update-not-staged.exception.js +15 -0
  109. package/exceptions/update-not-staged.exception.js.map +1 -0
  110. package/exceptions/update-refused.exception.js +19 -0
  111. package/exceptions/update-refused.exception.js.map +1 -0
  112. package/exceptions/update-runtime-not-found.exception.js +17 -0
  113. package/exceptions/update-runtime-not-found.exception.js.map +1 -0
  114. package/exceptions/update-runtime-not-reached.exception.js +17 -0
  115. package/exceptions/update-runtime-not-reached.exception.js.map +1 -0
  116. package/exceptions/update-runtime-still-starting.exception.js +17 -0
  117. package/exceptions/update-runtime-still-starting.exception.js.map +1 -0
  118. package/exceptions/update-stop-failed-unexpectedly.exception.js +15 -0
  119. package/exceptions/update-stop-failed-unexpectedly.exception.js.map +1 -0
  120. package/exceptions/update-stop.exception.js +14 -0
  121. package/exceptions/update-stop.exception.js.map +1 -0
  122. package/exceptions/update-under-way.exception.js +15 -0
  123. package/exceptions/update-under-way.exception.js.map +1 -0
  124. package/exceptions/update-unsaved.exception.js +19 -0
  125. package/exceptions/update-unsaved.exception.js.map +1 -0
  126. package/exceptions/update.exception.js +14 -0
  127. package/exceptions/update.exception.js.map +1 -0
  128. package/exceptions/window-state-not-connected.exception.js +15 -0
  129. package/exceptions/window-state-not-connected.exception.js.map +1 -0
  130. package/exceptions/window-state-refused.exception.js +19 -0
  131. package/exceptions/window-state-refused.exception.js.map +1 -0
  132. package/exceptions/window-state-runtime-unreachable.exception.js +15 -0
  133. package/exceptions/window-state-runtime-unreachable.exception.js.map +1 -0
  134. package/exceptions/window-state-unavailable.exception.js +14 -0
  135. package/exceptions/window-state-unavailable.exception.js.map +1 -0
  136. package/exceptions/window-state.exception.js +14 -0
  137. package/exceptions/window-state.exception.js.map +1 -0
  138. package/exceptions/work-started-meanwhile.exception.js +17 -0
  139. package/exceptions/work-started-meanwhile.exception.js.map +1 -0
  140. package/interfaces/i-app-updater.js +9 -0
  141. package/interfaces/i-app-updater.js.map +1 -0
  142. package/interfaces/i-application-host.js +9 -0
  143. package/interfaces/i-application-host.js.map +1 -0
  144. package/interfaces/i-checked-path.js +9 -0
  145. package/interfaces/i-checked-path.js.map +1 -0
  146. package/interfaces/i-clipboard-host.js +9 -0
  147. package/interfaces/i-clipboard-host.js.map +1 -0
  148. package/interfaces/i-close-guard.js +9 -0
  149. package/interfaces/i-close-guard.js.map +1 -0
  150. package/interfaces/i-command-line-host.js +9 -0
  151. package/interfaces/i-command-line-host.js.map +1 -0
  152. package/interfaces/i-context-menu-params.js +9 -0
  153. package/interfaces/i-context-menu-params.js.map +1 -0
  154. package/interfaces/i-created-updater.js +9 -0
  155. package/interfaces/i-created-updater.js.map +1 -0
  156. package/interfaces/i-device-file-store.js +9 -0
  157. package/interfaces/i-device-file-store.js.map +1 -0
  158. package/interfaces/i-dialog-host.js +9 -0
  159. package/interfaces/i-dialog-host.js.map +1 -0
  160. package/interfaces/i-display-host.js +9 -0
  161. package/interfaces/i-display-host.js.map +1 -0
  162. package/interfaces/i-dock-host.js +9 -0
  163. package/interfaces/i-dock-host.js.map +1 -0
  164. package/interfaces/i-electron.js +9 -0
  165. package/interfaces/i-electron.js.map +1 -0
  166. package/interfaces/i-feed-net-session.js +9 -0
  167. package/interfaces/i-feed-net-session.js.map +1 -0
  168. package/interfaces/i-feed-response.js +9 -0
  169. package/interfaces/i-feed-response.js.map +1 -0
  170. package/interfaces/i-feed-runtime-options.js +9 -0
  171. package/interfaces/i-feed-runtime-options.js.map +1 -0
  172. package/interfaces/i-feed-web-request.js +9 -0
  173. package/interfaces/i-feed-web-request.js.map +1 -0
  174. package/interfaces/i-ipc-event.js +9 -0
  175. package/interfaces/i-ipc-event.js.map +1 -0
  176. package/interfaces/i-ipc-host.js +9 -0
  177. package/interfaces/i-ipc-host.js.map +1 -0
  178. package/interfaces/i-ipc-owners.js +9 -0
  179. package/interfaces/i-ipc-owners.js.map +1 -0
  180. package/interfaces/i-main-process-environment.js +9 -0
  181. package/interfaces/i-main-process-environment.js.map +1 -0
  182. package/interfaces/i-main-process-log.js +9 -0
  183. package/interfaces/i-main-process-log.js.map +1 -0
  184. package/interfaces/i-main-process-options.js +9 -0
  185. package/interfaces/i-main-process-options.js.map +1 -0
  186. package/interfaces/i-main-process-tray-parts.js +9 -0
  187. package/interfaces/i-main-process-tray-parts.js.map +1 -0
  188. package/interfaces/i-main-process-update-parts.js +9 -0
  189. package/interfaces/i-main-process-update-parts.js.map +1 -0
  190. package/interfaces/i-main-process-window.js +9 -0
  191. package/interfaces/i-main-process-window.js.map +1 -0
  192. package/interfaces/i-menu-host.js +9 -0
  193. package/interfaces/i-menu-host.js.map +1 -0
  194. package/interfaces/i-native-updater.js +9 -0
  195. package/interfaces/i-native-updater.js.map +1 -0
  196. package/interfaces/i-notification-host.js +9 -0
  197. package/interfaces/i-notification-host.js.map +1 -0
  198. package/interfaces/i-parent-port.js +9 -0
  199. package/interfaces/i-parent-port.js.map +1 -0
  200. package/interfaces/i-path-command-files.js +9 -0
  201. package/interfaces/i-path-command-files.js.map +1 -0
  202. package/interfaces/i-permission-host.js +9 -0
  203. package/interfaces/i-permission-host.js.map +1 -0
  204. package/interfaces/i-preload-channels.js +9 -0
  205. package/interfaces/i-preload-channels.js.map +1 -0
  206. package/interfaces/i-preload-settings.js +9 -0
  207. package/interfaces/i-preload-settings.js.map +1 -0
  208. package/interfaces/i-preventable-event.js +9 -0
  209. package/interfaces/i-preventable-event.js.map +1 -0
  210. package/interfaces/i-program-host.js +9 -0
  211. package/interfaces/i-program-host.js.map +1 -0
  212. package/interfaces/i-protocol-host.js +9 -0
  213. package/interfaces/i-protocol-host.js.map +1 -0
  214. package/interfaces/i-quit-control-parts.js +9 -0
  215. package/interfaces/i-quit-control-parts.js.map +1 -0
  216. package/interfaces/i-quit-host.js +9 -0
  217. package/interfaces/i-quit-host.js.map +1 -0
  218. package/interfaces/i-quit-prompt.js +9 -0
  219. package/interfaces/i-quit-prompt.js.map +1 -0
  220. package/interfaces/i-runtime-connection.js +9 -0
  221. package/interfaces/i-runtime-connection.js.map +1 -0
  222. package/interfaces/i-runtime-event-owners.js +9 -0
  223. package/interfaces/i-runtime-event-owners.js.map +1 -0
  224. package/interfaces/i-runtime-launcher.js +9 -0
  225. package/interfaces/i-runtime-launcher.js.map +1 -0
  226. package/interfaces/i-scheme-registry.js +9 -0
  227. package/interfaces/i-scheme-registry.js.map +1 -0
  228. package/interfaces/i-secret-storage-host.js +9 -0
  229. package/interfaces/i-secret-storage-host.js.map +1 -0
  230. package/interfaces/i-sender-frame.js +9 -0
  231. package/interfaces/i-sender-frame.js.map +1 -0
  232. package/interfaces/i-session-host.js +9 -0
  233. package/interfaces/i-session-host.js.map +1 -0
  234. package/interfaces/i-shell-host.js +9 -0
  235. package/interfaces/i-shell-host.js.map +1 -0
  236. package/interfaces/i-ship-it-process.js +9 -0
  237. package/interfaces/i-ship-it-process.js.map +1 -0
  238. package/interfaces/i-shortcut-host.js +9 -0
  239. package/interfaces/i-shortcut-host.js.map +1 -0
  240. package/interfaces/i-shown-path-files.js +9 -0
  241. package/interfaces/i-shown-path-files.js.map +1 -0
  242. package/interfaces/i-shown-path-status.js +9 -0
  243. package/interfaces/i-shown-path-status.js.map +1 -0
  244. package/interfaces/i-spell-check-host.js +9 -0
  245. package/interfaces/i-spell-check-host.js.map +1 -0
  246. package/interfaces/i-split-path.js +9 -0
  247. package/interfaces/i-split-path.js.map +1 -0
  248. package/interfaces/i-system-notification.js +9 -0
  249. package/interfaces/i-system-notification.js.map +1 -0
  250. package/interfaces/i-theme-host.js +9 -0
  251. package/interfaces/i-theme-host.js.map +1 -0
  252. package/interfaces/i-tray-actions.js +9 -0
  253. package/interfaces/i-tray-actions.js.map +1 -0
  254. package/interfaces/i-tray-host.js +9 -0
  255. package/interfaces/i-tray-host.js.map +1 -0
  256. package/interfaces/i-tray.js +9 -0
  257. package/interfaces/i-tray.js.map +1 -0
  258. package/interfaces/i-update-check-lock.js +9 -0
  259. package/interfaces/i-update-check-lock.js.map +1 -0
  260. package/interfaces/i-update-handoff.js +9 -0
  261. package/interfaces/i-update-handoff.js.map +1 -0
  262. package/interfaces/i-update-host.js +9 -0
  263. package/interfaces/i-update-host.js.map +1 -0
  264. package/interfaces/i-update-setup.js +9 -0
  265. package/interfaces/i-update-setup.js.map +1 -0
  266. package/interfaces/i-update-target.js +9 -0
  267. package/interfaces/i-update-target.js.map +1 -0
  268. package/interfaces/i-updater.js +9 -0
  269. package/interfaces/i-updater.js.map +1 -0
  270. package/interfaces/i-utility-process-host.js +9 -0
  271. package/interfaces/i-utility-process-host.js.map +1 -0
  272. package/interfaces/i-utility-process.js +9 -0
  273. package/interfaces/i-utility-process.js.map +1 -0
  274. package/interfaces/i-web-view-attach-params.js +9 -0
  275. package/interfaces/i-web-view-attach-params.js.map +1 -0
  276. package/interfaces/i-web-view-attach-preferences.js +9 -0
  277. package/interfaces/i-web-view-attach-preferences.js.map +1 -0
  278. package/interfaces/i-web-view-contents.js +9 -0
  279. package/interfaces/i-web-view-contents.js.map +1 -0
  280. package/interfaces/i-web-view-debugger.js +9 -0
  281. package/interfaces/i-web-view-debugger.js.map +1 -0
  282. package/interfaces/i-web-view-engine.js +9 -0
  283. package/interfaces/i-web-view-engine.js.map +1 -0
  284. package/interfaces/i-web-view-guest.js +9 -0
  285. package/interfaces/i-web-view-guest.js.map +1 -0
  286. package/interfaces/i-web-view-input-event.js +9 -0
  287. package/interfaces/i-web-view-input-event.js.map +1 -0
  288. package/interfaces/i-web-view-input.js +9 -0
  289. package/interfaces/i-web-view-input.js.map +1 -0
  290. package/interfaces/i-web-view-key-event.js +9 -0
  291. package/interfaces/i-web-view-key-event.js.map +1 -0
  292. package/interfaces/i-web-view-redirect.js +9 -0
  293. package/interfaces/i-web-view-redirect.js.map +1 -0
  294. package/interfaces/i-web-view-request.js +9 -0
  295. package/interfaces/i-web-view-request.js.map +1 -0
  296. package/interfaces/i-web-view-session.js +9 -0
  297. package/interfaces/i-web-view-session.js.map +1 -0
  298. package/interfaces/i-window-contents.js +9 -0
  299. package/interfaces/i-window-contents.js.map +1 -0
  300. package/interfaces/i-window-navigation.js +9 -0
  301. package/interfaces/i-window-navigation.js.map +1 -0
  302. package/interfaces/i-window-open-details.js +9 -0
  303. package/interfaces/i-window-open-details.js.map +1 -0
  304. package/interfaces/i-window-session.js +9 -0
  305. package/interfaces/i-window-session.js.map +1 -0
  306. package/interfaces/i-window-state-store.js +9 -0
  307. package/interfaces/i-window-state-store.js.map +1 -0
  308. package/main.js +160 -0
  309. package/main.js.map +1 -0
  310. package/models/caught-failure.js +15 -0
  311. package/models/caught-failure.js.map +1 -0
  312. package/models/detached-start-reply.js +51 -0
  313. package/models/detached-start-reply.js.map +1 -0
  314. package/models/detached-start-request.js +45 -0
  315. package/models/detached-start-request.js.map +1 -0
  316. package/models/error-code.js +22 -0
  317. package/models/error-code.js.map +1 -0
  318. package/models/feed-source.js +32 -0
  319. package/models/feed-source.js.map +1 -0
  320. package/models/file-grant-request.js +35 -0
  321. package/models/file-grant-request.js.map +1 -0
  322. package/models/file-path-choice.js +38 -0
  323. package/models/file-path-choice.js.map +1 -0
  324. package/models/issued-files.js +21 -0
  325. package/models/issued-files.js.map +1 -0
  326. package/models/known-device.js +32 -0
  327. package/models/known-device.js.map +1 -0
  328. package/models/longest-text.js +35 -0
  329. package/models/longest-text.js.map +1 -0
  330. package/models/main-process-phase.js +13 -0
  331. package/models/main-process-phase.js.map +1 -0
  332. package/models/main-process-settings.js +34 -0
  333. package/models/main-process-settings.js.map +1 -0
  334. package/models/menu-bar-menu.js +25 -0
  335. package/models/menu-bar-menu.js.map +1 -0
  336. package/models/menu-bar-row.js +49 -0
  337. package/models/menu-bar-row.js.map +1 -0
  338. package/models/menu-bar.js +20 -0
  339. package/models/menu-bar.js.map +1 -0
  340. package/models/offered-file.js +50 -0
  341. package/models/offered-file.js.map +1 -0
  342. package/models/pending-quit.js +26 -0
  343. package/models/pending-quit.js.map +1 -0
  344. package/models/preload-settings.js +21 -0
  345. package/models/preload-settings.js.map +1 -0
  346. package/models/quit-question.js +22 -0
  347. package/models/quit-question.js.map +1 -0
  348. package/models/screen-area.js +31 -0
  349. package/models/screen-area.js.map +1 -0
  350. package/models/sender-info.js +18 -0
  351. package/models/sender-info.js.map +1 -0
  352. package/models/started-program.js +17 -0
  353. package/models/started-program.js.map +1 -0
  354. package/models/startup-state.js +45 -0
  355. package/models/startup-state.js.map +1 -0
  356. package/models/taskbar-identity.js +48 -0
  357. package/models/taskbar-identity.js.map +1 -0
  358. package/models/update-ready-record.js +37 -0
  359. package/models/update-ready-record.js.map +1 -0
  360. package/models/update-status.js +40 -0
  361. package/models/update-status.js.map +1 -0
  362. package/models/update-stop-result.js +22 -0
  363. package/models/update-stop-result.js.map +1 -0
  364. package/models/update-version.js +43 -0
  365. package/models/update-version.js.map +1 -0
  366. package/models/web-view-history.js +19 -0
  367. package/models/web-view-history.js.map +1 -0
  368. package/models/window-appearance.js +52 -0
  369. package/models/window-appearance.js.map +1 -0
  370. package/models/window-page.js +23 -0
  371. package/models/window-page.js.map +1 -0
  372. package/models/window-registry.js +85 -0
  373. package/models/window-registry.js.map +1 -0
  374. package/models/window-state.js +93 -0
  375. package/models/window-state.js.map +1 -0
  376. package/package.json +78 -3
  377. package/preload.cjs +186 -0
  378. package/preload.cjs.map +1 -0
  379. package/resources.js +1549 -0
  380. package/resources.js.map +1 -0
  381. package/services/agent-controller.js +61 -0
  382. package/services/agent-controller.js.map +1 -0
  383. package/services/app-icons.js +49 -0
  384. package/services/app-icons.js.map +1 -0
  385. package/services/app-image-environment.js +34 -0
  386. package/services/app-image-environment.js.map +1 -0
  387. package/services/app-image-handoff.js +33 -0
  388. package/services/app-image-handoff.js.map +1 -0
  389. package/services/app-image-replacement.js +82 -0
  390. package/services/app-image-replacement.js.map +1 -0
  391. package/services/app-image-restart.js +71 -0
  392. package/services/app-image-restart.js.map +1 -0
  393. package/services/app-surface-feed.js +114 -0
  394. package/services/app-surface-feed.js.map +1 -0
  395. package/services/appearance-keeper.js +67 -0
  396. package/services/appearance-keeper.js.map +1 -0
  397. package/services/application-menu.js +14 -0
  398. package/services/application-menu.js.map +1 -0
  399. package/services/child-program-host.js +59 -0
  400. package/services/child-program-host.js.map +1 -0
  401. package/services/clipboard-copier.js +82 -0
  402. package/services/clipboard-copier.js.map +1 -0
  403. package/services/close-coordinator.js +47 -0
  404. package/services/close-coordinator.js.map +1 -0
  405. package/services/command-installer.js +58 -0
  406. package/services/command-installer.js.map +1 -0
  407. package/services/daily-check-mark.js +61 -0
  408. package/services/daily-check-mark.js.map +1 -0
  409. package/services/debian-handoff.js +41 -0
  410. package/services/debian-handoff.js.map +1 -0
  411. package/services/debian-package.js +24 -0
  412. package/services/debian-package.js.map +1 -0
  413. package/services/detached-start.js +27 -0
  414. package/services/detached-start.js.map +1 -0
  415. package/services/device-file-store.js +45 -0
  416. package/services/device-file-store.js.map +1 -0
  417. package/services/device-identity.js +39 -0
  418. package/services/device-identity.js.map +1 -0
  419. package/services/device-setting-follower.js +61 -0
  420. package/services/device-setting-follower.js.map +1 -0
  421. package/services/device-state.js +51 -0
  422. package/services/device-state.js.map +1 -0
  423. package/services/electron-web-view-contents.js +96 -0
  424. package/services/electron-web-view-contents.js.map +1 -0
  425. package/services/electron-web-view-engine.js +42 -0
  426. package/services/electron-web-view-engine.js.map +1 -0
  427. package/services/electron-web-view-session.js +47 -0
  428. package/services/electron-web-view-session.js.map +1 -0
  429. package/services/feed-provider.js +84 -0
  430. package/services/feed-provider.js.map +1 -0
  431. package/services/feed-request-guard.js +63 -0
  432. package/services/feed-request-guard.js.map +1 -0
  433. package/services/feed-session.js +30 -0
  434. package/services/feed-session.js.map +1 -0
  435. package/services/feed-updater.js +119 -0
  436. package/services/feed-updater.js.map +1 -0
  437. package/services/file-dialogs.js +180 -0
  438. package/services/file-dialogs.js.map +1 -0
  439. package/services/file-grant-issuer.js +119 -0
  440. package/services/file-grant-issuer.js.map +1 -0
  441. package/services/file-presence.js +14 -0
  442. package/services/file-presence.js.map +1 -0
  443. package/services/installer-handoff.js +75 -0
  444. package/services/installer-handoff.js.map +1 -0
  445. package/services/installer-start.js +35 -0
  446. package/services/installer-start.js.map +1 -0
  447. package/services/ipc-router.js +114 -0
  448. package/services/ipc-router.js.map +1 -0
  449. package/services/layout-keeper.js +52 -0
  450. package/services/layout-keeper.js.map +1 -0
  451. package/services/local-window-state-store.js +38 -0
  452. package/services/local-window-state-store.js.map +1 -0
  453. package/services/main-process-log.js +81 -0
  454. package/services/main-process-log.js.map +1 -0
  455. package/services/main-process-record.js +19 -0
  456. package/services/main-process-record.js.map +1 -0
  457. package/services/main-process-recovery.js +98 -0
  458. package/services/main-process-recovery.js.map +1 -0
  459. package/services/main-process-services.js +34 -0
  460. package/services/main-process-services.js.map +1 -0
  461. package/services/main-process-tray.js +64 -0
  462. package/services/main-process-tray.js.map +1 -0
  463. package/services/main-process-updates.js +69 -0
  464. package/services/main-process-updates.js.map +1 -0
  465. package/services/main-process.js +530 -0
  466. package/services/main-process.js.map +1 -0
  467. package/services/menu-bar-template.js +78 -0
  468. package/services/menu-bar-template.js.map +1 -0
  469. package/services/mirrored-window-state-store.js +26 -0
  470. package/services/mirrored-window-state-store.js.map +1 -0
  471. package/services/open-web-view.js +784 -0
  472. package/services/open-web-view.js.map +1 -0
  473. package/services/open-web-view.resources.js +13 -0
  474. package/services/open-web-view.resources.js.map +1 -0
  475. package/services/open-window.js +155 -0
  476. package/services/open-window.js.map +1 -0
  477. package/services/opened-file-policy.js +46 -0
  478. package/services/opened-file-policy.js.map +1 -0
  479. package/services/path-command.js +78 -0
  480. package/services/path-command.js.map +1 -0
  481. package/services/product-app-adapter.js +30 -0
  482. package/services/product-app-adapter.js.map +1 -0
  483. package/services/publisher-check.js +78 -0
  484. package/services/publisher-check.js.map +1 -0
  485. package/services/quit-control.js +78 -0
  486. package/services/quit-control.js.map +1 -0
  487. package/services/quit-coordinator.js +98 -0
  488. package/services/quit-coordinator.js.map +1 -0
  489. package/services/quit-flow.js +59 -0
  490. package/services/quit-flow.js.map +1 -0
  491. package/services/restart-arguments.js +58 -0
  492. package/services/restart-arguments.js.map +1 -0
  493. package/services/runtime-caller.js +31 -0
  494. package/services/runtime-caller.js.map +1 -0
  495. package/services/runtime-events.js +100 -0
  496. package/services/runtime-events.js.map +1 -0
  497. package/services/runtime-requests.js +92 -0
  498. package/services/runtime-requests.js.map +1 -0
  499. package/services/runtime-startup.js +228 -0
  500. package/services/runtime-startup.js.map +1 -0
  501. package/services/runtime-window-state-store.js +50 -0
  502. package/services/runtime-window-state-store.js.map +1 -0
  503. package/services/secret-answerer.js +57 -0
  504. package/services/secret-answerer.js.map +1 -0
  505. package/services/sender-policy.js +24 -0
  506. package/services/sender-policy.js.map +1 -0
  507. package/services/shared-file-server.js +71 -0
  508. package/services/shared-file-server.js.map +1 -0
  509. package/services/shell-opener.js +88 -0
  510. package/services/shell-opener.js.map +1 -0
  511. package/services/ship-it-process.js +54 -0
  512. package/services/ship-it-process.js.map +1 -0
  513. package/services/shown-file-policy.js +95 -0
  514. package/services/shown-file-policy.js.map +1 -0
  515. package/services/spell-checker.js +62 -0
  516. package/services/spell-checker.js.map +1 -0
  517. package/services/spelling-dictionaries.js +58 -0
  518. package/services/spelling-dictionaries.js.map +1 -0
  519. package/services/squirrel-handoff.js +98 -0
  520. package/services/squirrel-handoff.js.map +1 -0
  521. package/services/stop-key-controller.js +97 -0
  522. package/services/stop-key-controller.js.map +1 -0
  523. package/services/system-notifier.js +103 -0
  524. package/services/system-notifier.js.map +1 -0
  525. package/services/terminal-relaunch.js +52 -0
  526. package/services/terminal-relaunch.js.map +1 -0
  527. package/services/tray-controller.js +164 -0
  528. package/services/tray-controller.js.map +1 -0
  529. package/services/tray-host-watcher.js +86 -0
  530. package/services/tray-host-watcher.js.map +1 -0
  531. package/services/tray-menu-template.js +42 -0
  532. package/services/tray-menu-template.js.map +1 -0
  533. package/services/tray-notices.js +76 -0
  534. package/services/tray-notices.js.map +1 -0
  535. package/services/tray-refresher.js +72 -0
  536. package/services/tray-refresher.js.map +1 -0
  537. package/services/update-barrier-gate.js +78 -0
  538. package/services/update-barrier-gate.js.map +1 -0
  539. package/services/update-barrier-watch.js +83 -0
  540. package/services/update-barrier-watch.js.map +1 -0
  541. package/services/update-bridge.js +86 -0
  542. package/services/update-bridge.js.map +1 -0
  543. package/services/update-check-lock.js +120 -0
  544. package/services/update-check-lock.js.map +1 -0
  545. package/services/update-controller.js +325 -0
  546. package/services/update-controller.js.map +1 -0
  547. package/services/update-restart.js +139 -0
  548. package/services/update-restart.js.map +1 -0
  549. package/services/update-save-coordinator.js +48 -0
  550. package/services/update-save-coordinator.js.map +1 -0
  551. package/services/update-stop.js +222 -0
  552. package/services/update-stop.js.map +1 -0
  553. package/services/update-target-connector.js +84 -0
  554. package/services/update-target-connector.js.map +1 -0
  555. package/services/update-work-question.js +84 -0
  556. package/services/update-work-question.js.map +1 -0
  557. package/services/utility-process-starter.js +47 -0
  558. package/services/utility-process-starter.js.map +1 -0
  559. package/services/web-view-attach-guard.js +41 -0
  560. package/services/web-view-attach-guard.js.map +1 -0
  561. package/services/web-view-bridge.js +55 -0
  562. package/services/web-view-bridge.js.map +1 -0
  563. package/services/web-view-event-backlog.js +38 -0
  564. package/services/web-view-event-backlog.js.map +1 -0
  565. package/services/web-view-event-cut.js +42 -0
  566. package/services/web-view-event-cut.js.map +1 -0
  567. package/services/web-view-host.js +340 -0
  568. package/services/web-view-host.js.map +1 -0
  569. package/services/web-view-key-input.js +37 -0
  570. package/services/web-view-key-input.js.map +1 -0
  571. package/services/web-view-origin-check.js +150 -0
  572. package/services/web-view-origin-check.js.map +1 -0
  573. package/services/web-view-origin-check.resources.js +46 -0
  574. package/services/web-view-origin-check.resources.js.map +1 -0
  575. package/services/window-bounds-keeper.js +145 -0
  576. package/services/window-bounds-keeper.js.map +1 -0
  577. package/services/window-controls.js +97 -0
  578. package/services/window-controls.js.map +1 -0
  579. package/services/window-error-limit.js +32 -0
  580. package/services/window-error-limit.js.map +1 -0
  581. package/services/window-factory.js +87 -0
  582. package/services/window-factory.js.map +1 -0
  583. package/services/window-placement.js +67 -0
  584. package/services/window-placement.js.map +1 -0
  585. package/services/window-recovery.js +138 -0
  586. package/services/window-recovery.js.map +1 -0
  587. package/services/window-text-log.js +37 -0
  588. package/services/window-text-log.js.map +1 -0
  589. package/utility-entry.js +11 -0
  590. package/utility-entry.js.map +1 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { Resources } from "../resources.js";
10
+ export class WebViewKeyInput {
11
+ static read(params) {
12
+ const key = WebViewKeyInput.readText(params[Resources.keyField]);
13
+ const text = WebViewKeyInput.readText(params[Resources.textField]);
14
+ const flags = Number.isSafeInteger(params[Resources.modifiersField]) ? Number(params[Resources.modifiersField]) : 0;
15
+ const modifiers = [
16
+ ...Resources.keyModifierNames.filter(([flag]) => (flags & flag) !== 0).map(([, name]) => name),
17
+ ...params[Resources.autoRepeatField] === true ? [Resources.autoRepeatModifier] : []
18
+ ];
19
+ const keyCode = Resources.webViewKeyNames.get(key) ?? key;
20
+ const press = (type) => keyCode.length === 0 ? [] : [{ type, keyCode, modifiers }];
21
+ const type = params[Resources.typeField];
22
+ if (type === Resources.rawKeyDownType)
23
+ return press("keyDown");
24
+ if (type === Resources.keyDownType)
25
+ return keyCode.length === 0 ? [] : [...press("keyDown"), ...WebViewKeyInput.type(text, modifiers)];
26
+ if (type === Resources.charType)
27
+ return WebViewKeyInput.type(text.length > 0 ? text : key, modifiers);
28
+ return type === Resources.keyUpType ? press("keyUp") : [];
29
+ }
30
+ static type(text, modifiers) {
31
+ return [...text].map(t => ({ type: "char", keyCode: t, modifiers }));
32
+ }
33
+ static readText(value) {
34
+ return Object.isString(value) ? value : String.empty;
35
+ }
36
+ }
37
+ //# sourceMappingURL=web-view-key-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-view-key-input.js","sourceRoot":"","sources":["../../../../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ENSE file in the root directory of this source tree.
7
+ */
8
+ import { isIP } from "node:net";
9
+ import "@noldova/context.core";
10
+ import { ArgumentException } from "@noldova/context.exceptions";
11
+ import { WebAddressKind } from "../enums/web-address-kind.js";
12
+ import { Resources } from "../resources.js";
13
+ import { WebViewOriginCheckResources } from "./web-view-origin-check.resources.js";
14
+ export class WebViewOriginCheck {
15
+ localOrigins;
16
+ neverAllowedPorts;
17
+ constructor(localOrigins = [], neverAllowedPorts = []) {
18
+ this.localOrigins = new Set(localOrigins);
19
+ this.neverAllowedPorts = new Set(neverAllowedPorts);
20
+ }
21
+ static classify(address) {
22
+ const plain = WebViewOriginCheck.plainHost(address);
23
+ if (isIP(plain) === WebViewOriginCheckResources.ipv4Version)
24
+ return WebViewOriginCheck.classifyIpv4(plain);
25
+ if (isIP(plain) !== WebViewOriginCheckResources.ipv6Version)
26
+ throw new ArgumentException(Resources.formatNotAnAddress(address), Resources.addressParameter);
27
+ const hextets = WebViewOriginCheck.expandIpv6(plain);
28
+ const at = (index) => Number(hextets[index]);
29
+ const isZero = (from, to) => hextets.slice(from, to).every(t => t === 0);
30
+ const last = Resources.webViewHextets - 1;
31
+ if (isZero(0, Resources.webViewHextets))
32
+ return WebAddressKind.Unspecified;
33
+ if (isZero(0, last) && at(last) === 1)
34
+ return WebAddressKind.Loopback;
35
+ const isMapped = isZero(0, WebViewOriginCheckResources.mappedMarkerHextet) && at(WebViewOriginCheckResources.mappedMarkerHextet) === WebViewOriginCheckResources.mappedIpv4Marker;
36
+ const isNat64 = at(0) === WebViewOriginCheckResources.nat64First && at(1) === WebViewOriginCheckResources.nat64Second && isZero(WebViewOriginCheckResources.nat64PrefixHextets, WebViewOriginCheckResources.embeddedIpv4Hextet);
37
+ if (isMapped || isZero(0, WebViewOriginCheckResources.embeddedIpv4Hextet) || isNat64)
38
+ return WebViewOriginCheck.classifyIpv4(WebViewOriginCheckResources.formatIpv4(at(WebViewOriginCheckResources.embeddedIpv4Hextet) >> WebViewOriginCheckResources.byteBits, at(WebViewOriginCheckResources.embeddedIpv4Hextet) & WebViewOriginCheckResources.byteMask, at(last) >> WebViewOriginCheckResources.byteBits, at(last) & WebViewOriginCheckResources.byteMask));
39
+ if ((at(0) & WebViewOriginCheckResources.uniqueLocalMask) === WebViewOriginCheckResources.uniqueLocalPrefix)
40
+ return WebAddressKind.Private;
41
+ if ((at(0) & WebViewOriginCheckResources.linkLocalMask) === WebViewOriginCheckResources.linkLocalPrefix)
42
+ return WebAddressKind.LinkLocal;
43
+ return WebAddressKind.Public;
44
+ }
45
+ static isEntry(text) {
46
+ if (text.length > Resources.webViewAddressLimit)
47
+ return false;
48
+ const isWildcard = text.includes(`${Resources.webViewOriginSeparator}${Resources.webViewWildcardPrefix}`);
49
+ const url = URL.parse(isWildcard ? text.replace(Resources.webViewWildcardPrefix, String.empty) : text);
50
+ if (Object.isNull(url) || !Resources.webViewSchemes.includes(url.protocol))
51
+ return false;
52
+ const origin = isWildcard ? url.origin.replace(Resources.webViewOriginSeparator, `${Resources.webViewOriginSeparator}${Resources.webViewWildcardPrefix}`) : url.origin;
53
+ return origin === text && (!isWildcard || isIP(WebViewOriginCheck.plainHost(url.hostname)) === 0);
54
+ }
55
+ allowsRequest(url, allowed) {
56
+ const parsed = url.length > Resources.webViewAddressLimit ? null : URL.parse(url);
57
+ if (Object.isNull(parsed))
58
+ return false;
59
+ if (Resources.webViewSubresourceSchemes.includes(parsed.protocol))
60
+ return true;
61
+ const socketScheme = Resources.webViewSocketSchemes.get(parsed.protocol);
62
+ if (!Resources.webViewSchemes.includes(parsed.protocol) && Object.isUndefined(socketScheme))
63
+ return false;
64
+ if (parsed.username.length > 0 || parsed.password.length > 0)
65
+ return false;
66
+ const host = WebViewOriginCheck.plainHost(parsed.hostname);
67
+ const kind = isIP(host) !== 0 ? WebViewOriginCheck.classify(host) : WebViewOriginCheck.isLoopbackName(host) ? WebAddressKind.Loopback : WebAddressKind.Public;
68
+ if (kind === WebAddressKind.LinkLocal || kind === WebAddressKind.Unspecified)
69
+ return false;
70
+ if (kind === WebAddressKind.Loopback && this.neverAllowedPorts.has(WebViewOriginCheck.readPort(parsed)))
71
+ return false;
72
+ const origin = Object.isUndefined(socketScheme) ? parsed.origin : `${socketScheme}${Resources.webViewOriginSeparator}${parsed.host}`;
73
+ if (kind === WebAddressKind.Loopback || kind === WebAddressKind.Private)
74
+ return allowed.includes(origin);
75
+ return Object.isUndefined(socketScheme) || WebViewOriginCheck.matches(origin, allowed);
76
+ }
77
+ allowsNavigation(url, allowed, isFrame) {
78
+ if (url === Resources.blankPage || (isFrame && url === Resources.sourceDocument))
79
+ return true;
80
+ const parsed = URL.parse(url);
81
+ if (Object.isNull(parsed) || !Resources.webViewSchemes.includes(parsed.protocol))
82
+ return false;
83
+ return this.allowsRequest(url, allowed) && WebViewOriginCheck.matches(parsed.origin, allowed);
84
+ }
85
+ allowsConnection(url, allowed, address) {
86
+ const parsed = URL.parse(url);
87
+ if (Object.isNull(parsed) || Object.isNull(address) || isIP(WebViewOriginCheck.plainHost(address)) === 0)
88
+ return false;
89
+ const kind = WebViewOriginCheck.classify(address);
90
+ if (kind === WebAddressKind.Public)
91
+ return true;
92
+ if (kind === WebAddressKind.LinkLocal || kind === WebAddressKind.Unspecified)
93
+ return false;
94
+ const host = WebViewOriginCheck.plainHost(parsed.hostname);
95
+ const isLocalHost = isIP(host) !== 0 || WebViewOriginCheck.isLoopbackName(host) || this.localOrigins.has(parsed.origin);
96
+ return isLocalHost && allowed.includes(parsed.origin);
97
+ }
98
+ static matches(origin, allowed) {
99
+ if (allowed.includes(origin))
100
+ return true;
101
+ const url = new URL(origin);
102
+ const prefix = `${url.protocol}${Resources.webViewOriginSeparator}${Resources.webViewWildcardPrefix}`;
103
+ return isIP(WebViewOriginCheck.plainHost(url.hostname)) === 0 && allowed.some(t => {
104
+ if (!t.startsWith(prefix))
105
+ return false;
106
+ const pattern = URL.parse(t.replace(Resources.webViewWildcardPrefix, String.empty));
107
+ return !Object.isNull(pattern) && pattern.port === url.port && url.hostname.endsWith(WebViewOriginCheckResources.formatSubdomainSuffix(pattern.hostname));
108
+ });
109
+ }
110
+ static readPort(url) {
111
+ if (url.port.length > 0)
112
+ return Number(url.port);
113
+ return Number(Resources.webViewDefaultPorts.get(url.protocol));
114
+ }
115
+ static classifyIpv4(address) {
116
+ const [a = 0, b = 0] = address.split(WebViewOriginCheckResources.ipv4Separator).map(Number);
117
+ if (a === 0)
118
+ return WebAddressKind.Unspecified;
119
+ if (a === WebViewOriginCheckResources.loopbackFirst)
120
+ return WebAddressKind.Loopback;
121
+ if (a === WebViewOriginCheckResources.privateClassAFirst || (a === WebViewOriginCheckResources.privateClassBFirst && b >= WebViewOriginCheckResources.privateClassBSecondLow && b <= WebViewOriginCheckResources.privateClassBSecondHigh)
122
+ || (a === WebViewOriginCheckResources.privateClassCFirst && b === WebViewOriginCheckResources.privateClassCSecond) || (a === WebViewOriginCheckResources.sharedAddressFirst && b >= WebViewOriginCheckResources.sharedAddressSecondLow && b <= WebViewOriginCheckResources.sharedAddressSecondHigh))
123
+ return WebAddressKind.Private;
124
+ if (a === WebViewOriginCheckResources.linkLocalFirst && b === WebViewOriginCheckResources.linkLocalSecond)
125
+ return WebAddressKind.LinkLocal;
126
+ return WebAddressKind.Public;
127
+ }
128
+ static expandIpv6(address) {
129
+ const parse = (part) => part === String.empty
130
+ ? []
131
+ : part.split(WebViewOriginCheckResources.ipv6Separator).flatMap(t => {
132
+ if (!t.includes(WebViewOriginCheckResources.ipv4Separator))
133
+ return [Number.parseInt(t, WebViewOriginCheckResources.hextetRadix)];
134
+ const [a = 0, b = 0, c = 0, d = 0] = t.split(WebViewOriginCheckResources.ipv4Separator).map(Number);
135
+ return [(a << WebViewOriginCheckResources.byteBits) | b, (c << WebViewOriginCheckResources.byteBits) | d];
136
+ });
137
+ const [head = String.empty, tail] = address.split(WebViewOriginCheckResources.ipv6ZeroRun);
138
+ const first = parse(head);
139
+ const last = Object.isUndefined(tail) ? [] : parse(tail);
140
+ return [...first, ...new Array(Resources.webViewHextets - first.length - last.length).fill(0), ...last];
141
+ }
142
+ static plainHost(host) {
143
+ const [plain = String.empty] = host.toLowerCase().replace(Resources.webViewBracketsPattern, String.empty).replace(Resources.webViewTrailingDotPattern, String.empty).split(Resources.webViewZoneSeparator);
144
+ return plain;
145
+ }
146
+ static isLoopbackName(host) {
147
+ return host === Resources.webViewLoopbackName || host.endsWith(Resources.webViewLoopbackSuffix);
148
+ }
149
+ }
150
+ //# sourceMappingURL=web-view-origin-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-view-origin-check.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/web-view-origin-check.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF,MAAM,OAAO,kBAAkB;IACZ,YAAY,CAAsB;IAClC,iBAAiB,CAAsB;IAExD,YAAmB,eAAkC,EAAE,EAAE,oBAAuC,EAAE;QAChG,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1C,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACtD,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,OAAe;QACpC,MAAM,KAAK,GAAG,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,2BAA2B,CAAC,WAAW;YACzD,OAAO,kBAAkB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC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AAC,CAAC;QAC3M,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,IAAY;QACxC,OAAO,IAAI,KAAK,SAAS,CAAC,mBAAmB,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAClG,CAAC;CACF"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class WebViewOriginCheckResources {
9
+ static ipv4Version = 4;
10
+ static ipv6Version = 6;
11
+ static ipv4Separator = ".";
12
+ static ipv6Separator = ":";
13
+ static ipv6ZeroRun = "::";
14
+ static hextetRadix = 16;
15
+ static mappedMarkerHextet = 5;
16
+ static mappedIpv4Marker = 0xffff;
17
+ static embeddedIpv4Hextet = 6;
18
+ static nat64PrefixHextets = 2;
19
+ static byteBits = 8;
20
+ static byteMask = 0xff;
21
+ static nat64First = 0x64;
22
+ static nat64Second = 0xff9b;
23
+ static uniqueLocalMask = 0xfe00;
24
+ static uniqueLocalPrefix = 0xfc00;
25
+ static linkLocalMask = 0xffc0;
26
+ static linkLocalPrefix = 0xfe80;
27
+ static loopbackFirst = 127;
28
+ static privateClassAFirst = 10;
29
+ static privateClassBFirst = 172;
30
+ static privateClassBSecondLow = 16;
31
+ static privateClassBSecondHigh = 31;
32
+ static privateClassCFirst = 192;
33
+ static privateClassCSecond = 168;
34
+ static sharedAddressFirst = 100;
35
+ static sharedAddressSecondLow = 64;
36
+ static sharedAddressSecondHigh = 127;
37
+ static linkLocalFirst = 169;
38
+ static linkLocalSecond = 254;
39
+ static formatIpv4(first, second, third, fourth) {
40
+ return `${first}.${second}.${third}.${fourth}`;
41
+ }
42
+ static formatSubdomainSuffix(hostname) {
43
+ return `.${hostname}`;
44
+ }
45
+ }
46
+ //# sourceMappingURL=web-view-origin-check.resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-view-origin-check.resources.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/web-view-origin-check.resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,OAAO,2BAA2B;IAC/B,MAAM,CAAU,WAAW,GAAW,CAAC,CAAC;IACxC,MAAM,CAAU,WAAW,GAAW,CAAC,CAAC;IACxC,MAAM,CAAU,aAAa,GAAW,GAAG,CAAC;IAC5C,MAAM,CAAU,aAAa,GAAW,GAAG,CAAC;IAC5C,MAAM,CAAU,WAAW,GAAW,IAAI,CAAC;IAC3C,MAAM,CAAU,WAAW,GAAW,EAAE,CAAC;IACzC,MAAM,CAAU,kBAAkB,GAAW,CAAC,CAAC;IAC/C,MAAM,CAAU,gBAAgB,GAAW,MAAM,CAAC;IAClD,MAAM,CAAU,kBAAkB,GAAW,CAAC,CAAC;IAC/C,MAAM,CAAU,kBAAkB,GAAW,CAAC,CAAC;IAC/C,MAAM,CAAU,QAAQ,GAAW,CAAC,CAAC;IACrC,MAAM,CAAU,QAAQ,GAAW,IAAI,CAAC;IACxC,MAAM,CAAU,UAAU,GAAW,IAAI,CAAC;IAC1C,MAAM,CAAU,WAAW,GAAW,MAAM,CAAC;IAC7C,MAAM,CAAU,eAAe,GAAW,MAAM,CAAC;IACjD,MAAM,CAAU,iBAAiB,GAAW,MAAM,CAAC;IACnD,MAAM,CAAU,aAAa,GAAW,MAAM,CAAC;IAC/C,MAAM,CAAU,eAAe,GAAW,MAAM,CAAC;IACjD,MAAM,CAAU,aAAa,GAAW,GAAG,CAAC;IAC5C,MAAM,CAAU,kBAAkB,GAAW,EAAE,CAAC;IAChD,MAAM,CAAU,kBAAkB,GAAW,GAAG,CAAC;IACjD,MAAM,CAAU,sBAAsB,GAAW,EAAE,CAAC;IACpD,MAAM,CAAU,uBAAuB,GAAW,EAAE,CAAC;IACrD,MAAM,CAAU,kBAAkB,GAAW,GAAG,CAAC;IACjD,MAAM,CAAU,mBAAmB,GAAW,GAAG,CAAC;IAClD,MAAM,CAAU,kBAAkB,GAAW,GAAG,CAAC;IACjD,MAAM,CAAU,sBAAsB,GAAW,EAAE,CAAC;IACpD,MAAM,CAAU,uBAAuB,GAAW,GAAG,CAAC;IACtD,MAAM,CAAU,cAAc,GAAW,GAAG,CAAC;IAC7C,MAAM,CAAU,eAAe,GAAW,GAAG,CAAC;IAE9C,MAAM,CAAC,UAAU,CAAC,KAAa,EAAE,MAAc,EAAE,KAAa,EAAE,MAAc;QACnF,OAAO,GAAG,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;IACjD,CAAC;IAEM,MAAM,CAAC,qBAAqB,CAAC,QAAgB;QAClD,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { WindowStateNotConnectedException } from "../exceptions/window-state-not-connected.exception.js";
10
+ import { WindowStateUnavailableException } from "../exceptions/window-state-unavailable.exception.js";
11
+ import { ScreenArea } from "../models/screen-area.js";
12
+ import { WindowState } from "../models/window-state.js";
13
+ import { Resources } from "../resources.js";
14
+ export class WindowBoundsKeeper {
15
+ window;
16
+ displays;
17
+ saveDelay;
18
+ log;
19
+ keepsStoredPosition;
20
+ restored = null;
21
+ isRead = false;
22
+ store;
23
+ timer;
24
+ hasUnsaved = false;
25
+ isMaximizedAtShow = false;
26
+ isHeld = false;
27
+ constructor(window, displays, saveDelay, log, holdsPersonsMoves, keepsStoredPosition = false) {
28
+ this.window = window;
29
+ this.displays = displays;
30
+ this.saveDelay = saveDelay;
31
+ this.log = log;
32
+ this.keepsStoredPosition = keepsStoredPosition;
33
+ this.store = undefined;
34
+ this.timer = undefined;
35
+ const changed = () => this.noteChange();
36
+ window.on(Resources.resizeEvent, changed);
37
+ window.on(Resources.moveEvent, changed);
38
+ window.on(Resources.maximizeEvent, changed);
39
+ window.on(Resources.unmaximizeEvent, changed);
40
+ if (holdsPersonsMoves) {
41
+ const placed = () => this.notePlacedByPerson();
42
+ window.on(Resources.willMoveEvent, placed);
43
+ window.on(Resources.willResizeEvent, placed);
44
+ }
45
+ }
46
+ begin(store, state) {
47
+ this.isRead = true;
48
+ this.restored = state;
49
+ this.place(state);
50
+ this.store = store;
51
+ }
52
+ async followAsync(store) {
53
+ this.store = store;
54
+ this.isHeld = false;
55
+ await this.saveAsync();
56
+ }
57
+ async restoreAsync(store) {
58
+ this.store = store;
59
+ this.isHeld = false;
60
+ if (this.hasUnsaved) {
61
+ if (this.keepsStoredPosition && !this.isRead)
62
+ this.keepRead(await store.readAsync());
63
+ await this.saveAsync();
64
+ return;
65
+ }
66
+ const state = this.keepRead(await store.readAsync());
67
+ if (!Object.isNull(state))
68
+ this.place(state);
69
+ }
70
+ show() {
71
+ if (this.isMaximizedAtShow)
72
+ this.window.maximize();
73
+ this.isMaximizedAtShow = false;
74
+ this.window.show();
75
+ }
76
+ async saveAsync() {
77
+ this.cancelSave();
78
+ if (this.window.isDestroyed())
79
+ return;
80
+ if (this.isHeld) {
81
+ this.hasUnsaved = true;
82
+ return;
83
+ }
84
+ if (Object.isUndefined(this.store)) {
85
+ if (this.hasUnsaved)
86
+ throw new WindowStateNotConnectedException();
87
+ return;
88
+ }
89
+ if (this.keepsStoredPosition && !this.isRead)
90
+ return;
91
+ const bounds = this.window.getNormalBounds();
92
+ const [x, y] = this.keepsStoredPosition ? [this.restored?.x ?? null, this.restored?.y ?? null] : [bounds.x, bounds.y];
93
+ this.hasUnsaved = true;
94
+ await this.store.writeAsync(new WindowState(x, y, bounds.width, bounds.height, this.window.isMaximized() || this.isMaximizedAtShow).toJson());
95
+ this.hasUnsaved = false;
96
+ }
97
+ async holdAsync() {
98
+ try {
99
+ if (!Object.isUndefined(this.timer) || this.hasUnsaved)
100
+ await this.saveAsync();
101
+ }
102
+ finally {
103
+ this.isHeld = true;
104
+ }
105
+ }
106
+ async saveUnsavedAsync() {
107
+ this.isHeld = false;
108
+ if (this.hasUnsaved)
109
+ await this.saveAsync();
110
+ }
111
+ cancelSave() {
112
+ if (!Object.isUndefined(this.timer))
113
+ clearTimeout(this.timer);
114
+ this.timer = undefined;
115
+ }
116
+ place(state) {
117
+ const areas = this.displays.getAllDisplays().map(t => ScreenArea.of(t.workArea));
118
+ const bounds = state.placeOn(areas, ScreenArea.of(this.displays.getPrimaryDisplay().workArea));
119
+ this.window.setBounds({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });
120
+ this.isMaximizedAtShow = state.isMaximized && !this.window.isVisible();
121
+ if (state.isMaximized && !this.isMaximizedAtShow)
122
+ this.window.maximize();
123
+ }
124
+ keepRead(saved) {
125
+ this.isRead = true;
126
+ this.restored = Object.isNull(saved) ? null : WindowState.fromJson(saved);
127
+ return this.restored;
128
+ }
129
+ noteChange() {
130
+ if (!Object.isUndefined(this.store))
131
+ this.scheduleSave();
132
+ }
133
+ notePlacedByPerson() {
134
+ if (Object.isUndefined(this.store))
135
+ this.hasUnsaved = true;
136
+ }
137
+ scheduleSave() {
138
+ this.cancelSave();
139
+ this.timer = setTimeout(() => void this.saveAsync().catch((error) => {
140
+ if (!(error instanceof WindowStateUnavailableException))
141
+ this.log.write(Resources.formatBoundsUnsaved(String(error)));
142
+ }), this.saveDelay);
143
+ }
144
+ }
145
+ //# sourceMappingURL=window-bounds-keeper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window-bounds-keeper.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/window-bounds-keeper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAG/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AACzG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AAKtG,OAAO,EAAE,UAAU,EAAE,MAAM,0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Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { EditAction, WindowAction } from "@noldova/desktop.protocol";
10
+ import { MenuBar } from "../models/menu-bar.js";
11
+ import { Resources } from "../resources.js";
12
+ import { MenuBarTemplate } from "./menu-bar-template.js";
13
+ export class WindowControls {
14
+ static EDITS = new Map([
15
+ [EditAction.Undo, t => t.undo()],
16
+ [EditAction.Redo, t => t.redo()],
17
+ [EditAction.Cut, t => t.cut()],
18
+ [EditAction.Copy, t => t.copy()],
19
+ [EditAction.Paste, t => t.paste()],
20
+ [EditAction.SelectAll, t => t.selectAll()]
21
+ ]);
22
+ static WINDOW_ACTIONS = new Map([
23
+ [WindowAction.Minimize, t => t.minimize()],
24
+ [WindowAction.ToggleMaximized, t => {
25
+ if (t.isMaximized())
26
+ t.unmaximize();
27
+ else
28
+ t.maximize();
29
+ }],
30
+ [WindowAction.Close, t => t.close()]
31
+ ]);
32
+ menu;
33
+ settings;
34
+ windows;
35
+ spelling;
36
+ log;
37
+ constructor(menu, settings, windows, spelling, log) {
38
+ this.menu = menu;
39
+ this.settings = settings;
40
+ this.windows = windows;
41
+ this.spelling = spelling;
42
+ this.log = log;
43
+ }
44
+ edit(open, action) {
45
+ const run = Object.isString(action) ? WindowControls.EDITS.get(action) : undefined;
46
+ if (Object.isNull(open) || Object.isUndefined(run))
47
+ return false;
48
+ run(open.window.webContents);
49
+ return true;
50
+ }
51
+ actOnWindow(open, action) {
52
+ const run = Object.isString(action) ? WindowControls.WINDOW_ACTIONS.get(action) : undefined;
53
+ if (Object.isNull(open) || Object.isUndefined(run))
54
+ return false;
55
+ run(open.window);
56
+ return true;
57
+ }
58
+ keepSpelling(open, isChecking, languages) {
59
+ if (Object.isNull(open))
60
+ return;
61
+ if (!Object.isBoolean(isChecking) || !Array.isArray(languages) || !languages.every(t => Object.isString(t))) {
62
+ this.log(Resources.formatSpellingRejected(Resources.spellingInvalid));
63
+ return;
64
+ }
65
+ this.spelling.apply(isChecking, languages);
66
+ }
67
+ replaceMisspelling(open, text) {
68
+ if (Object.isNull(open) || !Object.isString(text) || text.length === 0 || text.length > Resources.spellingTextLimit)
69
+ return false;
70
+ open.window.webContents.replaceMisspelling(text);
71
+ return true;
72
+ }
73
+ addToDictionary(open, word) {
74
+ return !Object.isNull(open) && Object.isString(word) && Resources.dictionaryWordPattern.test(word) && this.spelling.addWord(word);
75
+ }
76
+ showMenuBar(open, contentsId, menuBar) {
77
+ if (Object.isNull(open) || !this.settings.isMac)
78
+ return;
79
+ try {
80
+ const template = MenuBarTemplate.build(MenuBar.fromJson(menuBar), id => this.windows.find(contentsId)?.window.webContents.send(Resources.menuCommandChannel, id));
81
+ this.menu.setApplicationMenu(this.menu.buildFromTemplate(template));
82
+ }
83
+ catch (error) {
84
+ this.log(Resources.formatMenuBarRejected(String(error)));
85
+ }
86
+ }
87
+ forwardFieldMenu(open, params) {
88
+ open.window.webContents.send(Resources.fieldMenuChannel, {
89
+ [Resources.xField]: params.x,
90
+ [Resources.yField]: params.y,
91
+ [Resources.isKeyboardField]: params.menuSourceType === Resources.keyboardMenuSource,
92
+ [Resources.wordField]: params.misspelledWord,
93
+ [Resources.suggestionsField]: [...params.dictionarySuggestions]
94
+ });
95
+ }
96
+ }
97
+ //# sourceMappingURL=window-controls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window-controls.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/window-controls.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAOrE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,M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EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC;YAClK,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAEM,gBAAgB,CAAC,IAAgB,EAAE,MAA0B;QAClE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;YACvD,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,cAAc,KAAK,SAAS,CAAC,kBAAkB;YACnF,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,cAAc;YAC5C,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC;SAChE,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { WindowErrorAdmission } from "../enums/window-error-admission.js";
9
+ export class WindowErrorLimit {
10
+ burst;
11
+ period;
12
+ now;
13
+ start = Number.NEGATIVE_INFINITY;
14
+ count = 0;
15
+ constructor(burst, period, now = Date.now) {
16
+ this.burst = burst;
17
+ this.period = period;
18
+ this.now = now;
19
+ }
20
+ admit() {
21
+ const now = this.now();
22
+ if (now - this.start >= this.period) {
23
+ this.start = now;
24
+ this.count = 0;
25
+ }
26
+ this.count++;
27
+ if (this.count <= this.burst)
28
+ return WindowErrorAdmission.Write;
29
+ return this.count === this.burst + 1 ? WindowErrorAdmission.Notice : WindowErrorAdmission.Drop;
30
+ }
31
+ }
32
+ //# sourceMappingURL=window-error-limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window-error-limit.js","sourceRoot":"","sources":["../../../../src/noldova.desktop.electron/src/services/window-error-limit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,MAAM,OAAO,gBAAgB;IACV,KAAK,CAAS;IACd,MAAM,CAAS;IACf,GAAG,CAAe;IAC3B,KAAK,GAAW,MAAM,CAAC,iBAAiB,CAAC;IACzC,KAAK,GAAW,CAAC,CAAC;IAE1B,YAAmB,KAAa,EAAE,MAAc,EAAE,MAAoB,IAAI,CAAC,GAAG;QAC5E,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEM,KAAK;QACV,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;YAC1B,OAAO,oBAAoB,CAAC,KAAK,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC;IACjG,CAAC;CACF"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { PreloadSettings } from "../models/preload-settings.js";
10
+ import { Resources } from "../resources.js";
11
+ export class WindowFactory {
12
+ settings;
13
+ policy;
14
+ electron;
15
+ taskbar;
16
+ icons;
17
+ log;
18
+ constructor(settings, policy, electron, taskbar, icons, log) {
19
+ this.settings = settings;
20
+ this.policy = policy;
21
+ this.electron = electron;
22
+ this.taskbar = taskbar;
23
+ this.icons = icons;
24
+ this.log = log;
25
+ }
26
+ create(state, appearance) {
27
+ const options = {
28
+ width: state.width,
29
+ height: state.height,
30
+ minWidth: Resources.windowMinimumWidth,
31
+ minHeight: Resources.windowMinimumHeight,
32
+ show: false,
33
+ title: Resources.applicationName,
34
+ titleBarStyle: Resources.hiddenTitleBarStyle,
35
+ webPreferences: {
36
+ preload: this.settings.preloadPath,
37
+ contextIsolation: true,
38
+ sandbox: true,
39
+ nodeIntegration: false,
40
+ nodeIntegrationInWorker: false,
41
+ webviewTag: true,
42
+ webSecurity: true,
43
+ spellcheck: true,
44
+ additionalArguments: [new PreloadSettings(appearance).toArgument()]
45
+ }
46
+ };
47
+ if (this.settings.isMac)
48
+ options.trafficLightPosition = { ...Resources.trafficLightPosition };
49
+ else
50
+ options.icon = this.icons.themedWindow;
51
+ if (this.isWindows)
52
+ options.titleBarOverlay = true;
53
+ const window = this.electron.createWindow(options);
54
+ if (this.isWindows)
55
+ window.setAppDetails(this.taskbar.toAppDetails());
56
+ if (!this.settings.isMac)
57
+ this.followTheme(window);
58
+ const contents = window.webContents;
59
+ contents.on(Resources.willNavigateEvent, (event, url) => {
60
+ if (!this.policy.isWindowUrl(url))
61
+ event.preventDefault();
62
+ });
63
+ contents.on(Resources.willRedirectEvent, (event, url) => {
64
+ if (!this.policy.isWindowUrl(url))
65
+ event.preventDefault();
66
+ });
67
+ contents.setWindowOpenHandler(() => ({ action: Resources.denyWindowOpen }));
68
+ const file = this.settings.windowIndexPath;
69
+ window.loadFile(file).catch((error) => this.log(Resources.formatWindowPageNotLoaded(file, String(error))));
70
+ return window;
71
+ }
72
+ paint(window, appearance) {
73
+ window.setBackgroundColor(appearance.background);
74
+ if (this.isWindows)
75
+ window.setTitleBarOverlay({ color: appearance.titleBar, symbolColor: appearance.titleBarText, height: appearance.titleBarHeight });
76
+ }
77
+ get isWindows() {
78
+ return this.settings.platform === Resources.windowsPlatform;
79
+ }
80
+ followTheme(window) {
81
+ const theme = this.electron.theme;
82
+ const update = () => window.setIcon(this.icons.themedWindow);
83
+ theme.on(Resources.themeUpdatedEvent, update);
84
+ window.once(Resources.closedEvent, () => theme.off(Resources.themeUpdatedEvent, update));
85
+ }
86
+ }
87
+ //# sourceMappingURL=window-factory.js.map