Git Product home page Git Product logo

omar-azmi / github_aid_ts Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.41 MB

A Chromium and Firefox extension for viewing github Repository sizes, and Downloading files/subdirectories. It also features a simple tooling workflow that is capable of auto-generate web-extensions with: pure Typescript, Deno, and ES-modules. Along with the ability to bundle with minification and common-code-splitting.

Home Page: https://chromewebstore.google.com/detail/github-aid/abfbcnoemiciiljhpngefacedfgebdcn

License: Other

TypeScript 91.05% HTML 8.95%
build-tool chrome-extension deno deno-examples deno-sample githu-api github-extension no-nodejs no-npm repo-size

github_aid_ts's People

Contributors

omar-azmi avatar

Watchers

 avatar

github_aid_ts's Issues

v0.2.0 todo list

Take care of the following tasks before hitting v0.2.0

  • add option to choose if one wishes to strictly adhere to REST api in incognito mode, along with no authentication key

  • add feature for downloading files and folders in a single ".tar.gz" archive file

  • create a build process for generating bookmarkletes that function in the same way as the extension, with user predefined config and storage values

  • come up with a better logo (how about a seppukucat with a katana and a man bun?)

  • design a better and more universal SimpleStorage class.
    currently, your storage api and techniques might be a bit finicky given their blackbox-like handling of first-time assignments/empty storage entries.
    a lot of the first-time values are assined by the option.ts script. and it shouldn't be like that since option.ts should ideally deal only with the ui of option.html.

    • setup a default-value system and link it to the "reset" button in the options.html page.
    • make the storage system compatible with:
      • local website storage
        • this one won't work, because window.localStorage can only store Record<string, string>, whereas our schema has arrays and objects as values inside of it.
          I could encode the values as json when "setting", and parse that json back when "getting", but that's for later.
      • temporary map/object storage , so that it can work across different environments, including bookmarklets
      • DONE: 68f0259

v0.1.0 todo list

Take care of the following tasks before hitting v0.1.0

  • add option for setting the degree of recursion depth when traversing folders

  • add option for branch selection and recursion for REST api (this will require us to use the tree schema instead of the repository schema)

  • add feature for checking a repository's total diskspace usage

  • add option customizing the placement of the buttons that get injected onto the github page

    • add configuration ui to option.html
    • implement the button placement function based on the user's StorageSchema.layout value
    • allow redundant injected buttons
  • fix the cropping of the option.html page when rendered as a popup page

  • folders with only one subfolder (and no files) are previewed as "folder/subfolder" in the github table-view ui.
    as a result, I am unable to match the retrieved folder sizes with the associated table row, since the table row is identified by the name "folder/subfolder", where as the folder sizes has it stored as the key "folder".

    • potential fix: make table rows be identifiable by the name string before any slashes ("/")
    • DONE: 3841ab4
  • reject github tokens of incorrect length (anything other than 40), and notify the user in option.html

  • in option.html, use a single save button to save everything. the button must be at the top of the page, and there must also be a reload button

  • add readme.md page. and include a "how to get token" subsection in the readme page

  • add license.md. what should I even set it to?

  • publish to extension stores (chrome store, edge store, and firefox)

    • test extension in chromium
    • test extension in firefox:
      • ISSUE: firefox can't do dynamic imports of "web_accessible_resources". fixing this will require discovering an alternate bypass. moved to a separate issue thread: #3
      • DONE: da74b30
    • prepare screenshots
    • publish to:

parsing the name of a branch with a forward slash `"/"` will fail

parsing the name of a branch with a forward slash "/" will fail.
this is because the script always assumes that the portion after the slash contains a subdirectory, and not that it could be part of the branch name.

example:

parsing the branch feature/xyz of repo_name under user_name, and subdirectory /src/:
https://github.com/user_name/repo_name/tree/feature/xyz/src
will fail. because it gets parsed as branch = "feature", subdir = "/xyz/src/"

Support Firefox

The extension's content_script.js can't run in Firefox because it relies on dynamically importing its dependency javascript files by referencing it indirectly through github.com, and then on the other hand, making the dependency javascript files available to github.com via injection ("web_accessible_resources" in manifest.json).
This issue in Firefox has been known for a long time (mozilla bug (1536094)), and it seems like there's no progress towards a resolution given that it might introduce security breaches.

Console log when running the extension on Firefox:

Warning

WebExtension content scripts may only load modules with moz-extension URLs and not: โ€œhttps://github.com/typedefs-R2RAKVQY.jsโ€. content_script.js:1:628

Caution

TypeError: error loading dynamically imported module: https://github.com/typedefs-R2RAKVQY.js content_script.js:1:628

A temporary fix:

  • disable code splitting, and bundle the endpoint typescript files as whole. But that would ruin my entire shiny toolchain's purpose, so I will not go that route.

What will a potential fix need?:

  • It'll have to entirely avoid the usage of indirect dynamic script importation through the abuse of "web_accessible_resources"
  • potentially use a service background worker that hands out dynamically requested scripts. this technique is mentioned by some in the mozilla bug page (1536094).
    • problem with this approach: esbuild will not be able to correctly generate a dependency graph, because the location of the scripts will no longer be a static compile time string. again: it'll ruin the whole toolchain's purpose of compiling directly referenced typescript source files.

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.