File tree Expand file tree Collapse file tree
static/extensions/MubiLop Expand file tree Collapse file tree Original file line number Diff line number Diff line change 241241 }
242242 }
243243
244- setServerUrl ( args ) {
244+ async setServerUrl ( args ) {
245+ if ( await Scratch . canFetch ( args . URL ) === false ) return ;
245246 this . serverUrl = args . URL ;
246247 }
247248
Original file line number Diff line number Diff line change 4444 }
4545
4646 loadImage ( url ) {
47+ if ( await Scratch . canFetch ( url ) === false ) return ;
48+
4749 return new Promise ( ( resolve , reject ) => {
4850 const img = new Image ( ) ;
4951 img . crossOrigin = "anonymous" ; // Add CORS support
Original file line number Diff line number Diff line change 551551 }
552552
553553 // general function so its better to handle things
554- _createToast ( options ) {
554+ async _createToast ( options ) {
555555 const container = createToastContainer ( options . position ) ;
556556 const toast = document . createElement ( 'div' ) ;
557557 toast . className = 'toast' ;
578578 toast . style . transform = `translateY(${ stackSize * 100 } %)` ;
579579 toast . style . transition = 'transform 0.3s ease-out' ;
580580
581- if ( options . image ) {
581+ if ( options . image && await Scratch . canFetch ( options . image ) ) {
582582 const img = document . createElement ( 'img' ) ;
583583 img . src = options . image ;
584584 img . alt = 'Toast icon' ;
585+
585586 if ( options . imageRounded ) {
586587 img . style . borderRadius = '50%' ;
587588 }
589+
588590 toast . appendChild ( img ) ;
589591 }
590592
Original file line number Diff line number Diff line change 13641364 try {
13651365 this . uploadStatus = 'uploading' ;
13661366 this . uploadSuccessful = false ;
1367+
1368+ if ( await Scratch . canFetch ( url ) === false ) throw new Error ( 'User denied the fetch of the file on the external url' ) ;
13671369
13681370 const response = await fetch ( url ) ;
13691371 if ( ! response . ok ) {
You can’t perform that action at this time.
0 commit comments