Skip to content

Commit d2ab18e

Browse files
committed
a glitch in github's markdown preview fails to parse "width: 22.5%;" correctly due to the decimal point, so I've removed it.
find and fix a ton of spelling typos using the "typos" rust tool from: "https://github.com/crate-ci/typos" . it's quite impressive I must say
1 parent 3184687 commit d2ab18e

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is a Chromium and Firefox extension for viewing github Repository sizes, an
88

99
<p float="left">
1010
<img src="./public/screenshots/desktop.png" style="width: 75%;" />
11-
<img src="./public/screenshots/mobile.png" style="width: 22.5%;" />
11+
<img src="./public/screenshots/mobile.png" style="width: 22%;" />
1212
<img src="./public/screenshots/desktop_option_page.png" style="width: 98%;" />
1313
</p>
1414

@@ -177,7 +177,7 @@ flowchart TD
177177
394730(("E")) --> 633740
178178
842277 --> 222161
179179
842277 --> 394730
180-
subgraph 977297["bundling enpoints"]
180+
subgraph 977297["bundling endpoints"]
181181
633740
182182
339264
183183
end
@@ -237,10 +237,10 @@ bundling with code-splitting also comes with the advantage of smaller total outp
237237

238238
first, you need to know that the extension is supposed to be a single javascript file that is executed after your designated injection-target website has loaded (this being "github.com" for this extension). <br>
239239
the javascript file to be ran is specified in the manifest file ([`/src/manifest.json`](./src/manifest.json)), under `manifest["content_scripts"][0]["js"][0]`. <br>
240-
the global context available to this javascript of yours is simply the same as the one available to the target webpage (i.e. you are in the `window` environment), in addition to having a limitied number of browser-extension features, such as: `chrome.storage` and `chrome.runtime` (or in the case of firefox: `browser.storage` and `browser.runtime`). <br>
240+
the global context available to this javascript of yours is simply the same as the one available to the target webpage (i.e. you are in the `window` environment), in addition to having a limited number of browser-extension features, such as: `chrome.storage` and `chrome.runtime` (or in the case of firefox: `browser.storage` and `browser.runtime`). <br>
241241
moreover, by web-security design, you cannot do static imports in any content_script (so `import {x, y, z} from "./abc.js"` is disallowed). <br>
242242
however, you *can* dynamically import using `const {x, y, z} = await import("./abc.js")`, but it **will** require that the target webpage has access to that imported file, which it currently doesn't, because the file sits locally in your browser. <br>
243-
hence, you will need to give the target webiste *access* to your imported javascript files, which is done by specifying the `manifest["web_accessible_resources"]` entry in the manifest file. <br>
243+
hence, you will need to give the target website *access* to your imported javascript files, which is done by specifying the `manifest["web_accessible_resources"]` entry in the manifest file. <br>
244244
here's how it should look: <br>
245245
```ts
246246
// manifest.json
@@ -282,7 +282,7 @@ see [`license.md`](./license.md). but for a quick summary:
282282
- enable only the `public_repo` checkbox if you will NOT be viewing your private repository's stats
283283
- enable the whole `repo` group checkbox otherwise
284284
- Scroll to the bottom and click on the `Generate token` button
285-
- You will now be presented with the access token. MAKE SURE TO COPY AND SAVE IT NOW! This token will forever disapear after you close the dialog, so make sure to save it
285+
- 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
286286
- Paste the token into this browser extension
287287

288288
For a visual guide, see one of:

src/js/content_script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* so, for that, we have to create an async iife to execute the script.
66
* furthermore, the imported script MUST have external-resource security clearance to be imported here.
77
* for that, we have to specify in "manifest.json": `web_accessible_resources = [{resources: ["*.js"], matches: "<all_urls>"}]`.
8-
* which is basically saying: javacript within "<all_urls>" in this extension can load the resource url_pattern "*.js" (all javascript files).
8+
* which is basically saying: javascript within "<all_urls>" in this extension can load the resource url_pattern "*.js" (all javascript files).
99
*/
1010

1111
// dynamic imports of the following are done in `runMain()`:

src/lib/deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class BrowserStorage<SCHEMA extends Record<string, ({} | undefined)>> extends So
214214
// here, we simply check if `this.storage.get(key)[key] === undefined`,
215215
// because, if that key had ever been set to `undefined` via our `set` method, then it would've internally converted it to `null`,
216216
// and we would've actually gotten `this.storage.get(key)[key] === null` instead.
217-
// but actually, it seems far more reasonable to simply check of the `key` exists in the returned storge value object via `key in (await this.storage.get(key as any))`
217+
// but actually, it seems far more reasonable to simply check of the `key` exists in the returned storage value object via `key in (await this.storage.get(key as any))`
218218
// but i don't want to do that right now, unless i encounter an issue with my current way.
219219
return (await this.storage.get(key as any))[key] === undefined
220220
}

src/lib/easter_egg.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { shuffledDeque } from "./deps.ts"
33
const seppuku_slogans = /* @__PURE__ */[
44
"you are one step away from retaining your honor",
55
"your honor lies on the other side",
6-
"sudoku must be commited before a large audience",
6+
"sudoku must be committed before a large audience",
77
"know that kermit the frog is proud of you",
88
"sudoku fills you with determination",
99
"sudoku is now legal in canada! visit your local doctor find out more!",
@@ -30,7 +30,7 @@ const seppuku_slogans = /* @__PURE__ */[
3030
"your organs will become a fine art",
3131
"gunshot is a lazy sudoku",
3232
"nippon has the best sudoku knives in the world",
33-
"at the end of every journey, lies the begining of a new sudoku",
33+
"at the end of every journey, lies the beginning of a new sudoku",
3434
"sudoku is an honor, not a punishment",
3535
"you are a hero, and sudoku is your reward",
3636
"sudoku is now tax deductible! save money and your honor!",
@@ -51,7 +51,7 @@ const seppuku_slogans = /* @__PURE__ */[
5151
"pray that you become a good piece of art as you fall into eternal slumber",
5252
"bodily ketchup will gush out of your guts",
5353
"did you enjoy your final obento onee-san prepared for you?",
54-
"there is no esekai for commiters of sudoku. break free of the cycle!",
54+
"there is no esekai for committers of sudoku. break free of the cycle!",
5555
"sudoku lets you become one with the void",
5656
`<pre style="margin: -2rem 0 0 0; text-align: center; font-size: 1rem; line-height: calc(1rem * (1.0 - exp(-1)));">┌───┬───┬───┐
5757
│S │ K│ILL│

src/lib/gh_graphql_api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@ export class GraphQLAPI extends GithubAPI {
6666
const
6767
{ owner, repo, branch } = this.repo,
6868
branch_colon_path = branch + ":" + folder_pathname,
69-
reqest_header: HeadersInit = {
69+
request_header: HeadersInit = {
7070
"content-type": "application/json",
7171
"accept": "application/vnd.github+json",
7272
"authorization": `bearer ${this.auth}`,
7373
},
7474
response = await (await fetch(config.api.graphql, {
7575
method: "POST",
76-
headers: reqest_header,
76+
headers: request_header,
7777
body: JSON.stringify({
7878
query: create_recursive_query(options.recursion),
7979
variables: { owner, repo, branch_colon_path }
8080
}),
8181
})).json() as GraphQLResponse<GraphQLRepositoryData>
8282
if (response.errors) {
8383
const error_messages = response.errors.map((error) => (error.message)).join("\n\t")
84-
throw Error(`encoutered GraphQL query errors:\n\t${error_messages}`)
84+
throw Error(`encountered GraphQL query errors:\n\t${error_messages}`)
8585
}
8686
const folder_contents = response.data.repository.object.entries
8787
const sumup_entry_bytesizes = (file_or_folder_entry: GraphQLRepositoryFolderEntry | GraphQLRepositoryFileEntry): number => {
@@ -101,22 +101,22 @@ export class GraphQLAPI extends GithubAPI {
101101
async getDiskspace(): Promise<number> {
102102
const
103103
{ owner, repo } = this.repo,
104-
reqest_header: HeadersInit = {
104+
request_header: HeadersInit = {
105105
"content-type": "application/json",
106106
"accept": "application/vnd.github+json",
107107
"authorization": `bearer ${this.auth}`,
108108
},
109109
response = await (await fetch(config.api.graphql, {
110110
method: "POST",
111-
headers: reqest_header,
111+
headers: request_header,
112112
body: JSON.stringify({
113113
query: create_diskspace_query(),
114114
variables: { owner, repo }
115115
}),
116116
})).json() as GraphQLResponse<GraphQLRepositoryDiskspaceData>
117117
if (response.errors) {
118118
const error_messages = response.errors.map((error) => (error.message)).join("\n\t")
119-
throw Error(`encoutered GraphQL query errors:\n\t${error_messages}`)
119+
throw Error(`encountered GraphQL query errors:\n\t${error_messages}`)
120120
}
121121
return response.data.repository.diskUsage * 1024 // `diskUsage` is actually in kilobytes instead of bytes, so we need to convert it to bytes
122122
}

src/lib/gh_rest_api.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,35 @@ export class RestAPI extends GithubAPI {
2424
const
2525
{ owner, repo, branch } = this.repo,
2626
recursion_query = ((options.recursion ?? 1) > 1) ? "recursive=true" : "",
27-
reqest_header_auth: { authorization: string } | {} = this.auth ? { "authorization": `bearer ${this.auth}` } : {},
27+
request_header_auth: { authorization: string } | {} = this.auth ? { "authorization": `bearer ${this.auth}` } : {},
2828
// we first need to fetch the tree's associated SHA1 hash value.
2929
// for this, it is crucial that we use the header `{ "accept": "application/vnd.github.object" }`,
3030
// otherwise the standard json response will not contain the SHA1 info (it'll just be a plain array of child content entries).
3131
folder_tree_sha1 = (await (
3232
await fetch(config.api.rest + `/${owner}/${repo}/contents/${folder_pathname}?ref=${branch}`, {
3333
method: "GET",
34-
headers: { "accept": "application/vnd.github.object", ...reqest_header_auth },
34+
headers: { "accept": "application/vnd.github.object", ...request_header_auth },
3535
})
3636
).json())["sha"] as (string | undefined)
3737
if (!folder_tree_sha1) {
38-
throw Error("failed to fetch folder's tree SHA1.\n\tfetch reuest was made for folder_pathname: " + folder_pathname)
38+
throw Error("failed to fetch folder's tree SHA1.\n\tfetch request was made for folder_pathname: " + folder_pathname)
3939
}
4040
// with the folder's SHA1 info at hand, we can request the info on all deeply nested directory and file entries.
4141
// the `recursion_query` specifies whether or not deep entries should be reported back. if it's not there, only direct entries of the folder are reported.
4242
const folder_deep_contents: RestTreeResponse["tree"] = (await (
4343
await fetch(config.api.rest + `/${owner}/${repo}/git/trees/${folder_tree_sha1}?${recursion_query}`, {
4444
method: "GET",
45-
headers: { "accept": "application/vnd.github+json", ...reqest_header_auth },
45+
headers: { "accept": "application/vnd.github+json", ...request_header_auth },
4646
})
4747
).json())["tree"]
4848
if (!array_isArray(folder_deep_contents)) {
49-
throw Error("failed to fetch folder contents in correct format.\n\tfetch reuest was made for folder_pathname: " + folder_pathname + "\n\twith folder tree SHA1: " + folder_tree_sha1)
49+
throw Error("failed to fetch folder contents in correct format.\n\tfetch request was made for folder_pathname: " + folder_pathname + "\n\twith folder tree SHA1: " + folder_tree_sha1)
5050
}
5151
// we now need to sum the bytesizes of all deeply nested entries into the top subfolder's size
5252
const folder_content_sizes: { [entry_name: string]: number } = {}
5353
folder_deep_contents.forEach((deep_entry) => {
5454
const
55-
// the top subfolder or file's name always preceeds the first "/" (if there's any)
55+
// the top subfolder or file's name always precedes the first "/" (if there's any)
5656
top_dir_or_file_name = deep_entry.path.split("/", 1)[0],
5757
deep_entry_size = deep_entry.size ?? 0
5858
folder_content_sizes[top_dir_or_file_name] ??= 0
@@ -67,11 +67,11 @@ export class RestAPI extends GithubAPI {
6767
async getDiskspace(): Promise<number> {
6868
const
6969
{ owner, repo } = this.repo,
70-
reqest_header_auth: { authorization: string } | {} = this.auth ? { "authorization": `bearer ${this.auth}` } : {},
70+
request_header_auth: { authorization: string } | {} = this.auth ? { "authorization": `bearer ${this.auth}` } : {},
7171
repo_info = await (
7272
await fetch(config.api.rest + `/${owner}/${repo}`, {
7373
method: "GET",
74-
headers: reqest_header_auth
74+
headers: request_header_auth
7575
}).then((response) => { return response.ok ? response : new Response("{}") })
7676
).json()
7777
if (!number_isFinite(repo_info.size)) {

src/lib/modify_ui.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class DirectoryEntry {
9191
const
9292
displayed_name = (this.dom.querySelector("div:first-child") as HTMLElement).innerText,
9393
// folders with exactly one subfolder are displayed as "folder/subfolder" (for example ".github/workflows" is quite common).
94-
// in that case, we need to get the actual name of the entry, which preceeds the slash ("/").
94+
// in that case, we need to get the actual name of the entry, which precedes the slash ("/").
9595
// in summary, "folder/subfolder" will get parsed as "folder", and ".github/workflows" will be parsed as ".github", as it should be
9696
actual_name = displayed_name.split("/", 1)[0]
9797
return actual_name
@@ -129,7 +129,7 @@ export const previewSizes = async (event: MouseEvent) => {
129129
try {
130130
folder_size_info = await api_caller.getFolderSizeInfo(folder_pathname, { recursion: recursion_depth })
131131
} catch (error) {
132-
// turn the "size" button red in order to indicate a faliure while fetching
132+
// turn the "size" button red in order to indicate a failure while fetching
133133
modifyElementStyleTemporarily(event.target as HTMLButtonElement, 500, "background-color: red;")
134134
console.log(error)
135135
}
@@ -157,7 +157,7 @@ export const previewDiskspace = async (text_element: HTMLElement) => {
157157
try {
158158
total_bytesize = await api_caller.getDiskspace()
159159
} catch (error) {
160-
// turn the "download" button red in order to indicate a faliure while fetching
160+
// turn the "download" button red in order to indicate a failure while fetching
161161
modifyElementStyleTemporarily(text_element, 500, "background-color: red;")
162162
console.log(error)
163163
}

0 commit comments

Comments
 (0)