niconizer
Version:
A desktop application that displays plain text, images, or any other HTML content on the screen, like nicovideo or bilibili.
1 lines • 2.54 kB
JavaScript
let $b269f1a76e3485aa$var$win;var $3JrO4$electron=require("electron"),$3JrO4$nodeevents=require("node:events"),$3JrO4$ws=require("ws"),$3JrO4$fileuritopath=require("file-uri-to-path");function $parcel$interopDefault(e){return e&&e.__esModule?e.default:e}function $227932eebd1b82f4$export$b784e1159c889d6b(e){if("string"==typeof e)throw TypeError(e);throw e}async function $33e1dfc64922f868$export$db53fed25e8c4a1f(e=25252){let a=new(0,$3JrO4$ws.Server)({host:"127.0.0.1",port:e});return a.on("connection",(e,$)=>{$.headers.origin?.startsWith("file:")?e.on("n:comment",a=>e.send(a)):e.on("message",e=>{let $=e.toString();for(let e of(console.log("[%s] comment: %s",new Date().toISOString(),$),a.clients))e.emit("n:comment",$)})}),await (0,$3JrO4$nodeevents.once)(a,"listening"),a}function $b269f1a76e3485aa$export$e5968930f07b8990(){if($b269f1a76e3485aa$var$win)return;let{size:e}=$3JrO4$electron.screen.getPrimaryDisplay();($b269f1a76e3485aa$var$win=new(0,$3JrO4$electron.BrowserWindow)({x:0,y:0,width:e.width,height:e.height,frame:!1,transparent:!0,alwaysOnTop:!0,hasShadow:!1})).setIgnoreMouseEvents(!0),$b269f1a76e3485aa$var$win.setVisibleOnAllWorkspaces(!0),$b269f1a76e3485aa$var$win.loadURL({}).catch(e=>{throw e}),$b269f1a76e3485aa$var$win.on("closed",()=>{$b269f1a76e3485aa$var$win=void 0})}function $b269f1a76e3485aa$export$76d80e17ab66a7c(){$b269f1a76e3485aa$var$win?.close()}function $c61a4335f98107e4$export$d26796c73d8e3402(){new(0,$3JrO4$electron.Tray)($parcel$interopDefault($3JrO4$fileuritopath)({})).setContextMenu($3JrO4$electron.Menu.buildFromTemplate([{label:"Start",click:$c61a4335f98107e4$export$b3571188c770cc5a},{label:"Stop",click:$c61a4335f98107e4$export$fa6813432f753b0d},{label:"Quit",click:$c61a4335f98107e4$export$bd7a2d304895afaf}]))}function $c61a4335f98107e4$export$b3571188c770cc5a(){$b269f1a76e3485aa$export$e5968930f07b8990()}function $c61a4335f98107e4$export$fa6813432f753b0d(){$b269f1a76e3485aa$export$76d80e17ab66a7c()}function $c61a4335f98107e4$export$bd7a2d304895afaf(){$3JrO4$electron.app.quit()}$3JrO4$electron.app.dock?.hide(),$3JrO4$electron.app.on("ready",()=>{$c61a4335f98107e4$export$d26796c73d8e3402(),setImmediate($c61a4335f98107e4$export$b3571188c770cc5a)}),$3JrO4$electron.app.on("window-all-closed",()=>{});let $4a3e547af3af7140$var$port="string"==typeof process.env.PORT?Number.parseInt(process.env.PORT,10):void 0;$33e1dfc64922f868$export$db53fed25e8c4a1f($4a3e547af3af7140$var$port).then(e=>{console.log(`listening on port ${e.options.port}`)},$227932eebd1b82f4$export$b784e1159c889d6b);