Git Product home page Git Product logo

Comments (3)

turbobabr avatar turbobabr commented on June 23, 2024 1

Well, I already tried to tell you here, but I guess you missed it ;)

Ugh... the EasyEda's forum(and the whole community as welll) is so broken! I'd never received any notifications about that comment, thus I didn't have a chance to check it. 😕

Anyway, thank you for pointing it out here! Despite the fact that such "easter egg" doesn't sit very well - it works! ¯_(ツ)_/¯

Going to update all of my plugins/extension with this technique :)

from easyeda-extension-menu-ux-normalizer.

turbobabr avatar turbobabr commented on June 23, 2024

Wow! That's just awesome!

After experimenting with this finding it turned out that EasyEDA performs a brute forced regexp search for extension- + whatever + -id prefix/suffix pair, where whatever is a string to be picked as the id. 🤔

There are some limitations though for that whatever portion:

  • It should be a whole string
  • no dots
  • no dashes
  • no special symbols
  • the length is apparently unlimited

The // extension-whatever-id macro can be put in any place of the javascript file, moreover - it can be part of the code what allows to inject the defined identifier even with obfuscated and post processed code via webpack or any other bundler that strips comments during the bundling process:

image

I'm curious, how did you found out about this easter egg? :)

from easyeda-extension-menu-ux-normalizer.

xsrf avatar xsrf commented on June 23, 2024

Well, I already tried to tell you here, but I guess you missed it ;)
https://easyeda.com/forum/topic/Extensions-installation-UX-issues-Getting-rid-of-useless-ExtentionID-field-7e311609a243486683f0baad2fb21f3c

/*
	extension-testone-test
	extension-testtwo-test
	extension-testtwo-test
	extension-testthree-test
*/

Will register testtwo as extension id.

I found this because the extension id was auto-filled when I imported the official example extension (which doesn't work) and I found that the explicit string used as id was only used as parts of the registered commands within the extension.
e.g.

api('createCommand', {
	'extension-svgimport-import' : () => {
        doImport();
	}
});

I thought creating at least one command would be required, but then I tried to verify this by looking at EasyEDAs main minified javascript code and actually (kind of) found the regex used to extract the extension id.

I'm still not sure how they choose the extension id if there are multiple matches. But I think the one that is found most often is used.

from easyeda-extension-menu-ux-normalizer.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.