Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: EXTJS 4.1 chart save: from:http://svg.sencha.io security issue

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    1
    Vote Rating
    -1
      0  

    Default EXTJS 4.1 chart save: from:http://svg.sencha.io security issue

    When we try to save the chart it sends the message over to http://svg.sencha.org. For security reasons we cannot use this. Also what if it is a private network and this functionality need to work. Is there any way work around this? This is really cool. But please make it usable and help!

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    1
    Vote Rating
    -1
      0  

    Default

    Thanks for the reply. definitely there is a clue here. But how do I override this? I have to think about this. Is there a resolved solution for this already?

    performChart.save({
    type: 'image/png'
    });

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    Have you tried:

    Code:
    Ext.draw.engine.ImageExporter({ defaultUrl: 'newURL' });
    performChart.save({ .. });
    Scott.

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    1
    Vote Rating
    -1
      0  

    Default

    No it did not work. Is seems to be using some service to really draw the image. I changed my address and it did not work. I put it back http;//svg.sencha.io it works again. I also tried changing the url here in ImageExporter and it did not work. Also it uses the method 'POST' here and I don't understand what is this doing?

    ImageExporter.js
    Ext.define('Ext.draw.engine.ImageExporter', {
    singleton: true,

    statics: (function(){
    var exportTypes = {
    "image/png": 1,
    "image/jpeg": 1
    },
    init = function(config){

    if(config.hasOwnProperty('width')){
    width = config['width'];
    }
    if(config.hasOwnProperty('height')){
    height = config['height'];
    }
    if(config.hasOwnProperty('type') && exportTypes[config['type']]){
    type = config['type'];
    }else{
    return false;
    }

    // if all the elements were set up before
    // we don't need to reset their values and reappend them to the form
    if(formEl && svgEl && typeEl && widthEl && heightEl){
    return true;
    }

    formEl = formEl || Ext.get(document.createElement('form'));
    formEl.set({
    action: 'MYURL',
    method: 'POST'
    });

    svgEl = svgEl || Ext.get(document.createElement('input'));
    svgEl.set({
    name: 'svg',
    type: 'hidden'
    });

    typeEl = typeEl || Ext.get(document.createElement('input'));
    typeEl.set({
    name: 'type',
    type: 'hidden'
    });
    widthEl = widthEl || Ext.get(document.createElement('input'));
    widthEl.set({
    name: 'width',
    type: 'hidden'
    });
    heightEl = heightEl || Ext.get(document.createElement('input'));
    heightEl.set({
    name: 'height',
    type: 'hidden'
    });

    formEl.appendChild(svgEl);
    formEl.appendChild(typeEl);
    formEl.appendChild(widthEl);
    formEl.appendChild(heightEl);

    Ext.getBody().appendChild(formEl);

    return true;
    },
    process = function(surface){


    var svgString = Ext.draw.engine.SvgExporter.self.generate({}, surface);


    widthEl.set({
    value: width || surface.width
    });

    heightEl.set({
    value: height || surface.height
    });

    if(type){
    typeEl.set({
    value: type
    });
    }
    svgEl.set({
    value: svgString
    });

    formEl.dom.submit();

    },
    formEl, typeEl, svgEl, widthEl, heightEl, type, width, height;


    return {
    generate: function(config, surface){
    if(init(config)){
    process(surface);
    }else{
    return false;
    }
    }
    };
    }())


    });

  6. #6
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,105
    Answers
    736
    Vote Rating
    970
      0  

    Default

    Yes, that's what the service does. From the docs:

    To do this, the svg string must be sent to a remote server and processed.
    If you're pointing it at your own server, you need to process the SVG string and turn it into an image.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    1
    Vote Rating
    -1
      0  

    Default

    Not sure How I do that? Is there any example? I would like to make this work.

  8. #8
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,105
    Answers
    736
    Vote Rating
    970
      0  

    Default

    You'll need to find an example in whatever server language you use, it's not a client problem.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  9. #9
    Sencha User
    Join Date
    Jul 2012
    Posts
    26
    Answers
    1
    Vote Rating
    -1
      0  

    Default

    OK. Is there any opens source package that can be installed in place of sencha service?

  10. #10
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    What is your server side language? As mentioned, you will need to research this based on that.

    Scott.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •