1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["1750"],{2729:function(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>h,frontMatter:()=>a,metadata:()=>n,assets:()=>l,toc:()=>d,contentTitle:()=>c});var n=JSON.parse('{"id":"features/backup-restore","title":"Backup / Restore","description":"LiveCodes data can be backed-up, so that it can be later restored on the same or different device.","source":"@site/docs/features/backup-restore.mdx","sourceDirName":"features","slug":"/features/backup-restore","permalink":"/docs/features/backup-restore","draft":false,"unlisted":false,"editUrl":"https://github.com/live-codes/livecodes/tree/develop/docs/docs/features/backup-restore.mdx","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"Broadcast","permalink":"/docs/features/broadcast"},"next":{"title":"GitHub Integration","permalink":"/docs/features/github-integration"}}'),o=r("5893"),s=r("65"),i=r("8500");let a={},c="Backup / Restore",l={},d=[{value:"Backup",id:"backup",level:2},{value:"Restore",id:"restore",level:2},{value:"Related",id:"related",level:2}];function u(e){let t={a:"a",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",ol:"ol",p:"p",ul:"ul",...(0,s.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"backup--restore",children:"Backup / Restore"})}),"\n",(0,o.jsx)(t.p,{children:"LiveCodes data can be backed-up, so that it can be later restored on the same or different device."}),"\n",(0,o.jsx)(t.p,{children:"The Backup/Restore screen can be accessed from the Settings menu \u2192 Backup / Restore."}),"\n","\n",(0,o.jsx)(i.Z,{params:{screen:"backup"},linkText:"direct link"}),"\n",(0,o.jsx)(t.h2,{id:"backup",children:"Backup"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{alt:"LiveCode Backup",src:r(6621).Z+"",width:"2240",height:"1400"})}),"\n",(0,o.jsx)(t.p,{children:"The backup can include one or more of the following:"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/projects",children:"Projects"})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/templates",children:"User Templates"})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/snippets",children:"Code Snippets"})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/assets",children:"Assets"})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/user-settings",children:"User Settings"})}),"\n"]}),"\n",(0,o.jsx)(t.p,{children:"A zip file containing the (base64-encoded binary) backup data is downloaded. This file can be restored later on the same or different device."}),"\n",(0,o.jsx)(t.h2,{id:"restore",children:"Restore"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{alt:"LiveCode Restore",src:r(4563).Z+"",width:"2240",height:"1400"})}),"\n",(0,o.jsx)(t.p,{children:"When restoring a backup, there are 2 options for managing the current data:"}),"\n",(0,o.jsxs)(t.ol,{children:["\n",(0,o.jsxs)(t.li,{children:["\n",(0,o.jsx)(t.p,{children:"The current data can be deleted and replaced by the backup data. It cannot then be retrieved, so you may want to back it up first."}),"\n"]}),"\n",(0,o.jsxs)(t.li,{children:["\n",(0,o.jsx)(t.p,{children:"The backup data can be merged with the current data with best effort to preserve both."}),"\n"]}),"\n"]}),"\n",(0,o.jsx)(t.h2,{id:"related",children:"Related"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/sync",children:"Sync"})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"/docs/features/export",children:"Export"})}),"\n"]})]})}function h(e={}){let{wrapper:t}={...(0,s.a)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(u,{...e})}):u(e)}},6621:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=r.p+"assets/images/backup-restore-1-b032913c8d4f028bd6bfd4bb68f099fb.jpg"},4563:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=r.p+"assets/images/backup-restore-2-896b0a37dbb7c963ba344dbf0858deeb.jpg"},7728:function(e,t,r){e=r.nmd(e);var n=function(){var e=String.fromCharCode,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",n={};function o(e,t){if(!n[e]){n[e]={};for(var r=0;r<e.length;r++)n[e][e.charAt(r)]=r}return n[e][t]}var s={compressToBase64:function(e){if(null==e)return"";var r=s._compress(e,6,function(e){return t.charAt(e)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(e){return null==e?"":""==e?null:s._decompress(e.length,32,function(r){return o(t,e.charAt(r))})},compressToUTF16:function(t){return null==t?"":s._compress(t,15,function(t){return e(t+32)})+" "},decompressFromUTF16:function(e){return null==e?"":""==e?null:s._decompress(e.length,16384,function(t){return e.charCodeAt(t)-32})},compressToUint8Array:function(e){for(var t=s.compress(e),r=new Uint8Array(2*t.length),n=0,o=t.length;n<o;n++){var i=t.charCodeAt(n);r[2*n]=i>>>8,r[2*n+1]=i%256}return r},decompressFromUint8Array:function(t){if(null==t)return s.decompress(t);for(var r=Array(t.length/2),n=0,o=r.length;n<o;n++)r[n]=256*t[2*n]+t[2*n+1];var i=[];return r.forEach(function(t){i.push(e(t))}),s.decompress(i.join(""))},compressToEncodedURIComponent:function(e){return null==e?"":s._compress(e,6,function(e){return r.charAt(e)})},decompressFromEncodedURIComponent:function(e){return null==e?"":""==e?null:(e=e.replace(/ /g,"+"),s._decompress(e.length,32,function(t){return o(r,e.charAt(t))}))},compress:function(t){return s._compress(t,16,function(t){return e(t)})},_compress:function(e,t,r){if(null==e)return"";var n,o,s,i={},a={},c="",l="",d="",u=2,h=3,p=2,f=[],m=0,g=0;for(s=0;s<e.length;s+=1)if(c=e.charAt(s),Object.prototype.hasOwnProperty.call(i,c)||(i[c]=h++,a[c]=!0),l=d+c,Object.prototype.hasOwnProperty.call(i,l))d=l;else{if(Object.prototype.hasOwnProperty.call(a,d)){if(256>d.charCodeAt(0)){for(n=0;n<p;n++)m<<=1,g==t-1?(g=0,f.push(r(m)),m=0):g++;for(n=0,o=d.charCodeAt(0);n<8;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1}else{for(n=0,o=1;n<p;n++)m=m<<1|o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o=0;for(n=0,o=d.charCodeAt(0);n<16;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1}0==--u&&(u=Math.pow(2,p),p++),delete a[d]}else for(n=0,o=i[d];n<p;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1;0==--u&&(u=Math.pow(2,p),p++),i[l]=h++,d=String(c)}if(""!==d){if(Object.prototype.hasOwnProperty.call(a,d)){if(256>d.charCodeAt(0)){for(n=0;n<p;n++)m<<=1,g==t-1?(g=0,f.push(r(m)),m=0):g++;for(n=0,o=d.charCodeAt(0);n<8;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1}else{for(n=0,o=1;n<p;n++)m=m<<1|o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o=0;for(n=0,o=d.charCodeAt(0);n<16;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1}0==--u&&(u=Math.pow(2,p),p++),delete a[d]}else for(n=0,o=i[d];n<p;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1;0==--u&&(u=Math.pow(2,p),p++)}for(n=0,o=2;n<p;n++)m=m<<1|1&o,g==t-1?(g=0,f.push(r(m)),m=0):g++,o>>=1;for(;;){if(m<<=1,g==t-1){f.push(r(m));break}g++}return f.join("")},decompress:function(e){return null==e?"":""==e?null:s._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(t,r,n){var o,s,i,a,c,l,d,u=[],h=4,p=4,f=3,m="",g=[],v={val:n(0),position:r,index:1};for(o=0;o<3;o+=1)u[o]=o;for(i=0,c=4,l=1;l!=c;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=r,v.val=n(v.index++)),i|=(a>0?1:0)*l,l<<=1;switch(i){case 0:for(i=0,c=256,l=1;l!=c;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=r,v.val=n(v.index++)),i|=(a>0?1:0)*l,l<<=1;d=e(i);break;case 1:for(i=0,c=65536,l=1;l!=c;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=r,v.val=n(v.index++)),i|=(a>0?1:0)*l,l<<=1;d=e(i);break;case 2:return""}for(u[3]=d,s=d,g.push(d);;){if(v.index>t)return"";for(i=0,c=Math.pow(2,f),l=1;l!=c;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=r,v.val=n(v.index++)),i|=(a>0?1:0)*l,l<<=1;switch(d=i){case 0:for(i=0,c=256,l=1;l!=c;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=r,v.val=n(v.index++)),i|=(a>0?1:0)*l,l<<=1;u[p++]=e(i),d=p-1,h--;break;case 1:for(i=0,c=65536,l=1;l!=c;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=r,v.val=n(v.index++)),i|=(a>0?1:0)*l,l<<=1;u[p++]=e(i),d=p-1,h--;break;case 2:return g.join("")}if(0==h&&(h=Math.pow(2,f),f++),u[d])m=u[d];else{if(d!==p)return null;m=s+s.charAt(0)}g.push(m),u[p++]=s+m.charAt(0),h--,s=m,0==h&&(h=Math.pow(2,f),f++)}}};return s}();"function"==typeof define&&define.amd?define(function(){return n}):null!=e&&(e.exports=n)},8500:function(e,t,r){"use strict";r.d(t,{Z:()=>l});var n=r("5893");r("7294");var o=r("6735");function s(e){let{children:t,fallback:r}=e;return(0,o.Z)()?(0,n.jsx)(n.Fragment,{children:t?.()}):r??null}var i=r("1705"),a=r("8294"),c=r("1858");function l(e){let{params:t,config:r,code:o,language:l="js",codeTitle:d="",showLineNumbers:u=!1,formatCode:h=!0,linkText:p="Run in LiveCodes",style:f={},className:m=""}=e,g=(0,a.r)({appUrl:c.G,params:t,config:r});return(0,n.jsxs)("div",{style:{marginBottom:"30px",...f},className:m,children:[o&&(0,n.jsx)(s,{children:()=>(0,n.jsx)(i.Z,{language:l,title:d,showLineNumbers:u,children:h?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"js";return window.prettier?.format(e,{parser:"html"===t?"html":"babel",plugins:window.prettierPlugins})}(o,l):o})}),(0,n.jsxs)("a",{href:g,target:"_blank",rel:"noreferrer",children:[p,(0,n.jsx)("svg",{width:"12",height:"12","aria-hidden":"true",viewBox:"0 0 24 24",className:"iconExternalLink_node_modules-@docusaurus-theme-classic-lib-theme-Icon-ExternalLink-styles-module",style:{marginLeft:"4px"},children:(0,n.jsx)("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"})})]})]})}},8294:function(e,t,r){"use strict";r.d(t,{T:function(){return o},r:function(){return s}});var n=r(7728);async function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"!=typeof e||e instanceof HTMLElement||!e.headless&&"headless"!==e.view||(t=e,e=null);let{config:r={},headless:n,loading:o="lazy",view:i}=t,a=n||"headless"===i,c=null,l=null;if("string"==typeof e)c=document.querySelector(e);else if(e instanceof HTMLElement)c=e;else if(!(a&&"object"==typeof e))throw Error("A valid container element is required.");if(!c){if(a)E(c=document.createElement("div")),document.body.appendChild(c);else throw Error(`Cannot find element: "${e}"`)}let d=new URL(s(t)),u=d.origin;d.searchParams.set("embed","true"),d.searchParams.set("loading",a?"eager":o);let h=globalThis.process;d.searchParams.set("sdkVersion",h?.env?.SDK_VERSION||"latest"),"object"==typeof r&&Object.keys(r).length>0&&d.searchParams.set("config","sdk");let p=t.params;"object"==typeof p&&Object.keys(p).length>0&&JSON.stringify(p).length<1800&&Object.keys(p).forEach(e=>{d.searchParams.set(e,encodeURIComponent(String(p[e])))});let f=!1,m="Cannot call API methods after calling `destroy()`.",g=await new Promise(e=>{if(!c)return;let t=c.dataset.height||c.style.height;if(t&&!a){let e=isNaN(Number(t))?t:t+"px";c.style.height=e}"false"===c.dataset.defaultStyles||a||(c.style.backgroundColor||="#fff",c.style.border||="1px solid black",c.style.borderRadius||="8px",c.style.boxSizing||="border-box",c.style.padding||="0",c.style.width||="100%",c.style.height||=c.style.height||"300px",c.style.minHeight="200px",c.style.flexGrow="1",c.style.overflow||="hidden",c.style.resize||="vertical");let n="livecodes",s=c.querySelector(`iframe.${n}`),i=s||document.createElement("iframe");i.classList.add(n),i.setAttribute("allow","accelerometer; camera; encrypted-media; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; web-share"),i.setAttribute("allowtransparency","true"),i.setAttribute("allowpaymentrequest","true"),i.setAttribute("allowfullscreen","true"),i.setAttribute("sandbox","allow-same-origin allow-downloads allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-presentation allow-scripts"),i.setAttribute("loading","eager"===o?"eager":"lazy"),a?E(i):(i.style.height="100%",i.style.minHeight="200px",i.style.width="100%",i.style.margin="0",i.style.border="0",i.style.borderRadius=c.style.borderRadius),addEventListener("message",function e(t){t.source===i.contentWindow&&t.origin===u&&t.data?.type==="livecodes-init"&&(removeEventListener("message",e),l=Number(t.data.payload.appVersion.replace(/^v/,"")))}),(!l||l<46)&&addEventListener("message",function e(t){t.source===i.contentWindow&&t.origin===u&&t.data?.type==="livecodes-get-config"&&(removeEventListener("message",e),i.contentWindow?.postMessage({type:"livecodes-config",payload:r},u))}),i.onload=()=>{e(i)},i.src=d.href,s||c.appendChild(i)}),v=new Promise(e=>{addEventListener("message",function t(r){r.source===g.contentWindow&&r.origin===u&&r.data?.type==="livecodes-ready"&&(removeEventListener("message",t),e(),v.settled=!0)})}),b=()=>f?Promise.reject(m):new Promise(async e=>{v.settled&&e(),g.contentWindow?.postMessage({type:"livecodes-load"},u),await v,e()}),y=(e,t)=>new Promise(async(r,n)=>{if(f)return n(m);await b();let o=A();addEventListener("message",function t(s){if(s.source===g.contentWindow&&s.origin===u&&s.data?.type==="livecodes-api-response"&&s.data?.id===o&&s.data.method===e){removeEventListener("message",t);let e=s.data.payload;e?.error?n(e.error):r(e)}}),g.contentWindow?.postMessage({method:e,id:o,args:t},u)}),w={},x=["load","ready","code","console","tests","destroy"],j=(e,t)=>{if(f)throw Error(m);return x.includes(e)?(y("watch",[e]),w[e]||(w[e]=[]),w[e]?.push(t),{remove:()=>{w[e]=w[e]?.filter(e=>e!==t),w[e]?.length===0&&y("watch",[e,"unsubscribe"])}}):{remove:()=>void 0}},k=e=>({"livecodes-app-loaded":"load","livecodes-ready":"ready","livecodes-change":"code","livecodes-console":"console","livecodes-test-results":"tests","livecodes-destroy":"destroy"})[e];addEventListener("message",async e=>{let t=k(e.data?.type??"");if(e.source!==g.contentWindow||e.origin!==u||!t||!w[t])return;let r=e.data?.payload;w[t]?.forEach(e=>{e(r)})});let C=()=>{Object.values(w).forEach(e=>{e.length=0}),g?.remove?.(),f=!0};function E(e){e.style.position="absolute",e.style.top="0",e.style.visibility="hidden",e.style.opacity="0"}"lazy"===o&&"IntersectionObserver"in window&&new IntersectionObserver((e,t)=>{e.forEach(async e=>{e.isIntersecting&&(await b(),t.unobserve(c))})},{rootMargin:"150px"}).observe(c);let A=()=>(String(Math.random())+Date.now().toFixed()).replace("0.","");return{load:()=>b(),run:()=>y("run"),format:e=>y("format",[e]),getShareUrl:e=>y("getShareUrl",[e]),getConfig:e=>y("getConfig",[e]),setConfig:e=>y("setConfig",[e]),getCode:()=>y("getCode"),show:(e,t)=>y("show",[e,t]),runTests:()=>y("runTests"),onChange:e=>j("code",e),watch:j,exec:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return y("exec",[e,...r])},destroy:()=>v.settled?y("destroy").then(C):f?Promise.reject(m):(C(),Promise.resolve())}}function s(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{appUrl:r="https://livecodes.io",params:o={},config:s={},headless:i,import:a,lite:c,view:l,...d}=t;try{e=new URL(r)}catch{throw Error(`${r} is not a valid URL.`)}let u=new URLSearchParams;Object.entries(d).forEach(t=>{let[r,n]=t;void 0!==n&&e.searchParams.set(r,String(n))});let h="headless"===t.view||i;if(c&&(console.warn('Deprecation notice: "lite" option is deprecated. Use "config: { mode: \'lite\' }" instead.'),"object"==typeof s&&null==s.mode?s.mode="lite":e.searchParams.set("lite","true")),l&&(console.warn('Deprecation notice: The "view" option has been moved to "config.view". For headless mode use "headless: true".'),"object"==typeof s&&null==s.view&&"headless"!==l?s.view=l:e.searchParams.set("view",l)),"string"==typeof s)try{new URL(s),e.searchParams.set("config",encodeURIComponent(s))}catch{throw Error('"config" is not a valid URL or configuration object.')}else s&&"object"==typeof s&&Object.keys(s).length>0&&(s.title&&"Untitled Project"!==s.title&&e.searchParams.set("title",s.title),s.description&&s.description.length>0&&e.searchParams.set("description",s.description),u.set("config","code/"+(0,n.compressToEncodedURIComponent)(JSON.stringify(s))));if(o&&"object"==typeof o&&Object.keys(o).length>0)try{u.set("params",(0,n.compressToEncodedURIComponent)(JSON.stringify(o)))}catch{Object.keys(o).forEach(t=>{e.searchParams.set(t,encodeURIComponent(String(o[t])))})}return a&&e.searchParams.set("x",encodeURIComponent(a)),h&&e.searchParams.set("headless","true"),e.hash=u.toString(),e.href}},65:function(e,t,r){"use strict";r.d(t,{Z:function(){return a},a:function(){return i}});var n=r(7294);let o={},s=n.createContext(o);function i(e){let t=n.useContext(s);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(s.Provider,{value:t},e.children)}}}]); |