Skip to content

Commit dbbc082

Browse files
committed
- bump patch version to 0.1.2
- update information in `readme.md`, including a section about possible problems one may encounter - increase the number of fields in `manifest.json` - make the extension name and descriptions longer - general cleanup - did a little testing of the distribution in all browsers, and everything seemed functional
1 parent da74b30 commit dbbc082

File tree

5 files changed

+45
-30
lines changed

5 files changed

+45
-30
lines changed

build_1.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ const
1515
src_dir = "./src/",
1616
dst_dir = `./dist/${deno_json.name ?? ""}-v${deno_json.version ?? "0.0.0"}/`,
1717
// additionl files to copy over to the `dst_dir`
18-
additional_files: Array<[source_path: string, destination_relative_path: string]> = [
18+
additional_files: Array<[source_root_path: string, destination_relative_path: string]> = [
1919
["./license.md", "./license.md"],
2020
]
2121

2222
const buildManifestJson = (base_manifest_obj: { [key: string]: any }) => {
2323
const
24-
{ version, repository, description } = deno_json,
24+
{ author, version, repository, description } = deno_json,
2525
homepage_url = (repository.url as string).replace(/^git\+/, "").replace(/\.git$/, "")
26-
Object.assign(base_manifest_obj, { version, description, homepage_url })
26+
Object.assign(base_manifest_obj, { author, version, description, homepage_url })
2727
delete base_manifest_obj["$schema"]
2828
return base_manifest_obj
2929
}

build_2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const output_files = await doubleCompileFiles("", dst_dir,
4646
{ minify: true },
4747
)
4848

49-
console.log("witing the following transpiled files:", output_files.map((out_file) => out_file.path))
49+
console.log("writing the following transpiled files:", output_files.map((out_file) => out_file.path))
5050
if (!log_only) {
5151
await Promise.all(output_files.map(
5252
async ({ text, path }, file_number) => {

deno.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "github_aid_ts",
3-
"version": "0.1.1",
4-
"description": "an extension to display the size of github repositories and files.",
3+
"version": "0.1.2",
4+
"description": "Displays github repository file and folder sizes. Supports GraphQL and REST api modes. Also mobile friendly.",
55
"author": "Omar Azmi",
6-
"license": "Lulz plz don't steal yet",
6+
"license": "Anti-Competition License",
77
"repository": {
88
"type": "git",
99
"url": "git+https://github.com/omar-azmi/github_aid_ts.git"

readme.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Github Aid
22

3-
This is a Chromium and Firefox extension for viewing github Repository sizes, and ~~Bulk downloading~~ selected files and subdirectories.
3+
This is a Chromium and Firefox extension for viewing github Repository file and folder sizes, in addition to ~~Bulk downloading them~~.
44

55
> [!note]
66
> TODO: The download feature has yet to be implemented
77
8-
> [!warning]
9-
> Currently does not work in Firefox due to its inability to dynamically import from `"web_accessible_resources"`.
10-
> this is a long time [mozilla bug (1536094)](https://bugzilla.mozilla.org/show_bug.cgi?id=1536094), and it seems like it won't be fixed due to security concerns.
118

129
### Downloads
1310

@@ -40,6 +37,27 @@ This is a Chromium and Firefox extension for viewing github Repository sizes, an
4037
- wanted to do a fun weekend project, try out some GraphQL apis, and be done with the annoyance of constant non-functioning extensions
4138

4239

40+
## Problems you may encounter:
41+
42+
1) The buttons are not appearing.
43+
- Fixes:
44+
- Refresh the page. Github is an SPA (single-page application), so there are times when the background script does get reloaded upon navigation from one page to another.
45+
- Make sure that you did not disable all buttons in the option page's layout section. If you're having touble, consider clicking on the red "reset" button to clear any misconfigurations and return to factory settings.
46+
- Make sure that storage permission has been granted to this extension, otherwise the script will fail to load the default configuration, and terminate fatally.
47+
48+
2) One of the buttons flashes in red, and nothing happens.
49+
- This is because the request query sent to github's server has failed, possibly due to one of the following reasons:
50+
- Github's server is overloaded, and it decided to reject your request (quite common).
51+
In this case, try switching your api method in the options page, and reload your webpage and retry.
52+
- You are viewing a private repo, and the access token that you have (or may lack) is not authorized for pulling up data of that private repository.
53+
- Your Github Access Token key is invalid, or has expired.
54+
- You (and your Token) have reached their per hour request limit, or that you've been sending too many requests too quickly.
55+
The request data rate for github is: 50 requests per hour for non-authorized tokenless users, and 5000 per hour for authorized users.
56+
Moreover, the REST api in this extension used 2 requests for fetching file and folder sizes.
57+
- There might be a bug in the code, or github's api might have changed.
58+
In that case, I'd appreciate if you could report the issue on github: https://github.com/omar-azmi/github_aid_ts/issues
59+
60+
4361
## How the internals differ
4462

4563
This project provides a good minimal-boilerplate example of how one can generate a web-extension, while:
@@ -154,9 +172,9 @@ title: "Import graph"
154172
---
155173
flowchart TD
156174
591514(("deps.ts")) --> 530727((("option.ts\n(endpoint)")))
157-
423910(("typedefs.ts")) -->|"dynamic\nimport"| 709575((("content_script.ts\n(endpoint)")))
158-
405595(("modify_ui.ts")) -->|"dynamic\nimport"| 709575
159-
591514 -->|"dynamic\nimport"| 709575
175+
423910(("typedefs.ts")) --> 709575((("content_script.ts\n(endpoint)")))
176+
405595(("modify_ui.ts")) --> 709575
177+
591514 --> 709575
160178
subgraph 325333["/src/lib/"]
161179
591514 --> 650261(("gh_rest_api.ts"))
162180
423910 --> 650261
@@ -168,7 +186,7 @@ flowchart TD
168186
423910 --> 405595
169187
end
170188
subgraph 201358["/src/js/"]
171-
709575
189+
709575 -->|"dynamic import as\nchromeURL('/js/content_script.js')"| 798822((("content_script\n_extension_adapter.ts\n(endpoint)")))
172190
end
173191
subgraph 843058["/src/html/"]
174192
530727 -->|"imported as\n'./option.js'"| 635635[["option.html"]]
@@ -261,12 +279,8 @@ here's how it should look: <br>
261279
// ...
262280
"web_accessible_resources": [
263281
{
264-
"resources": [
265-
"*.js"
266-
],
267-
"matches": [
268-
"<all_urls>"
269-
]
282+
"resources": ["*.js"],
283+
"matches": ["<all_urls>"]
270284
}
271285
],
272286
// ...
@@ -275,7 +289,7 @@ here's how it should look: <br>
275289
with that, you've solved the problem that you initiated, and made your extension less secure along the way. <br>
276290
alternatively you can choose to bundle without code-splitting, and avoid all the fuss. but where's the fun in that? <br>
277291
see this [stackexchange answer](https://stackoverflow.com/a/53033388), where I found this information from. <br>
278-
also see [`/src/js/content_script.ts`](./src/js/content_script.ts#L32-L35) for the dynamic imports being done in this extension.
292+
also see [`/src/js/content_script_extension_adapter.ts`](./src/js/content_script_extension_adapter.ts#L28) for the dynamic imports being done in this extension.
279293

280294

281295
## License
@@ -289,14 +303,14 @@ see [`license.md`](./license.md). but for a quick summary:
289303
## How to get a Github Access Token
290304

291305
- First of all, you'll need to be logged into your github account (Duh!).
292-
- Navigate to here: [Generate new token (classic)](https://github.com/settings/tokens/new) (https://github.com/settings/tokens/new)
293-
- Set an `Expiration` date, (you'll probably want to choose `No expiration`)
306+
- Navigate to this github page: [Generate new token (classic)](https://github.com/settings/tokens/new) (https://github.com/settings/tokens/new).
307+
- Set an `Expiration` date for your token, (you'll probably want to choose `No expiration`).
294308
- In the `Select scopes` section, under the `repo` checkbox:
295-
- enable only the `public_repo` checkbox if you will NOT be viewing your private repository's stats
296-
- enable the whole `repo` group checkbox otherwise
297-
- Scroll to the bottom and click on the `Generate token` button
298-
- You will now be presented with the access token. MAKE SURE TO COPY AND SAVE IT NOW! This token will forever disappear after you close the dialog, so make sure to save it
299-
- Paste the token into this browser extension
309+
- enable only the `public_repo` checkbox if you will NOT be viewing your private repository's stats.
310+
- enable the whole `repo` group checkbox otherwise.
311+
- Scroll to the bottom and click on the `Generate token` button.
312+
- You will now be presented with the access token. MAKE SURE TO COPY AND SAVE IT SECURELY RIGHT NOW! This is a one time preview of you key, and it will disappear forever after you've closed the dialog.
313+
- Paste the token into this browser extension's options page.
300314

301315
For a visual guide, see one of:
302316
- https://www.geeksforgeeks.org/how-to-generate-personal-access-token-in-github/

src/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"$schema": "https://json.schemastore.org/chrome-manifest",
33
"manifest_version": 3,
4-
"name": "Github Aid",
4+
"name": "Github Aid - displays repo file sizes",
5+
"short_name": "Github Aid",
56
"content_scripts": [
67
{
78
"matches": [

0 commit comments

Comments
 (0)