Add club-security; rebuild kitchen-sink with the correct join event type
This commit is contained in:
1 parent
8ac2b8542b
commit
2303897787
5 files changed
+43
-4
No files matched your search
Vendored
+1
-1
@@ -37,5 +37,5 @@ var a=`
|
||||
|
||||
.ks-log-line { white-space: pre-wrap; word-break: break-word; }
|
||||
.ks-log-line + .ks-log-line { margin-top: 3px; }
|
||||
`;function d(e){let t=document.createElement("div");return t.className="ks-log",e.appendChild(t),{append(n){let i=document.createElement("div");i.className="ks-log-line";let o=new Date().toLocaleTimeString();for(i.textContent=`${o} ${n}`,t.appendChild(i);t.childElementCount>200;)t.firstElementChild?.remove();t.scrollHeight-t.scrollTop-t.clientHeight<40&&(t.scrollTop=t.scrollHeight)},clear(){t.replaceChildren()}}}var u={watchGameLog:{kind:"boolean",label:"Follow the VRChat game log",description:"Streams player joins and world changes into the panel below.",default:!0},oscParameter:{kind:"string",label:"OSC parameter to pulse",description:"Sent to /avatar/parameters/<name> by the dashboard button.",default:"VRCEmote",placeholder:"VRCEmote"},oscValue:{kind:"number",label:"OSC value",default:1,min:0,max:255,step:1},verbosity:{kind:"select",label:"Log verbosity",default:"normal",options:[{value:"quiet",label:"Quiet"},{value:"normal",label:"Normal"},{value:"loud",label:"Everything"}]}},pe={id:"kitchen-sink",settings:u,activate(e){let t={gameLogCount:0,oscParamCount:0,panel:void 0,log:n=>{e.settings.get("verbosity")!=="quiet"&&(e.logger.info(n),t.panel?.append(n))}};e.ui.injectCss(a),p(e),h(e,t),v(e,t),b(e,t),y(e,t),S(e,t),C(e,t),w(e,t),k(e,t),N(e,t),e.logger.info(`Kitchen Sink v${e.version} ready.`)},deactivate(){}};function p(e){e.disposables.add(e.settings.onChange(t=>{e.logger.debug(`Settings changed; verbosity is now ${t.verbosity}.`)}))}function h(e,t){e.events.on("friendTimelineEvent",n=>{t.log(`[friend] ${n.friendName} \u2192 ${n.type}`)}),e.events.on("vrcCurrentInstance",n=>{if(typeof n!="object"||n===null)return;let i=n.worldName;typeof i=="string"&&t.log(`[instance] now in ${i}`)}),e.events.onAny(n=>{e.settings.get("verbosity")==="loud"&&e.logger.debug(`event ${n.type}`)})}function v(e,t){e.gameLog.on(n=>{e.settings.get("watchGameLog")&&(t.gameLogCount+=1,t.log(`[gamelog] ${n.type}: ${n.message}`))}),e.gameLog.onType("OnPlayerJoined",n=>{t.log(`[join] ${n.detail||n.message}`)}),e.gameLog.history(e.signal).then(n=>{e.logger.info(`Game log backlog: ${String(n.length)} entries.`)}).catch(n=>{e.signal.aborted||e.logger.warn(`Could not read the game log: ${String(n)}`)})}function b(e,t){if(!e.osc.available){t.log("[osc] OSC is Windows-only in VRCNext; skipping.");return}e.osc.connect(),e.osc.onParam(n=>{t.oscParamCount+=1,e.settings.get("verbosity")==="loud"&&t.log(`[osc] ${n.name} = ${String(n.value)}`)}),e.osc.onAvatarChange(n=>{t.log(`[osc] avatar ${n.avatarId} with ${String(n.parameters.length)} parameters`)})}function c(e){if(!e.osc.available)return"OSC unavailable (Windows only)";let t=e.settings.get("oscParameter"),n=e.settings.get("oscValue");return e.osc.send(t,"int",n),`${t} = ${String(n)}`}function y(e,t){e.deepLinks.onPrefix("wrld",n=>{t.log(`[link] world ${n.id}`)}),e.deepLinks.on(n=>{t.log(`[link] ${n.prefix}:${n.id}${n.action?` (${n.action})`:""}`)})}function S(e,t){e.router.get("stats",()=>Response.json({gameLogEvents:t.gameLogCount,oscParams:t.oscParamCount,verbosity:e.settings.get("verbosity")})),e.router.get("greet/:name",n=>Response.json({hello:n.params.name??"world"})),e.router.post("osc/pulse",()=>Response.json({sent:c(e)})),e.logger.info(`Routes mounted at ${e.router.base.pathname}`)}function C(e,t){e.contextMenu.contribute(n=>{let i=[{kind:"divider"},{kind:"item",icon:"auto_awesome",label:"Kitchen Sink: log this element",onSelect:()=>{t.log(`[ctx] ${n.element.tagName.toLowerCase()}`)}},{kind:"submenu",icon:"tune",label:"Kitchen Sink: verbosity",items:()=>u.verbosity.options.map(o=>({kind:"item",icon:"adjust",label:o.label,checked:e.settings.get("verbosity")===o.value,onSelect:()=>{e.settings.set("verbosity",o.value)}}))}];if(n.entity!==void 0){let o=n.entity;i.push({kind:"item",icon:"content_copy",label:`Copy ${o.type} id`,onSelect:()=>{navigator.clipboard.writeText(o.id)}})}return i})}function w(e,t){e.gameLog.onType("OnPlayerJoined",n=>{let i=n.detail||n.message;e.notifications.toast({message:`${i} joined.`}),e.notifications.desktopAvailable?e.notifications.desktop({title:"Player joined",subtitle:i,accent:"info"}):t.log("[notify] desktop/VR notifications are Windows-only.")}),e.events.on("friendTimelineEvent",n=>{n.type==="online"&&e.notifications.notifToast({kind:"notification",sender:n.friendName,message:"came online"})})}async function k(e,t){if(!await e.native.ready){t.log(`[native] no companion at ${e.native.endpoint}; VR targets unavailable.`);return}let n=await e.native.targets();t.log(`[native] targets: ${n.map(o=>o.name).join(", ")||"none"}`),e.gameLog.onType("OnPlayerJoined",o=>{let s=o.detail||o.message;e.native.notify({title:"Player joined",content:s,timeoutSecs:4,icon:"user-available",overrides:{wayvr:{content:`${s} joined the instance`,height:200,opacity:.85,alwaysShow:!0}}})}),e.events.on("friendTimelineEvent",o=>{o.type==="online"&&e.native.notify({title:o.friendName,content:"came online",sinks:["wayvr"],timeoutSecs:3,opacity:.7})});let i=await e.native.describe();
Line truncated
|
||||
`;function l(e){let n=document.createElement("div");return n.className="ks-log",e.appendChild(n),{append(t){let i=document.createElement("div");i.className="ks-log-line";let o=new Date().toLocaleTimeString();for(i.textContent=`${o} ${t}`,n.appendChild(i);n.childElementCount>200;)n.firstElementChild?.remove();n.scrollHeight-n.scrollTop-n.clientHeight<40&&(n.scrollTop=n.scrollHeight)},clear(){n.replaceChildren()}}}var u={watchGameLog:{kind:"boolean",label:"Follow the VRChat game log",description:"Streams player joins and world changes into the panel below.",default:!0},oscParameter:{kind:"string",label:"OSC parameter to pulse",description:"Sent to /avatar/parameters/<name> by the dashboard button.",default:"VRCEmote",placeholder:"VRCEmote"},oscValue:{kind:"number",label:"OSC value",default:1,min:0,max:255,step:1},verbosity:{kind:"select",label:"Log verbosity",default:"normal",options:[{value:"quiet",label:"Quiet"},{value:"normal",label:"Normal"},{value:"loud",label:"Everything"}]}},be={id:"kitchen-sink",settings:u,activate(e){let n={gameLogCount:0,oscParamCount:0,panel:void 0,log:t=>{e.settings.get("verbosity")!=="quiet"&&(e.logger.info(t),n.panel?.append(t))}};e.ui.injectCss(a),m(e),h(e,n),v(e,n),b(e,n),y(e,n),S(e,n),C(e,n),_(e,n),w(e,n),k(e,n),e.logger.info(`Kitchen Sink v${e.version} ready.`)},deactivate(){}};function m(e){e.disposables.add(e.settings.onChange(n=>{e.logger.debug(`Settings changed; verbosity is now ${n.verbosity}.`)}))}function h(e,n){e.events.on("friendTimelineEvent",t=>{n.log(`[friend] ${t.friendName} \u2192 ${t.type}`)}),e.events.on("vrcCurrentInstance",t=>{if(typeof t!="object"||t===null)return;let i=t.worldName;typeof i=="string"&&n.log(`[instance] now in ${i}`)}),e.events.onAny(t=>{e.settings.get("verbosity")==="loud"&&e.logger.debug(`event ${t.type}`)})}function v(e,n){e.gameLog.on(t=>{e.settings.get("watchGameLog")&&(n.gameLogCount+=1,n.log(`[gamelog] ${t.type}: ${t.message}`))}),e.gameLog.onType("gl_player_join",t=>{n.log(`[join] ${t.message}`)}),e.gameLog.history(e.signal).then(t=>{e.logger.info(`Game log backlog: ${String(t.length)} entries.`)}).catch(t=>{e.signal.aborted||e.logger.warn(`Could not read the game log: ${String(t)}`)})}function b(e,n){if(!e.osc.available){n.log("[osc] OSC is Windows-only in VRCNext; skipping.");return}e.osc.connect(),e.osc.onParam(t=>{n.oscParamCount+=1,e.settings.get("verbosity")==="loud"&&n.log(`[osc] ${t.name} = ${String(t.value)}`)}),e.osc.onAvatarChange(t=>{n.log(`[osc] avatar ${t.avatarId} with ${String(t.parameters.length)} parameters`)})}function c(e){if(!e.osc.available)return"OSC unavailable (Windows only)";let n=e.settings.get("oscParameter"),t=e.settings.get("oscValue");return e.osc.send(n,"int",t),`${n} = ${String(t)}`}function y(e,n){e.deepLinks.onPrefix("wrld",t=>{n.log(`[link] world ${t.id}`)}),e.deepLinks.on(t=>{n.log(`[link] ${t.prefix}:${t.id}${t.action?` (${t.action})`:""}`)})}function S(e,n){e.router.get("stats",()=>Response.json({gameLogEvents:n.gameLogCount,oscParams:n.oscParamCount,verbosity:e.settings.get("verbosity")})),e.router.get("greet/:name",t=>Response.json({hello:t.params.name??"world"})),e.router.post("osc/pulse",()=>Response.json({sent:c(e)})),e.logger.info(`Routes mounted at ${e.router.base.pathname}`)}function C(e,n){e.contextMenu.contribute(t=>{let i=[{kind:"divider"},{kind:"item",icon:"auto_awesome",label:"Kitchen Sink: log this element",onSelect:()=>{n.log(`[ctx] ${t.element.tagName.toLowerCase()}`)}},{kind:"submenu",icon:"tune",label:"Kitchen Sink: verbosity",items:()=>u.verbosity.options.map(o=>({kind:"item",icon:"adjust",label:o.label,checked:e.settings.get("verbosity")===o.value,onSelect:()=>{e.settings.set("verbosity",o.value)}}))}];if(t.entity!==void 0){let o=t.entity;i.push({kind:"item",icon:"content_copy",label:`Copy ${o.type} id`,onSelect:()=>{navigator.clipboard.writeText(o.id)}})}return i})}function _(e,n){e.gameLog.onType("gl_player_join",t=>{let i=t.message;e.notifications.toast({message:`${i} joined.`}),e.notifications.desktopAvailable?e.notifications.desktop({title:"Player joined",subtitle:i,accent:"info"}):n.log("[notify] desktop/VR notifications are Windows-only.")}),e.events.on("friendTimelineEvent",t=>{t.type==="online"&&e.notifications.notifToast({kind:"notification",sender:t.friendName,message:"came online"})})}async function w(e,n){if(!await e.native.ready){n.log(`[native] no companion at ${e.native.endpoint}; VR targets unavailable.`);return}let t=await e.native.targets();n.log(`[native] targets: ${t.map(o=>o.name).join(", ")||"none"}`),e.gameLog.onType("gl_player_join",o=>{let s=o.message;e.native.notify({title:"Player joined",content:s,timeoutSecs:4,icon:"user-available",overrides:{wayvr:{content:`${s} joined the instance`,height:200,opacity:.85,alwaysShow:!0}}})}),e.events.on("friendTimelineEvent",o=>{o.type==="online"&&e.native.notify({title:o.friendName,content:"came online",sinks:["wayvr"],timeoutSecs:3,opacity:.7})});let i=await e.native.describe();i!==void 0&&n.log(`[native] coLine truncated
|
||||
//# sourceMappingURL=kitchen-sink.js.map
|
||||
Reference in new issue
Block a user