forked from GitHubMirrors/silverbullet-icalendar
Fix: Align repo structure with Library naming
All checks were successful
Build SilverBullet Plug / build (push) Successful in 24s
All checks were successful
Build SilverBullet Plug / build (push) Successful in 24s
This commit is contained in:
8
Library/sstent/icalendar/PLUG.md
Normal file
8
Library/sstent/icalendar/PLUG.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
name: Library/sstent/icalendar
|
||||
version: 0.3.0
|
||||
tags: meta/library
|
||||
files:
|
||||
- icalendar.plug.js
|
||||
---
|
||||
iCalendar sync plug for SilverBullet.
|
||||
2
Library/sstent/icalendar/icalendar.plug.js
Normal file
2
Library/sstent/icalendar/icalendar.plug.js
Normal file
@@ -0,0 +1,2 @@
|
||||
function u(n){let e=atob(n),o=e.length,r=new Uint8Array(o);for(let t=0;t<o;t++)r[t]=e.charCodeAt(t);return r}function i(n){typeof n=="string"&&(n=new TextEncoder().encode(n));let e="",o=n.byteLength;for(let r=0;r<o;r++)e+=String.fromCharCode(n[r]);return btoa(e)}var C=new Uint8Array(16);var l=class{prefix;maxCaptureSize;originalConsole;logBuffer;constructor(e="",o=1e3){this.prefix=e,this.maxCaptureSize=o,this.logBuffer=[],this.prefix=e,this.originalConsole={log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),debug:console.debug.bind(console)},this.patchConsole()}patchConsole(){let e=o=>(...r)=>{let t=this.prefix?[this.prefix,...r]:r;this.originalConsole[o](...t),this.captureLog(o,r)};console.log=e("log"),console.info=e("info"),console.warn=e("warn"),console.error=e("error"),console.debug=e("debug")}captureLog(e,o){let r={level:e,timestamp:Date.now(),message:o.map(t=>{if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}).join(" ")};this.logBuffer.push(r),this.logBuffer.length>this.maxCaptureSize&&this.logBuffer.shift()}async postToServer(e,o){if(this.logBuffer.length>0){let t=[...this.logBuffer];this.logBuffer=[];try{if(!(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.map(s=>({...s,source:o})))})).ok)throw new Error("Failed to post logs to server")}catch(a){console.warn("Could not post logs to server",a.message),this.logBuffer.unshift(...t)}}}},f;function h(n=""){return f=new l(n),f}var c=n=>{throw new Error("Not initialized yet")},p=typeof window>"u"&&typeof globalThis.WebSocketPair>"u";typeof Deno>"u"&&(self.Deno={args:[],build:{arch:"x86_64"},env:{get(){}}});var y=new Map,d=0;p&&(globalThis.syscall=async(n,...e)=>await new Promise((o,r)=>{d++,y.set(d,{resolve:o,reject:r}),c({type:"sys",id:d,name:n,args:e})}));function g(n,e,o){p&&(c=o,self.addEventListener("message",r=>{(async()=>{let t=r.data;switch(t.type){case"inv":{let a=n[t.name];if(!a)throw new Error(`Function not loaded: ${t.name}`);try{let s=await Promise.resolve(a(...t.args||[]));c({type:"invr",id:t.id,result:s})}catch(s){console.error("An exception was thrown as a result of invoking function",t.name,"error:",s.message),c({type:"invr",id:t.id,error:s.message})}}break;case"sysr":{let a=t.id,s=y.get(a);if(!s)throw Error("Invalid request id");y.delete(a),t.error?s.reject(new Error(t.error)):s.resolve(t.result)}break}})().catch(console.error)}),c({type:"manifest",manifest:e}),h(`[${e.name} plug]`))}async function b(n,e){if(typeof n!="string"){let o=new Uint8Array(await n.arrayBuffer()),r=o.length>0?i(o):void 0;e={method:n.method,headers:Object.fromEntries(n.headers.entries()),base64Body:r},n=n.url}return syscall("sandboxFetch.fetch",n,e)}globalThis.nativeFetch=globalThis.fetch;function x(){globalThis.fetch=async function(n,e){let o=e&&e.body?i(new Uint8Array(await new Response(e.body).arrayBuffer())):void 0,r=await b(n,e&&{method:e.method,headers:e.headers,base64Body:o});return new Response(r.base64Body?u(r.base64Body):null,{status:r.status,headers:r.headers})}}p&&x();var w={},m={name:"icalendar",version:"0.3.0",author:"sstent",functions:{syncCalendars:{command:"iCalendar: Sync"},forceSync:{command:"iCalendar: Force Sync"},clearCache:{command:"iCalendar: Clear Cache"},showVersion:{command:"iCalendar: Show Version"}},permissions:["http"],assets:{}},K={manifest:m,functionMapping:w};g(w,m,self.postMessage);export{K as plug};
|
||||
//# sourceMappingURL=icalendar.plug.js.map
|
||||
Reference in New Issue
Block a user