pptclaw 0.1.0
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.
- package/.output/nitro.json +15 -0
- package/.output/public/_nuxt/BAtwhwpp.js +1 -0
- package/.output/public/_nuxt/BEQoYl5X.js +2616 -0
- package/.output/public/_nuxt/BMr1Z083.js +1 -0
- package/.output/public/_nuxt/BXBiPOBE.js +1 -0
- package/.output/public/_nuxt/BuUsXmAh.js +1 -0
- package/.output/public/_nuxt/CPsbnj8a.js +1 -0
- package/.output/public/_nuxt/D9BEMGXo.js +1 -0
- package/.output/public/_nuxt/DQNz2huy.js +1 -0
- package/.output/public/_nuxt/DQxlKO7N.js +1 -0
- package/.output/public/_nuxt/_id_.C3K2GZV8.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/e405cd67-1e23-4b39-85e1-217b00c69ec7.json +1 -0
- package/.output/public/_nuxt/entry.BqkL7BC_.css +1 -0
- package/.output/public/_nuxt/error-404.BzoSHD6c.css +1 -0
- package/.output/public/_nuxt/error-500.DwAqVzgo.css +1 -0
- package/.output/public/_nuxt/j2eJltcB.js +2614 -0
- package/.output/public/alipay.svg +27 -0
- package/.output/public/android-chrome-192x192.png +0 -0
- package/.output/public/android-chrome-512x512.png +0 -0
- package/.output/public/animations/arrow.lottie +0 -0
- package/.output/public/animations/cubes.lottie +0 -0
- package/.output/public/animations/stars.lottie +0 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/auth-bg.svg +30 -0
- package/.output/public/auth-logo.svg +4 -0
- package/.output/public/cursor.png +0 -0
- package/.output/public/customerServiceQr.png +0 -0
- package/.output/public/favicon-16x16.png +0 -0
- package/.output/public/favicon-32x32.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/logo.svg +4 -0
- package/.output/public/rect.svg +9 -0
- package/.output/public/site.webmanifest +1 -0
- package/.output/public/templates.json +1623 -0
- package/.output/public/watermark.svg +7 -0
- package/.output/public/wechat-pay-sm.svg +9 -0
- package/.output/public/wechat-pay.svg +21 -0
- package/.output/server/chunks/_/error-500.mjs +1 -0
- package/.output/server/chunks/_/shared.cjs.prod.mjs +1 -0
- package/.output/server/chunks/build/client.precomputed.mjs +1 -0
- package/.output/server/chunks/nitro/nitro.mjs +1 -0
- package/.output/server/chunks/routes/api/auth/_...path_.mjs +1 -0
- package/.output/server/chunks/routes/api/auth/login.post.mjs +1 -0
- package/.output/server/chunks/routes/api/auth/logout.post.mjs +1 -0
- package/.output/server/chunks/routes/api/auth/user.get.mjs +1 -0
- package/.output/server/chunks/routes/api/cloud/_...path_.mjs +1 -0
- package/.output/server/chunks/routes/api/credits/_...path_.mjs +1 -0
- package/.output/server/chunks/routes/api/images/_...path_.mjs +1 -0
- package/.output/server/chunks/routes/api/payments/_...path_.mjs +1 -0
- package/.output/server/chunks/routes/api/public/ping.mjs +1 -0
- package/.output/server/chunks/routes/api/public/test.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/assets/_session/_...filename_.get.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/close.post.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/open.post.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/sessions.get.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/switch.post.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/upload.post.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/validate.post.mjs +1 -0
- package/.output/server/chunks/routes/api/sync/ws.mjs +1 -0
- package/.output/server/chunks/routes/renderer.mjs +1 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +1 -0
- package/.output/server/index.mjs +1 -0
- package/README.md +49 -0
- package/bin/pptclaw.mjs +165 -0
- package/package.json +130 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{x as e,d as t,r as s,h as i}from"../../../nitro/nitro.mjs";import{readFile as o,access as r,readdir as n}from"node:fs/promises";import{join as a,resolve as l}from"node:path";import"node:http";import"node:https";import"node:crypto";import"stream";import"events";import"http";import"crypto";import"buffer";import"zlib";import"https";import"net";import"tls";import"url";import"node:events";import"node:buffer";import"node:fs";import"fs";import"fs/promises";import"path";import"node:stream";import"os";import"node:os";import"node:url";function extractAssetFilename(e){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return null;const t=e.split("/");return t[t.length-1]||null}const p=t(async t=>{const p=await s(t),{path:f}=p;if(!f)throw i({statusCode:400,message:"path is required"});const d=l(f),m=await async function(t){const s=[],i=[];let l=null;const p=a(t,"manifest.json");try{const e=await o(p,"utf-8");try{l=JSON.parse(e)}catch{s.push({file:"manifest.json",message:"Invalid JSON"})}}catch{s.push({file:"manifest.json",message:"File not found"})}l&&("string"!=typeof l.title&&s.push({file:"manifest.json",field:"title",message:'Missing or invalid "title" (expected string)'}),void 0===l.theme&&s.push({file:"manifest.json",field:"theme",message:'Missing "theme"'}),l.viewport&&"object"==typeof l.viewport?("number"!=typeof l.viewport.width&&s.push({file:"manifest.json",field:"viewport.width",message:'Missing or invalid "viewport.width" (expected number)'}),"number"!=typeof l.viewport.ratio&&s.push({file:"manifest.json",field:"viewport.ratio",message:'Missing or invalid "viewport.ratio" (expected number)'})):s.push({file:"manifest.json",field:"viewport",message:'Missing or invalid "viewport" (expected object)'}),"string"!=typeof l.format&&s.push({file:"manifest.json",field:"format",message:'Missing or invalid "format" (expected string)'}));const f=a(t,"slides");let d=[];try{await r(f),d=(await n(f)).filter(e=>e.endsWith(".json")).sort()}catch{s.push({file:"slides/",message:"Directory not found"})}0===d.length&&s.every(e=>"slides/"!==e.file)&&s.push({file:"slides/",message:"No slide files found"});const m=[];for(const t of d){const r=a(f,t),n=e(t);n||s.push({file:`slides/${t}`,message:"Filename does not match <NNN>-<id>.json pattern"});let l=null;try{const e=await o(r,"utf-8");try{l=JSON.parse(e)}catch{s.push({file:`slides/${t}`,message:"Invalid JSON"})}}catch{s.push({file:`slides/${t}`,message:"Could not read file"})}if(l){if("string"!=typeof l.id&&s.push({file:`slides/${t}`,field:"id",message:'Missing or invalid "id" (expected string)'}),Array.isArray(l.elements)||s.push({file:`slides/${t}`,field:"elements",message:'Missing or invalid "elements" (expected array)'}),n&&"string"==typeof l.id&&l.id!==n.id&&s.push({file:`slides/${t}`,field:"id",message:`Slide id "${l.id}" does not match filename id "${n.id}"`}),Array.isArray(l.elements))for(let e=0;e<l.elements.length;e++){const s=l.elements[e];if(s&&"string"==typeof s.type||i.push({file:`slides/${t}`,field:`elements[${e}].type`,message:'Element missing "type" field'}),s&&"string"==typeof s.type&&("image"===s.type||"video"===s.type||"audio"===s.type)&&"string"==typeof s.src){const e=extractAssetFilename(s.src);e&&m.push({file:`slides/${t}`,ref:e})}}if(l.background){const e=l.background.image||l.background.src;if("string"==typeof e){const s=extractAssetFilename(e);s&&m.push({file:`slides/${t}`,ref:s})}}}}const c=a(t,"assets");for(const{file:e,ref:t}of m)try{await r(a(c,t))}catch{i.push({file:e,field:"assets",message:`Referenced asset "${t}" not found in assets/`})}return{valid:0===s.length,errors:s,warnings:i}}(d);return m});export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{x as s,y as e,z as t,A as i,f as o,B as d,w as n,C as a,t as r,D as c,E as l,F as m}from"../../../nitro/nitro.mjs";import{readdir as p,rename as f,unlink as h}from"node:fs/promises";import{join as k}from"node:path";import"node:http";import"node:https";import"node:crypto";import"stream";import"events";import"http";import"crypto";import"buffer";import"zlib";import"https";import"net";import"tls";import"url";import"node:events";import"node:buffer";import"node:fs";import"fs";import"fs/promises";import"path";import"node:stream";import"os";import"node:os";import"node:url";async function renumberSlides(t,i){const o=k(t,"slides"),d=await p(o),n=new Map;for(const e of d){const t=s(e);t&&n.set(t.id,e)}for(const s of i)if(!n.has(s))throw new Error(`Slide file not found for id "${s}"`);const a=[];for(let s=0;s<i.length;s++){const t=i[s],d=n.get(t),r=`.tmp-${e(s+1,t)}`;a.push(r),await f(k(o,d),k(o,r))}const r=[];for(let s=0;s<i.length;s++){const t=e(s+1,i[s]);r.push(t),await f(k(o,a[s]),k(o,t))}return r}const g=new Map;const w=t({open(s){console.log("[sync:ws] peer connected:",s.id)},async message(s,t){let i;try{i=JSON.parse(t.text())}catch{return void s.send(JSON.stringify({type:"error",message:"Invalid JSON"}))}const p=o(i.sessionId);if(p){d(i.sessionId,s);try{switch(i.type){case"session:join":{!function(s,e){let t=g.get(s);t||(t=new Set,g.set(s,t)),t.add(e)}(i.sessionId,s.id);const e={manifest:p.manifest,slides:p.slides.map(s=>r(s,p.id))};s.send(JSON.stringify({type:"deck:loaded",sessionId:p.id,deck:e}));break}case"slides:save-all":{const s=i.slides.map(s=>a(s)),t={manifest:i.manifest,slides:s},o=k(p.deckPath,"manifest.json");n(o);for(let s=0;s<p.slides.length;s++){const t=e(s+1,p.slides[s].id);n(k(p.deckPath,"slides",t))}for(let t=0;t<s.length;t++){const i=e(t+1,s[t].id);n(k(p.deckPath,"slides",i))}await m(p.deckPath,t),p.manifest=i.manifest,p.slides=i.slides.map(s=>r(a(s),p.id));break}case"slide:save":{const s=a(i.slide),t=e(i.index+1,s.id),o=k(p.deckPath,"slides",t);n(o),await c(o,s);const d=r(s,p.id),l=p.slides.findIndex(s=>s.id===i.slideId);-1!==l&&(p.slides[l]=d);break}case"manifest:save":{const s=k(p.deckPath,"manifest.json");n(s),await l(p.deckPath,i.manifest),p.manifest=i.manifest;break}case"slide:delete":{const s=p.slides.findIndex(s=>s.id===i.slideId);if(-1===s)break;const t=e(s+1,i.slideId),o=k(p.deckPath,"slides",t);n(o),await h(o).catch(()=>{}),p.slides.splice(s,1);const d=p.slides.map(s=>s.id);if(d.length>0){for(let s=0;s<d.length;s++){const t=e(s+1,d[s]);n(k(p.deckPath,"slides",t))}await renumberSlides(p.deckPath,d)}break}case"slide:add":{const s=a(i.slide),t=i.index,o=r(s,p.id);p.slides.splice(t,0,o);const d=p.slides.map(s=>s.id);for(let s=0;s<d.length;s++){const t=e(s+1,d[s]);n(k(p.deckPath,"slides",t))}const l=e(t+1,s.id),m=k(p.deckPath,"slides",l);await c(m,s),await renumberSlides(p.deckPath,d);break}case"slides:reorder":{const{slideIds:s}=i,t=[];for(const e of s){const s=p.slides.find(s=>s.id===e);s&&t.push(s)}p.slides=t;for(let t=0;t<s.length;t++){const i=e(t+1,s[t]);n(k(p.deckPath,"slides",i))}await renumberSlides(p.deckPath,s);break}}}catch(e){console.error("[sync:ws] error handling message:",i.type,e),s.send(JSON.stringify({type:"error",message:`Failed to process ${i.type}: ${e.message}`}))}}else s.send(JSON.stringify({type:"error",message:`Session not found: ${i.sessionId}`}))},close(s){console.log("[sync:ws] peer disconnected:",s.id),i(s),function(s){for(const e of g.values())e.delete(s)}(s.id)}});export{w as default};
|