1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2025-08-07 12:25:55 +00:00

Deploying to gh-pages from @ sehugg/8bitworkshop@4164ec1fcb 🚀

This commit is contained in:
sehugg
2022-09-14 04:33:52 +00:00
parent 661d401402
commit 12d60bf12e
28 changed files with 184 additions and 134 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

48
gen/chunk-OKP7Z2EH.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
gen/chunk-PP6TWFIY.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
import{a as d}from"./chunk-3XE5YOCV.js";import{o as c}from"./chunk-34JNOOCW.js";import"./chunk-YT7MMFDW.js";import"./chunk-5SHCNQ2O.js";import"./chunk-5VRRMT5K.js";import{I as m,o as u,t as h}from"./chunk-LNEKYU4R.js";import{$ as i,B as o,J as l,m as n}from"./chunk-ATS7PSQG.js";import"./chunk-5XVCUSSZ.js";var s=31,a=class extends u{constructor(){super();this.cpuFrequency=1e6;this.defaultROMSize=32768;this.cpu=new h;this.ram=new Uint8Array(16384);this.read=i([[0,16383,16383,e=>this.ram[e]],[16384,16384,65535,e=>this.serial.byteAvailable()?128:0],[16385,16385,65535,e=>this.serial.recvByte()],[16386,16386,65535,e=>this.serial.clearToSend()?128:0],[32768,65535,32767,e=>this.rom&&this.rom[e]]]);this.write=i([[0,16383,16383,(e,t)=>{this.ram[e]=t}],[16387,16387,65535,(e,t)=>this.serial.sendByte(t)],[16399,16399,65535,(e,t)=>{this.inputs[s]=1}]]);this.connectCPUMemoryBus(this)}connectSerialIO(e){this.serial=e}readConst(e){return this.read(e)}advanceFrame(e){for(var t=0;t<this.cpuFrequency/60&&!(e&&e());)t+=this.advanceCPU();return t}advanceCPU(){if(this.isHalted())return 1;var e=super.advanceCPU();return this.serial&&this.serial.advance(e),e}reset(){this.inputs[s]=0,super.reset(),this.serial&&this.serial.reset()}isHalted(){return this.inputs[s]!=0}};var S=[{id:"hello.dasm",name:"Hello World (ASM)"}],f=class{constructor(e){e.style.overflowY="auto";var t=$('<div id="gameport"/>').appendTo(e);$('<p class="transcript-header">Serial Output</p>').appendTo(t);var y=$('<div id="windowport" class="transcript"/>').appendTo(t);this.div=y[0]}start(){this.tty=new d(this.div,!1)}reset(){this.tty.clear()}saveState(){return this.tty.saveState()}loadState(e){this.tty.loadState(e)}};function p(r){return r==10?"":r<32?String.fromCharCode(r+9216):String.fromCharCode(r)}var v=class{constructor(){this.bufferedRead=!0;this.cyclesPerByte=1e6/(57600/8);this.maxOutputBytes=4096}clearToSend(){return this.outputBytes.length<this.maxOutputBytes}sendByte(e){this.clearToSend()&&(this.outputBytes.push(e),this.viewer.tty.addtext(p(e),2|32),e==10&&this.viewer.tty.newline(),this.clearToSend()||(this.viewer.tty.newline(),this.viewer.tty.addtext("\u26A0\uFE0F OUTPUT BUFFER FULL \u26A0\uFE0F",4)))}byteAvailable(){return this.readIndex()>this.inputIndex}recvByte(){var e=this.readIndex();this.inputIndex=e;var t=(this.inputBytes&&this.inputBytes[e])|0;return this.viewer.tty.addtext(p(t),2|16),t==10&&this.viewer.tty.newline(),t}readIndex(){return this.bufferedRead?this.inputIndex+1:Math.floor(this.clk/this.cyclesPerByte)}reset(){this.inputIndex=-1,this.clk=0,this.outputBytes=[],this.bufin=""}advance(e){this.clk+=e}saveState(){return{clk:this.clk,idx:this.inputIndex,out:this.outputBytes.slice()}}loadState(e){this.clk=e.clk,this.inputIndex=e.idx,this.outputBytes=e.out.slice()}},x=class extends m{constructor(e){super(e);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:16384,type:"ram"},{name:"ROM",start:32768,size:32768,type:"rom"}]}};this.serview=new f(e)}async start(){super.start(),this.serial=new v,this.serial.viewer=this.serview,this.serview.start(),this.machine.connectSerialIO(this.serial)}reset(){this.serial.inputBytes=o(this.internalFiles["serialin.dat"]),super.reset(),this.serview.reset()}isBlocked(){return this.machine.isHalted()}advance(e){return this.isBlocked()?(this.internalFiles["serialout.dat"]=n(this.serial.outputBytes),c(),0):super.advance(e)}saveState(){var e=super.saveState();return e.serial=this.serial.saveState(),e.serview=this.serview.saveState(),e}loadState(e){super.loadState(e),this.serial.loadState(e.serial),this.serview.loadState(e.serview)}newMachine(){return new a}getPresets(){return S}getDefaultExtension(){return".dasm"}readAddress(e){return this.machine.readConst(e)}};l["devel-6502"]=x;export{v as SerialTestHarness}; import{a as d}from"./chunk-3XE5YOCV.js";import{o as c}from"./chunk-OKP7Z2EH.js";import"./chunk-PP6TWFIY.js";import"./chunk-5SHCNQ2O.js";import"./chunk-GDTJNLTK.js";import{I as m,o as u,t as h}from"./chunk-LNEKYU4R.js";import{$ as i,B as o,J as l,m as n}from"./chunk-ATS7PSQG.js";import"./chunk-5XVCUSSZ.js";var s=31,a=class extends u{constructor(){super();this.cpuFrequency=1e6;this.defaultROMSize=32768;this.cpu=new h;this.ram=new Uint8Array(16384);this.read=i([[0,16383,16383,e=>this.ram[e]],[16384,16384,65535,e=>this.serial.byteAvailable()?128:0],[16385,16385,65535,e=>this.serial.recvByte()],[16386,16386,65535,e=>this.serial.clearToSend()?128:0],[32768,65535,32767,e=>this.rom&&this.rom[e]]]);this.write=i([[0,16383,16383,(e,t)=>{this.ram[e]=t}],[16387,16387,65535,(e,t)=>this.serial.sendByte(t)],[16399,16399,65535,(e,t)=>{this.inputs[s]=1}]]);this.connectCPUMemoryBus(this)}connectSerialIO(e){this.serial=e}readConst(e){return this.read(e)}advanceFrame(e){for(var t=0;t<this.cpuFrequency/60&&!(e&&e());)t+=this.advanceCPU();return t}advanceCPU(){if(this.isHalted())return 1;var e=super.advanceCPU();return this.serial&&this.serial.advance(e),e}reset(){this.inputs[s]=0,super.reset(),this.serial&&this.serial.reset()}isHalted(){return this.inputs[s]!=0}};var S=[{id:"hello.dasm",name:"Hello World (ASM)"}],f=class{constructor(e){e.style.overflowY="auto";var t=$('<div id="gameport"/>').appendTo(e);$('<p class="transcript-header">Serial Output</p>').appendTo(t);var y=$('<div id="windowport" class="transcript"/>').appendTo(t);this.div=y[0]}start(){this.tty=new d(this.div,!1)}reset(){this.tty.clear()}saveState(){return this.tty.saveState()}loadState(e){this.tty.loadState(e)}};function p(r){return r==10?"":r<32?String.fromCharCode(r+9216):String.fromCharCode(r)}var v=class{constructor(){this.bufferedRead=!0;this.cyclesPerByte=1e6/(57600/8);this.maxOutputBytes=4096}clearToSend(){return this.outputBytes.length<this.maxOutputBytes}sendByte(e){this.clearToSend()&&(this.outputBytes.push(e),this.viewer.tty.addtext(p(e),2|32),e==10&&this.viewer.tty.newline(),this.clearToSend()||(this.viewer.tty.newline(),this.viewer.tty.addtext("\u26A0\uFE0F OUTPUT BUFFER FULL \u26A0\uFE0F",4)))}byteAvailable(){return this.readIndex()>this.inputIndex}recvByte(){var e=this.readIndex();this.inputIndex=e;var t=(this.inputBytes&&this.inputBytes[e])|0;return this.viewer.tty.addtext(p(t),2|16),t==10&&this.viewer.tty.newline(),t}readIndex(){return this.bufferedRead?this.inputIndex+1:Math.floor(this.clk/this.cyclesPerByte)}reset(){this.inputIndex=-1,this.clk=0,this.outputBytes=[],this.bufin=""}advance(e){this.clk+=e}saveState(){return{clk:this.clk,idx:this.inputIndex,out:this.outputBytes.slice()}}loadState(e){this.clk=e.clk,this.inputIndex=e.idx,this.outputBytes=e.out.slice()}},x=class extends m{constructor(e){super(e);this.getMemoryMap=function(){return{main:[{name:"RAM",start:0,size:16384,type:"ram"},{name:"ROM",start:32768,size:32768,type:"rom"}]}};this.serview=new f(e)}async start(){super.start(),this.serial=new v,this.serial.viewer=this.serview,this.serview.start(),this.machine.connectSerialIO(this.serial)}reset(){this.serial.inputBytes=o(this.internalFiles["serialin.dat"]),super.reset(),this.serview.reset()}isBlocked(){return this.machine.isHalted()}advance(e){return this.isBlocked()?(this.internalFiles["serialout.dat"]=n(this.serial.outputBytes),c(),0):super.advance(e)}saveState(){var e=super.saveState();return e.serial=this.serial.saveState(),e.serview=this.serview.saveState(),e}loadState(e){super.loadState(e),this.serial.loadState(e.serial),this.serview.loadState(e.serview)}newMachine(){return new a}getPresets(){return S}getDefaultExtension(){return".dasm"}readAddress(e){return this.machine.readConst(e)}};l["devel-6502"]=x;export{v as SerialTestHarness};
//# sourceMappingURL=devel-JCN3YLKQ.js.map //# sourceMappingURL=devel-SH32XAGC.js.map

View File

@@ -1,2 +1,2 @@
import{b as w,c as x}from"./chunk-5VRRMT5K.js";import{D as v,J as c,k as m,l as u,x as g,z as p}from"./chunk-ATS7PSQG.js";import{e as I}from"./chunk-5XVCUSSZ.js";var h=I(x()),i,a,l,y=function(e){if(!e||e.length==0)return{};for(var r={},t=0;t<e.length;++t){var o=e[t].split("=",2);o.length==1?r[o[0]]="":r[o[0]]=decodeURIComponent(o[1].replace(/\+/g," "))}return r}(window.location.search.substr(1).split("&"));function P(){typeof window.onerror=="object"&&(window.onerror=function(e,r,t,o,n){var s=e+" "+r+" "+t+":"+o+", "+n;$.get("/error?msg="+encodeURIComponent(s),"text")})}function M(){var e=!1;document.addEventListener("visibilitychange",function(r){document.visibilityState=="hidden"&&a.isRunning()?(a.pause(),e=!0):document.visibilityState=="visible"&&e&&(a.resume(),e=!1)}),$(window).on("focus",function(){e&&(a.resume(),e=!1)}),$(window).on("blur",function(){a.isRunning()&&(a.pause(),e=!0)})}async function k(e,r){if(!r){alert("No ROM found.");return}console.log(r.length+" bytes"),await a.loadROM(e,r),a.resume()}function R(){return $("#emulator").find("canvas")}function E(e,r,t){v("gif.js/dist/gif.js").then(()=>{var o=R()[0];if(!o){alert("Could not find canvas element to record video!");return}var n=0;o.style&&o.style.transform&&(o.style.transform.indexOf("rotate(-90deg)")>=0?n=-1:o.style.transform.indexOf("rotate(90deg)")>=0&&(n=1));var s=new GIF({workerScript:"gif.js/dist/gif.worker.js",workers:4,quality:10,rotate:n});s.on("finished",function(C){console.log("finished encoding GIF"),t(C)}),e=e||100+(Math.random()*256&3),r=r||100+(Math.random()*256&15);var f=0;console.log("Recording video",o);var d=()=>{f++>r?(console.log("Rendering video"),s.render()):(s.addFrame(o,{delay:e,copy:!0}),setTimeout(d,e))};d()})}async function S(e){if(!c[i])throw Error("Invalid platform '"+i+"'.");a=new c[i]($("#emuscreen")[0]),await a.start(),e.rec&&R().on("focus",()=>{a.resume()});var r=e.n||"Game",t,o=e.url,n=e.r;if(o)return console.log(o),g(o,f=>{k(r,f)},"arraybuffer"),!0;if(n){var s=u(atob(n));t=new m().decode(s)}return M(),k(r,t),!0}async function b(e){if(e.data&&(e=e.data),i=e.p,!i)throw new Error("No platform variable!");try{var r=await w(p(i));console.log("starting platform",i),await S(e)}catch(t){console.log(t),alert('Platform "'+i+'" not supported.')}}function F(){P(),y.p&&b(y)}window.addEventListener("message",O,!1);function O(e){if(e.data){var r=e.data.cmd;if(r=="start"&&!a)b(e);else if(r=="reset")a.reset(),l.reset();else if(r=="getReplay"){var t={frameCount:l.frameCount,checkpoints:l.checkpoints,framerecs:l.framerecs,checkpointInterval:l.checkpointInterval,maxCheckpoints:l.maxCheckpoints};e.source.postMessage({ack:r,replay:t},e.origin)}else if(r=="watchState"){var o=new Function("platform","state",e.data.fn);l.callbackNewCheckpoint=n=>{e.source.postMessage({ack:r,state:o(a,n)},e.origin)}}else r=="recordVideo"?E(e.data.intervalMsec,e.data.maxFrames,function(n){e.data.filename&&(0,h.saveAs)(n,e.data.filename),e.source.postMessage({ack:r,gif:n},e.origin)}):console.log("Unknown data.cmd: "+r)}}self===top&&(document.body.style.backgroundColor="#555");F();export{a as platform,i as platform_id,F as startEmbed,l as stateRecorder}; import{b as w,c as x}from"./chunk-GDTJNLTK.js";import{D as v,J as c,k as m,l as u,x as g,z as p}from"./chunk-ATS7PSQG.js";import{e as I}from"./chunk-5XVCUSSZ.js";var h=I(x()),i,a,l,y=function(e){if(!e||e.length==0)return{};for(var r={},t=0;t<e.length;++t){var o=e[t].split("=",2);o.length==1?r[o[0]]="":r[o[0]]=decodeURIComponent(o[1].replace(/\+/g," "))}return r}(window.location.search.substr(1).split("&"));function P(){typeof window.onerror=="object"&&(window.onerror=function(e,r,t,o,n){var s=e+" "+r+" "+t+":"+o+", "+n;$.get("/error?msg="+encodeURIComponent(s),"text")})}function M(){var e=!1;document.addEventListener("visibilitychange",function(r){document.visibilityState=="hidden"&&a.isRunning()?(a.pause(),e=!0):document.visibilityState=="visible"&&e&&(a.resume(),e=!1)}),$(window).on("focus",function(){e&&(a.resume(),e=!1)}),$(window).on("blur",function(){a.isRunning()&&(a.pause(),e=!0)})}async function k(e,r){if(!r){alert("No ROM found.");return}console.log(r.length+" bytes"),await a.loadROM(e,r),a.resume()}function R(){return $("#emulator").find("canvas")}function E(e,r,t){v("gif.js/dist/gif.js").then(()=>{var o=R()[0];if(!o){alert("Could not find canvas element to record video!");return}var n=0;o.style&&o.style.transform&&(o.style.transform.indexOf("rotate(-90deg)")>=0?n=-1:o.style.transform.indexOf("rotate(90deg)")>=0&&(n=1));var s=new GIF({workerScript:"gif.js/dist/gif.worker.js",workers:4,quality:10,rotate:n});s.on("finished",function(C){console.log("finished encoding GIF"),t(C)}),e=e||100+(Math.random()*256&3),r=r||100+(Math.random()*256&15);var f=0;console.log("Recording video",o);var d=()=>{f++>r?(console.log("Rendering video"),s.render()):(s.addFrame(o,{delay:e,copy:!0}),setTimeout(d,e))};d()})}async function S(e){if(!c[i])throw Error("Invalid platform '"+i+"'.");a=new c[i]($("#emuscreen")[0]),await a.start(),e.rec&&R().on("focus",()=>{a.resume()});var r=e.n||"Game",t,o=e.url,n=e.r;if(o)return console.log(o),g(o,f=>{k(r,f)},"arraybuffer"),!0;if(n){var s=u(atob(n));t=new m().decode(s)}return M(),k(r,t),!0}async function b(e){if(e.data&&(e=e.data),i=e.p,!i)throw new Error("No platform variable!");try{var r=await w(p(i));console.log("starting platform",i),await S(e)}catch(t){console.log(t),alert('Platform "'+i+'" not supported.')}}function F(){P(),y.p&&b(y)}window.addEventListener("message",O,!1);function O(e){if(e.data){var r=e.data.cmd;if(r=="start"&&!a)b(e);else if(r=="reset")a.reset(),l.reset();else if(r=="getReplay"){var t={frameCount:l.frameCount,checkpoints:l.checkpoints,framerecs:l.framerecs,checkpointInterval:l.checkpointInterval,maxCheckpoints:l.maxCheckpoints};e.source.postMessage({ack:r,replay:t},e.origin)}else if(r=="watchState"){var o=new Function("platform","state",e.data.fn);l.callbackNewCheckpoint=n=>{e.source.postMessage({ack:r,state:o(a,n)},e.origin)}}else r=="recordVideo"?E(e.data.intervalMsec,e.data.maxFrames,function(n){e.data.filename&&(0,h.saveAs)(n,e.data.filename),e.source.postMessage({ack:r,gif:n},e.origin)}):console.log("Unknown data.cmd: "+r)}}self===top&&(document.body.style.backgroundColor="#555");F();export{a as platform,i as platform_id,F as startEmbed,l as stateRecorder};
//# sourceMappingURL=embedui.js.map //# sourceMappingURL=embedui.js.map

View File

@@ -38,6 +38,7 @@ const asseteditor_1 = require("./views/asseteditor");
const baseviews_1 = require("./views/baseviews"); const baseviews_1 = require("./views/baseviews");
const treeviews_1 = require("./views/treeviews"); const treeviews_1 = require("./views/treeviews");
const file_saver_1 = require("file-saver"); const file_saver_1 = require("file-saver");
const DOMPurify = require("dompurify");
exports.qs = (0, util_1.decodeQueryString)(window.location.search || '?'); exports.qs = (0, util_1.decodeQueryString)(window.location.search || '?');
const isElectron = (0, util_1.parseBool)(exports.qs.electron); const isElectron = (0, util_1.parseBool)(exports.qs.electron);
const isEmbed = (0, util_1.parseBool)(exports.qs.embed); const isEmbed = (0, util_1.parseBool)(exports.qs.embed);
@@ -104,12 +105,12 @@ function alertError(s) {
setWaitDialog(false); setWaitDialog(false);
bootbox.alert({ bootbox.alert({
title: '<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert', title: '<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert',
message: s message: DOMPurify.sanitize(s)
}); });
} }
function alertInfo(s) { function alertInfo(s) {
setWaitDialog(false); setWaitDialog(false);
bootbox.alert(s); bootbox.alert(DOMPurify.sanitize(s));
} }
function fatalError(s) { function fatalError(s) {
alertError(s); alertError(s);
@@ -469,7 +470,7 @@ function handleFileUpload(files) {
else { else {
exports.qs.file = files[0].name; exports.qs.file = files[0].name;
bootbox.confirm({ bootbox.confirm({
message: "Open '" + exports.qs.file + "' as main project file?", message: "Open '" + DOMPurify.sanitize(exports.qs.file) + "' as main project file?",
buttons: { buttons: {
confirm: { label: "Open As New Project" }, confirm: { label: "Open As New Project" },
cancel: { label: "Include/Link With Project Later" }, cancel: { label: "Include/Link With Project Later" },
@@ -511,7 +512,7 @@ function handleFileUpload(files) {
async function _openLocalDirectory(e) { async function _openLocalDirectory(e) {
var pickerfn = window['showDirectoryPicker']; var pickerfn = window['showDirectoryPicker'];
if (!pickerfn) { if (!pickerfn) {
bootbox.alert(`This browser can't open local files on your computer, yet. Try Chrome.`); alertError(`This browser can't open local files on your computer, yet. Try Chrome.`);
} }
var dirHandle = await pickerfn(); var dirHandle = await pickerfn();
var repoid = dirHandle.name; var repoid = dirHandle.name;
@@ -529,7 +530,7 @@ async function _openLocalDirectory(e) {
} }
async function promptUser(message) { async function promptUser(message) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
bootbox.prompt(message, (result) => { bootbox.prompt(DOMPurify.sanitize(message), (result) => {
resolve(result); resolve(result);
}); });
}); });
@@ -551,7 +552,7 @@ async function getLocalFilesystem(repoid) {
granted = await dirHandle.requestPermission(options); granted = await dirHandle.requestPermission(options);
} }
if (granted !== 'granted') { if (granted !== 'granted') {
bootbox.alert(`Could not get permission to access filesystem.`); alertError(`Could not get permission to access filesystem.`);
return; return;
} }
return { return {
@@ -609,7 +610,7 @@ async function getGithubService() {
function getBoundGithubURL() { function getBoundGithubURL() {
var toks = (exports.repo_id || '').split('/'); var toks = (exports.repo_id || '').split('/');
if (toks.length != 2) { if (toks.length != 2) {
alertError("<p>You are not in a GitHub repository.</p><p>Choose one from the pulldown, or Import or Publish one.</p>"); alertError("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one.");
return null; return null;
} }
return 'https://github.com/' + toks[0] + '/' + toks[1]; return 'https://github.com/' + toks[0] + '/' + toks[1];
@@ -646,7 +647,7 @@ async function importProjectFromGithub(githuburl, replaceURL) {
}).catch((e) => { }).catch((e) => {
setWaitDialog(false); setWaitDialog(false);
console.log(e); console.log(e);
alertError("<p>Could not import " + githuburl + ".</p>" + e); alertError("Could not import " + githuburl + "." + e);
}); });
} }
async function _loginToGithub(e) { async function _loginToGithub(e) {
@@ -654,7 +655,7 @@ async function _loginToGithub(e) {
gh.login().then(() => { gh.login().then(() => {
alertInfo("You are signed in to Github."); alertInfo("You are signed in to Github.");
}).catch((e) => { }).catch((e) => {
alertError("<p>Could not sign in.</p>" + e); alertError("Could not sign in." + e);
}); });
} }
async function _logoutOfGithub(e) { async function _logoutOfGithub(e) {
@@ -748,13 +749,13 @@ function confirmCommit(sess) {
// anything changed? // anything changed?
if (files.length == 0) { if (files.length == 0) {
setWaitDialog(false); setWaitDialog(false);
bootbox.alert("No files changed."); alertInfo("No files changed.");
return; return;
} }
// build commit confirm message // build commit confirm message
var msg = ""; var msg = "";
for (var f of files) { for (var f of files) {
msg += f.filename + ": " + f.status; msg += DOMPurify.sanitize(f.filename) + ": " + f.status;
if (f.additions || f.deletions || f.changes) { if (f.additions || f.deletions || f.changes) {
msg += " (" + f.additions + " additions, " + f.deletions + " deletions, " + f.changes + " changes)"; msg += " (" + f.additions + " additions, " + f.deletions + " deletions, " + f.changes + " changes)";
} }
@@ -814,7 +815,7 @@ function _deleteRepository() {
var ghurl = getBoundGithubURL(); var ghurl = getBoundGithubURL();
if (!ghurl) if (!ghurl)
return; return;
bootbox.prompt("<p>Are you sure you want to delete this repository (" + ghurl + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>", (yes) => { bootbox.prompt("<p>Are you sure you want to delete this repository (" + DOMPurify.sanitize(ghurl) + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>", (yes) => {
if (yes.trim().toUpperCase() == "DELETE") { if (yes.trim().toUpperCase() == "DELETE") {
deleteRepository(); deleteRepository();
} }
@@ -914,7 +915,7 @@ function _downloadCassetteFile_apple2(e) {
var blob = new Blob([audout], { type: "audio/wav" }); var blob = new Blob([audout], { type: "audio/wav" });
(0, file_saver_1.saveAs)(blob, audpath); (0, file_saver_1.saveAs)(blob, audpath);
stdout += "Then connect your audio output to the cassette input, turn up the volume, and play the audio file."; stdout += "Then connect your audio output to the cassette input, turn up the volume, and play the audio file.";
alertInfo('<pre style="white-space: pre-wrap">' + stdout + '</pre>'); alertInfo(stdout);
} }
}); });
} }
@@ -945,7 +946,7 @@ function _downloadCassetteFile_vcs(e) {
let blob = new Blob([audout], { type: "audio/wav" }); let blob = new Blob([audout], { type: "audio/wav" });
(0, file_saver_1.saveAs)(blob, audpath); (0, file_saver_1.saveAs)(blob, audpath);
stdout += "\nConnect your audio output to the SuperCharger input, turn up the volume, and play the audio file."; stdout += "\nConnect your audio output to the SuperCharger input, turn up the volume, and play the audio file.";
alertInfo('<pre style="white-space: pre-wrap">' + stdout + '</pre>'); alertInfo(stdout);
} }
}); });
}); });
@@ -975,7 +976,7 @@ function _revertFile(e) {
if (wnd && wnd.setText) { if (wnd && wnd.setText) {
var fn = exports.projectWindows.getActiveID(); var fn = exports.projectWindows.getActiveID();
$.get("presets/" + (0, util_1.getBasePlatform)(exports.platform_id) + "/" + fn, (text) => { $.get("presets/" + (0, util_1.getBasePlatform)(exports.platform_id) + "/" + fn, (text) => {
bootbox.confirm("Reset '" + fn + "' to default?", (ok) => { bootbox.confirm("Reset '" + DOMPurify.sanitize(fn) + "' to default?", (ok) => {
if (ok) { if (ok) {
wnd.setText(text); wnd.setText(text);
} }
@@ -996,7 +997,7 @@ function _deleteFile(e) {
var wnd = exports.projectWindows.getActive(); var wnd = exports.projectWindows.getActive();
if (wnd && wnd.getPath) { if (wnd && wnd.getPath) {
var fn = exports.projectWindows.getActiveID(); var fn = exports.projectWindows.getActiveID();
bootbox.confirm("Delete '" + fn + "'?", (ok) => { bootbox.confirm("Delete '" + DOMPurify.sanitize(fn) + "'?", (ok) => {
if (ok) { if (ok) {
store.removeItem(fn).then(() => { store.removeItem(fn).then(() => {
// if we delete what is selected // if we delete what is selected
@@ -1021,7 +1022,7 @@ function _renameFile(e) {
if (wnd && wnd.getPath && exports.current_project.getFile(wnd.getPath())) { if (wnd && wnd.getPath && exports.current_project.getFile(wnd.getPath())) {
var fn = exports.projectWindows.getActiveID(); var fn = exports.projectWindows.getActiveID();
bootbox.prompt({ bootbox.prompt({
title: "Rename '" + fn + "' to?", title: "Rename '" + DOMPurify.sanitize(fn) + "' to?",
value: fn, value: fn,
callback: (newfn) => { callback: (newfn) => {
var data = exports.current_project.getFile(wnd.getPath()); var data = exports.current_project.getFile(wnd.getPath());
@@ -1760,8 +1761,8 @@ function addFileToProject(type, ext, linefn) {
var wnd = exports.projectWindows.getActive(); var wnd = exports.projectWindows.getActive();
if (wnd && wnd.insertText) { if (wnd && wnd.insertText) {
bootbox.prompt({ bootbox.prompt({
title: "Add " + type + " File to Project", title: "Add " + DOMPurify.sanitize(type) + " File to Project",
value: "filename" + ext, value: "filename" + DOMPurify.sanitize(ext),
callback: (filename) => { callback: (filename) => {
if (filename && filename.trim().length > 0) { if (filename && filename.trim().length > 0) {
if (!checkEnteredFilename(filename)) if (!checkEnteredFilename(filename))

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,12 @@
"use strict"; "use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.WaveformView = void 0; exports.WaveformView = void 0;
const toolbar_1 = require("./toolbar"); const toolbar_1 = require("./toolbar");
const vlist_1 = require("../common/vlist"); const vlist_1 = require("../common/vlist");
const dompurify_1 = __importDefault(require("dompurify"));
const BUILTIN_INPUT_PORTS = [ const BUILTIN_INPUT_PORTS = [
'clk', 'reset', 'clk', 'reset',
]; ];
@@ -329,7 +333,7 @@ class WaveformView {
//min: 0, //min: 0,
//max: meta.len-1, //max: meta.len-1,
//placeholder: rangestr, //placeholder: rangestr,
title: `Enter new value for "${meta.label}" (${rangestr}):`, title: `Enter new value for "${dompurify_1.default.sanitize(meta.label)}" (${rangestr}):`,
callback: (result) => { callback: (result) => {
if (result != null) { if (result != null) {
var value = parseInt(result); var value = parseInt(result);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u,w as v,x as w}from"./chunk-34JNOOCW.js";import"./chunk-YT7MMFDW.js";import"./chunk-5SHCNQ2O.js";import"./chunk-5VRRMT5K.js";import"./chunk-LNEKYU4R.js";import"./chunk-ATS7PSQG.js";import"./chunk-5XVCUSSZ.js";export{l as clearBreakpoint,h as compparams,f as current_project,u as emulationHalted,p as getPlatformAndRepo,t as getSaveState,s as getTestOutput,n as haltEmulation,w as highlightSearch,i as lastDebugState,e as platform,b as platform_id,g as projectWindows,a as qs,v as reloadWorkspaceFile,d as repo_id,k as runToPC,m as setFrameRateUI,r as setTestInput,j as setupBreakpoint,o as setupSplits,q as startUI,c as store_id}; import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u,w as v,x as w}from"./chunk-OKP7Z2EH.js";import"./chunk-PP6TWFIY.js";import"./chunk-5SHCNQ2O.js";import"./chunk-GDTJNLTK.js";import"./chunk-LNEKYU4R.js";import"./chunk-ATS7PSQG.js";import"./chunk-5XVCUSSZ.js";export{l as clearBreakpoint,h as compparams,f as current_project,u as emulationHalted,p as getPlatformAndRepo,t as getSaveState,s as getTestOutput,n as haltEmulation,w as highlightSearch,i as lastDebugState,e as platform,b as platform_id,g as projectWindows,a as qs,v as reloadWorkspaceFile,d as repo_id,k as runToPC,m as setFrameRateUI,r as setTestInput,j as setupBreakpoint,o as setupSplits,q as startUI,c as store_id};
//# sourceMappingURL=ui.js.map //# sourceMappingURL=ui.js.map

File diff suppressed because one or more lines are too long

18
gen/verilog-YWW6OSFY.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

42
package-lock.json generated
View File

@@ -1,15 +1,16 @@
{ {
"name": "8bitworkshop", "name": "8bitworkshop",
"version": "3.9.1", "version": "3.10.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "8bitworkshop", "name": "8bitworkshop",
"version": "3.9.1", "version": "3.10.0",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@types/chroma-js": "^2.1.3", "@types/chroma-js": "^2.1.3",
"@types/dompurify": "^2.3.4",
"@types/emscripten": "^1.39.5", "@types/emscripten": "^1.39.5",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@wasmer/wasi": "^0.12.0", "@wasmer/wasi": "^0.12.0",
@@ -17,6 +18,7 @@
"binaryen": "^101.0.0", "binaryen": "^101.0.0",
"chroma-js": "^2.1.2", "chroma-js": "^2.1.2",
"clipboard": "^2.0.6", "clipboard": "^2.0.6",
"dompurify": "^2.4.0",
"error-stack-parser": "^2.0.6", "error-stack-parser": "^2.0.6",
"fast-png": "^5.0.4", "fast-png": "^5.0.4",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
@@ -445,6 +447,14 @@
"resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz",
"integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g=="
}, },
"node_modules/@types/dompurify": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-2.3.4.tgz",
"integrity": "sha512-EXzDatIb5EspL2eb/xPGmaC8pePcTHrkDCONjeisusLFrVfl38Pjea/R0YJGu3k9ZQadSvMqW0WXPI2hEo2Ajg==",
"dependencies": {
"@types/trusted-types": "*"
}
},
"node_modules/@types/emscripten": { "node_modules/@types/emscripten": {
"version": "1.39.6", "version": "1.39.6",
"resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.6.tgz", "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.6.tgz",
@@ -563,6 +573,11 @@
"integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==",
"dev": true "dev": true
}, },
"node_modules/@types/trusted-types": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
"integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"node_modules/@types/yargs": { "node_modules/@types/yargs": {
"version": "16.0.4", "version": "16.0.4",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz",
@@ -1749,6 +1764,11 @@
"webidl-conversions": "^4.0.2" "webidl-conversions": "^4.0.2"
} }
}, },
"node_modules/dompurify": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.4.0.tgz",
"integrity": "sha512-Be9tbQMZds4a3C6xTmz68NlMfeONA//4dOavl/1rNw50E+/QO0KVpbcU0PcaW0nsQxurXls9ZocqFxk8R2mWEA=="
},
"node_modules/dotenv": { "node_modules/dotenv": {
"version": "10.0.0", "version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
@@ -6980,6 +7000,14 @@
"resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/chroma-js/-/chroma-js-2.1.3.tgz",
"integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g==" "integrity": "sha512-1xGPhoSGY1CPmXLCBcjVZSQinFjL26vlR8ZqprsBWiFyED4JacJJ9zHhh5aaUXqbY9B37mKQ73nlydVAXmr1+g=="
}, },
"@types/dompurify": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-2.3.4.tgz",
"integrity": "sha512-EXzDatIb5EspL2eb/xPGmaC8pePcTHrkDCONjeisusLFrVfl38Pjea/R0YJGu3k9ZQadSvMqW0WXPI2hEo2Ajg==",
"requires": {
"@types/trusted-types": "*"
}
},
"@types/emscripten": { "@types/emscripten": {
"version": "1.39.6", "version": "1.39.6",
"resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.6.tgz", "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.6.tgz",
@@ -7097,6 +7125,11 @@
"integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==",
"dev": true "dev": true
}, },
"@types/trusted-types": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz",
"integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg=="
},
"@types/yargs": { "@types/yargs": {
"version": "16.0.4", "version": "16.0.4",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz",
@@ -8017,6 +8050,11 @@
"webidl-conversions": "^4.0.2" "webidl-conversions": "^4.0.2"
} }
}, },
"dompurify": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.4.0.tgz",
"integrity": "sha512-Be9tbQMZds4a3C6xTmz68NlMfeONA//4dOavl/1rNw50E+/QO0KVpbcU0PcaW0nsQxurXls9ZocqFxk8R2mWEA=="
},
"dotenv": { "dotenv": {
"version": "10.0.0", "version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",

View File

@@ -11,6 +11,7 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@types/chroma-js": "^2.1.3", "@types/chroma-js": "^2.1.3",
"@types/dompurify": "^2.3.4",
"@types/emscripten": "^1.39.5", "@types/emscripten": "^1.39.5",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@wasmer/wasi": "^0.12.0", "@wasmer/wasi": "^0.12.0",
@@ -18,6 +19,7 @@
"binaryen": "^101.0.0", "binaryen": "^101.0.0",
"chroma-js": "^2.1.2", "chroma-js": "^2.1.2",
"clipboard": "^2.0.6", "clipboard": "^2.0.6",
"dompurify": "^2.4.0",
"error-stack-parser": "^2.0.6", "error-stack-parser": "^2.0.6",
"fast-png": "^5.0.4", "fast-png": "^5.0.4",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",

View File

@@ -20,6 +20,7 @@ import { AssetEditorView } from "./views/asseteditor";
import { isMobileDevice } from "./views/baseviews"; import { isMobileDevice } from "./views/baseviews";
import { CallStackView, DebugBrowserView } from "./views/treeviews"; import { CallStackView, DebugBrowserView } from "./views/treeviews";
import { saveAs } from "file-saver"; import { saveAs } from "file-saver";
import DOMPurify = require("dompurify");
// external libs (TODO) // external libs (TODO)
declare var Tour, GIF, Octokat; declare var Tour, GIF, Octokat;
@@ -141,12 +142,12 @@ function alertError(s:string) {
setWaitDialog(false); setWaitDialog(false);
bootbox.alert({ bootbox.alert({
title: '<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert', title: '<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert',
message: s message: DOMPurify.sanitize(s)
}); });
} }
function alertInfo(s:string) { function alertInfo(s:string) {
setWaitDialog(false); setWaitDialog(false);
bootbox.alert(s); bootbox.alert(DOMPurify.sanitize(s));
} }
function fatalError(s:string) { function fatalError(s:string) {
alertError(s); alertError(s);
@@ -518,7 +519,7 @@ function handleFileUpload(files: FileList) {
} else { } else {
qs.file = files[0].name; qs.file = files[0].name;
bootbox.confirm({ bootbox.confirm({
message: "Open '" + qs.file + "' as main project file?", message: "Open '" + DOMPurify.sanitize(qs.file) + "' as main project file?",
buttons: { buttons: {
confirm: { label: "Open As New Project" }, confirm: { label: "Open As New Project" },
cancel: { label: "Include/Link With Project Later" }, cancel: { label: "Include/Link With Project Later" },
@@ -558,7 +559,7 @@ function handleFileUpload(files: FileList) {
async function _openLocalDirectory(e) { async function _openLocalDirectory(e) {
var pickerfn = window['showDirectoryPicker']; var pickerfn = window['showDirectoryPicker'];
if (!pickerfn) { if (!pickerfn) {
bootbox.alert(`This browser can't open local files on your computer, yet. Try Chrome.`); alertError(`This browser can't open local files on your computer, yet. Try Chrome.`);
} }
var dirHandle = await pickerfn(); var dirHandle = await pickerfn();
var repoid = dirHandle.name; var repoid = dirHandle.name;
@@ -577,7 +578,7 @@ async function _openLocalDirectory(e) {
async function promptUser(message: string) : Promise<string> { async function promptUser(message: string) : Promise<string> {
return new Promise( (resolve, reject) => { return new Promise( (resolve, reject) => {
bootbox.prompt(message, (result) => { bootbox.prompt(DOMPurify.sanitize(message), (result) => {
resolve(result); resolve(result);
}); });
}); });
@@ -600,7 +601,7 @@ async function getLocalFilesystem(repoid: string) : Promise<ProjectFilesystem> {
granted = await dirHandle.requestPermission(options); granted = await dirHandle.requestPermission(options);
} }
if (granted !== 'granted') { if (granted !== 'granted') {
bootbox.alert(`Could not get permission to access filesystem.`); alertError(`Could not get permission to access filesystem.`);
return; return;
} }
return { return {
@@ -663,7 +664,7 @@ async function getGithubService() {
function getBoundGithubURL() : string { function getBoundGithubURL() : string {
var toks = (repo_id||'').split('/'); var toks = (repo_id||'').split('/');
if (toks.length != 2) { if (toks.length != 2) {
alertError("<p>You are not in a GitHub repository.</p><p>Choose one from the pulldown, or Import or Publish one.</p>"); alertError("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one.");
return null; return null;
} }
return 'https://github.com/' + toks[0] + '/' + toks[1]; return 'https://github.com/' + toks[0] + '/' + toks[1];
@@ -701,7 +702,7 @@ async function importProjectFromGithub(githuburl:string, replaceURL:boolean) {
}).catch( (e) => { }).catch( (e) => {
setWaitDialog(false); setWaitDialog(false);
console.log(e); console.log(e);
alertError("<p>Could not import " + githuburl + ".</p>" + e); alertError("Could not import " + githuburl + "." + e);
}); });
} }
@@ -710,7 +711,7 @@ async function _loginToGithub(e) {
gh.login().then(() => { gh.login().then(() => {
alertInfo("You are signed in to Github."); alertInfo("You are signed in to Github.");
}).catch( (e) => { }).catch( (e) => {
alertError("<p>Could not sign in.</p>" + e); alertError("Could not sign in." + e);
}); });
} }
@@ -809,13 +810,13 @@ function confirmCommit(sess) : Promise<GHSession> {
// anything changed? // anything changed?
if (files.length == 0) { if (files.length == 0) {
setWaitDialog(false); setWaitDialog(false);
bootbox.alert("No files changed."); alertInfo("No files changed.");
return; return;
} }
// build commit confirm message // build commit confirm message
var msg = ""; var msg = "";
for (var f of files) { for (var f of files) {
msg += f.filename + ": " + f.status; msg += DOMPurify.sanitize(f.filename) + ": " + f.status;
if (f.additions || f.deletions || f.changes) { if (f.additions || f.deletions || f.changes) {
msg += " (" + f.additions + " additions, " + f.deletions + " deletions, " + f.changes + " changes)"; msg += " (" + f.additions + " additions, " + f.deletions + " deletions, " + f.changes + " changes)";
}; };
@@ -873,7 +874,7 @@ async function pushChangesToGithub(message:string) {
function _deleteRepository() { function _deleteRepository() {
var ghurl = getBoundGithubURL(); var ghurl = getBoundGithubURL();
if (!ghurl) return; if (!ghurl) return;
bootbox.prompt("<p>Are you sure you want to delete this repository (" + ghurl + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>", (yes) => { bootbox.prompt("<p>Are you sure you want to delete this repository (" + DOMPurify.sanitize(ghurl) + ") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>", (yes) => {
if (yes.trim().toUpperCase() == "DELETE") { if (yes.trim().toUpperCase() == "DELETE") {
deleteRepository(); deleteRepository();
} }
@@ -976,7 +977,7 @@ function _downloadCassetteFile_apple2(e) {
var blob = new Blob([audout], {type: "audio/wav"}); var blob = new Blob([audout], {type: "audio/wav"});
saveAs(blob, audpath); saveAs(blob, audpath);
stdout += "Then connect your audio output to the cassette input, turn up the volume, and play the audio file."; stdout += "Then connect your audio output to the cassette input, turn up the volume, and play the audio file.";
alertInfo('<pre style="white-space: pre-wrap">'+stdout+'</pre>'); alertInfo(stdout);
} }
}); });
} }
@@ -1008,7 +1009,7 @@ function _downloadCassetteFile_vcs(e) {
let blob = new Blob([audout], {type: "audio/wav"}); let blob = new Blob([audout], {type: "audio/wav"});
saveAs(blob, audpath); saveAs(blob, audpath);
stdout += "\nConnect your audio output to the SuperCharger input, turn up the volume, and play the audio file."; stdout += "\nConnect your audio output to the SuperCharger input, turn up the volume, and play the audio file.";
alertInfo('<pre style="white-space: pre-wrap">'+stdout+'</pre>'); alertInfo(stdout);
} }
}); });
}); });
@@ -1037,7 +1038,7 @@ function _revertFile(e) {
if (wnd && wnd.setText) { if (wnd && wnd.setText) {
var fn = projectWindows.getActiveID(); var fn = projectWindows.getActiveID();
$.get( "presets/"+getBasePlatform(platform_id)+"/"+fn, (text) => { $.get( "presets/"+getBasePlatform(platform_id)+"/"+fn, (text) => {
bootbox.confirm("Reset '" + fn + "' to default?", (ok) => { bootbox.confirm("Reset '" + DOMPurify.sanitize(fn) + "' to default?", (ok) => {
if (ok) { if (ok) {
wnd.setText(text); wnd.setText(text);
} }
@@ -1056,7 +1057,7 @@ function _deleteFile(e) {
var wnd = projectWindows.getActive(); var wnd = projectWindows.getActive();
if (wnd && wnd.getPath) { if (wnd && wnd.getPath) {
var fn = projectWindows.getActiveID(); var fn = projectWindows.getActiveID();
bootbox.confirm("Delete '" + fn + "'?", (ok) => { bootbox.confirm("Delete '" + DOMPurify.sanitize(fn) + "'?", (ok) => {
if (ok) { if (ok) {
store.removeItem(fn).then( () => { store.removeItem(fn).then( () => {
// if we delete what is selected // if we delete what is selected
@@ -1080,7 +1081,7 @@ function _renameFile(e) {
if (wnd && wnd.getPath && current_project.getFile(wnd.getPath())) { if (wnd && wnd.getPath && current_project.getFile(wnd.getPath())) {
var fn = projectWindows.getActiveID(); var fn = projectWindows.getActiveID();
bootbox.prompt({ bootbox.prompt({
title: "Rename '" + fn + "' to?", title: "Rename '" + DOMPurify.sanitize(fn) + "' to?",
value: fn, value: fn,
callback: (newfn) => { callback: (newfn) => {
var data = current_project.getFile(wnd.getPath()); var data = current_project.getFile(wnd.getPath());
@@ -1823,8 +1824,8 @@ function addFileToProject(type, ext, linefn) {
var wnd = projectWindows.getActive(); var wnd = projectWindows.getActive();
if (wnd && wnd.insertText) { if (wnd && wnd.insertText) {
bootbox.prompt({ bootbox.prompt({
title:"Add "+type+" File to Project", title:"Add "+DOMPurify.sanitize(type)+" File to Project",
value:"filename"+ext, value:"filename"+DOMPurify.sanitize(ext),
callback:(filename:string) => { callback:(filename:string) => {
if (filename && filename.trim().length > 0) { if (filename && filename.trim().length > 0) {
if (!checkEnteredFilename(filename)) return; if (!checkEnteredFilename(filename)) return;

View File

@@ -1,6 +1,7 @@
import { Toolbar } from "./toolbar"; import { Toolbar } from "./toolbar";
import { VirtualList } from "../common/vlist"; import { VirtualList } from "../common/vlist";
import DOMPurify from "dompurify";
const BUILTIN_INPUT_PORTS = [ const BUILTIN_INPUT_PORTS = [
'clk', 'reset', 'clk', 'reset',
@@ -359,7 +360,7 @@ export class WaveformView {
//min: 0, //min: 0,
//max: meta.len-1, //max: meta.len-1,
//placeholder: rangestr, //placeholder: rangestr,
title: `Enter new value for "${meta.label}" (${rangestr}):`, title: `Enter new value for "${DOMPurify.sanitize(meta.label)}" (${rangestr}):`,
callback: (result) => { callback: (result) => {
if (result != null) { if (result != null) {
var value = parseInt(result); var value = parseInt(result);