Merge branch 'develop'

This commit is contained in:
EnixCoda 2020-03-07 19:24:51 +08:00
commit a7d1a5731e
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
14 changed files with 115 additions and 91 deletions

View file

@ -1,5 +1,9 @@
# Gitako
<p align="center">
<img width="256" src="src/assets/icons/Gitako.png" />
</p>
Yet another extension for GitHub, available on both Chrome and Firefox. Inspired by [Octotree](https://github.com/buunguyen/octotree) & [GayHub](https://github.com/jawil/GayHub), thanks to them! Gitako is aimed at providing the best performance, better UX, more consistent UI and more essential features.
### Features
@ -29,9 +33,11 @@ Any bug report or feature request discussions are welcomed, feel free to draft a
### About
#### Why named 'Gitako'?
#### Name and logo meaning?
GitHub's totem is a cute octopus. And octopus in Japanese is `タコ`(tako).
Then link them together:
git + tako -> gitako
The logo of Gitako is a tentacle of octopus, meaning Gitako works like a part of GitHub.

View file

@ -1,6 +1,6 @@
{
"name": "gitako",
"version": "0.8.7",
"version": "1.0.0",
"description": "The missing part of GitHub.",
"repository": "https://github.com/EnixCoda/Gitako",
"author": "EnixCoda",
@ -17,7 +17,7 @@
"dependencies": {
"@primer/octicons": "^9.2.0",
"@primer/octicons-react": "^9.2.0",
"@sentry/browser": "^5.5.0",
"@sentry/browser": "^5.12.1",
"@types/firefox-webext-browser": "^70.0.1",
"@types/ini": "^1.3.30",
"@types/js-base64": "^2.3.1",
@ -45,7 +45,7 @@
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@sentry/cli": "^1.47.1",
"@sentry/cli": "^1.51.0",
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.0",
"css-loader": "^2.1.0",

View file

@ -15,6 +15,12 @@ const errorSet = new Set<string>([
'Failed to fetch', // network fail in Chrome
])
const disabledIntegrations: string[] = [
'TryCatch',
'Breadcrumbs',
'GlobalHandlers',
'CaptureConsole',
]
const sentryOptions: Sentry.BrowserOptions = {
dsn: `https://${PUBLIC_KEY}@sentry.io/${PROJECT_ID}`,
release: VERSION,
@ -22,7 +28,8 @@ const sentryOptions: Sentry.BrowserOptions = {
// Not safe to activate all integrations in non-Chrome environments where Gitako may not run in top context
// https://docs.sentry.io/platforms/javascript/#sdk-integrations
defaultIntegrations: IN_PRODUCTION_MODE ? undefined : false,
integrations: integrations => integrations.filter(({ name }) => name !== 'TryCatch'),
integrations: integrations =>
integrations.filter(({ name }) => !disabledIntegrations.includes(name)),
beforeSend(event) {
const message = event.exception?.values?.[0].value || event.message
if (message) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/assets/icons/Gitako.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -18,3 +18,13 @@ if (document.readyState === 'loading') {
} else {
init()
}
// injects a copy of stylesheets so that other extensions(e.g. dark reader) could read
function injectStyles(url: string) {
var linkElement = document.createElement('link')
linkElement.rel = 'stylesheet'
linkElement.setAttribute('href', url)
document.head.appendChild(linkElement)
}
injectStyles(browser.extension.getURL('content.css'))

View file

@ -142,7 +142,7 @@ export const handleError: BoundMethodCreator<[Error]> = dispatch => async err =>
dispatch.call(setShowSettings, true)
} else {
DOMHelper.markGitakoReadyState(false)
dispatch.call(setError, 'Gitako ate a bug, but it should recovery soon!')
dispatch.call(setError, 'Some thing went wrong.')
throw err
}
}

View file

@ -1,11 +1,13 @@
{
"manifest_version": 2,
"name": "Gitako - Github file tree",
"version": "0.8.7",
"version": "1.0.0",
"description": "The missing part of GitHub.",
"author": "EnixCoda",
"icons": {
"128": "icons/Gitako-128x128.png"
"128": "icons/Gitako-128.png",
"256": "icons/Gitako-256.png",
"512": "icons/Gitako-512.png"
},
"homepage_url": "https://github.com/EnixCoda/Gitako",
"permissions": [
@ -14,16 +16,14 @@
"*://*.sentry.io/*"
],
"web_accessible_resources": [
"icons/vscode/*"
"icons/vscode/*",
"content.css"
],
"content_scripts": [
{
"matches": [
"https://github.com/*"
],
"css": [
"content.css"
],
"js": [
"firefox-shim.js",
"browser-polyfill.js",

View file

@ -32,9 +32,11 @@ async function request(url: string, { accessToken }: Options = {}) {
headers.Authorization = `token ${accessToken}`
}
const res = await fetch(url, { headers })
const contentType = res.headers.get('Content-Type')
if (!contentType || !contentType.includes('application/json')) {
throw new Error(`Response content is not JSON`)
const contentType = res.headers.get('Content-Type') || res.headers.get('content-type')
if (!contentType) {
throw new Error(`Response has no content type`)
} else if (!contentType.includes('application/json')) {
throw new Error(`Response content type is ${contentType}`)
}
// About res.ok:
// True if res.status between 200~299

View file

@ -1,14 +1,14 @@
import { getUrlForRedirect, MetaData, TreeData } from 'utils/GitHubHelper'
import { TreeNode } from './VisibleNodesGenerator'
interface RawItem {
name?: string | null
path?: string | null
mode?: string | null
type?: string | null
url?: string | null
sha?: string | null
}
type RawItem = Partial<{
mode: string
path: string
sha: string
size: number
type: 'tree' | 'blob' | 'commit'
url: string
}>
const revert = <T extends (...args: any[]) => any>(f: T) => (...args: Parameters<T>) => !f(...args)
@ -65,15 +65,16 @@ export function parse(treeData: TreeData, metaData: MetaData) {
while (itemsToCreateTreeNode.length) {
const item = itemsToCreateTreeNode.pop()
if (!item) continue
const node = {
...item,
name: item.path && item.path.replace(/^.*\//, ''),
const node: TreeNode = {
path: item.path || '',
type: item.type || 'blob',
name: item.path?.replace(/^.*\//, '') || '',
url:
item.url && item.type && item.path
? getUrlForRedirect(metaData, item.type, item.path)
: null,
contents: item.type === 'tree' ? [] : null,
} as TreeNode
: undefined,
contents: item.type === 'tree' ? [] : undefined,
}
const parentNode = pathToNode.get(path)
if (parentNode && parentNode.contents) {
parentNode.contents.push(node)

122
yarn.lock
View file

@ -839,68 +839,68 @@
dependencies:
object-assign "^4.1.1"
"@sentry/browser@^5.5.0":
version "5.6.3"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.6.3.tgz#5cc37b0443eba55ad13c13d34d6b95ff30dfbfe3"
integrity sha512-bP1LTbcKPOkkmfJOAM6c7WZ0Ov0ZEW6B9keVZ9wH9fw/lBPd9UyDMDCwJ+FAYKz9M9S5pxQeJ4Ebd7WUUrGVAQ==
"@sentry/browser@^5.12.1":
version "5.12.1"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.12.1.tgz#dc1f268595269fb7277f55eb625c7e92d76dc01b"
integrity sha512-Zl7VdppUxctyaoqMSEhnDJp2rrupx8n8N2n3PSooH74yhB2Z91nt84mouczprBsw3JU1iggGyUw9seRFzDI1hw==
dependencies:
"@sentry/core" "5.6.2"
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
"@sentry/core" "5.12.0"
"@sentry/types" "5.12.0"
"@sentry/utils" "5.12.0"
tslib "^1.9.3"
"@sentry/cli@^1.47.1":
version "1.47.1"
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.47.1.tgz#6a3238e5bfa4f618867bc0bc145b8e2ba191ff46"
integrity sha512-WijaRu1lb99OL6rHee6uOSb1wDyNCbrWcTJoRCuZD83K2fw3U58p68nli/y8CoMwQ55Mrg6CgtY8pmBiuseG0A==
"@sentry/cli@^1.51.0":
version "1.51.0"
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.51.0.tgz#2ce7d03b7aebf3f9e9a7186bac1a777fc3dc0e82"
integrity sha512-QXdW3smFW9Wjd5gYHuA9u9tCra87VqpeFljRKdD7D2CwnYCnFDeluVk3l9O8Me6IoVBuL9Uwxx8q1vPtob4n3Q==
dependencies:
fs-copy-file-sync "^1.1.1"
https-proxy-agent "^2.2.1"
https-proxy-agent "^4.0.0"
mkdirp "^0.5.1"
node-fetch "^2.1.2"
progress "2.0.0"
proxy-from-env "^1.0.0"
"@sentry/core@5.6.2":
version "5.6.2"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.6.2.tgz#8c5477654a83ebe41a72e86a79215deb5025e418"
integrity sha512-grbjvNmyxP5WSPR6UobN2q+Nss7Hvz+BClBT8QTr7VTEG5q89TwNddn6Ej3bGkaUVbct/GpVlI3XflWYDsnU6Q==
"@sentry/core@5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.12.0.tgz#d6380c4ef7beee5f418ac1d0e5be86a2de2af449"
integrity sha512-wY4rsoX71QsGpcs9tF+OxKgDPKzIFMRvFiSRcJoPMfhFsTilQ/CBMn/c3bDtWQd9Bnr/ReQIL6NbnIjUsPHA4Q==
dependencies:
"@sentry/hub" "5.6.1"
"@sentry/minimal" "5.6.1"
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
"@sentry/hub" "5.12.0"
"@sentry/minimal" "5.12.0"
"@sentry/types" "5.12.0"
"@sentry/utils" "5.12.0"
tslib "^1.9.3"
"@sentry/hub@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.6.1.tgz#9f355c0abcc92327fbd10b9b939608aa4967bece"
integrity sha512-m+OhkIV5yTAL3R1+XfCwzUQka0UF/xG4py8sEfPXyYIcoOJ2ZTX+1kQJLy8QQJ4RzOBwZA+DzRKP0cgzPJ3+oQ==
"@sentry/hub@5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.12.0.tgz#5e8c8f249f5bdbeb8cc4ec02c2ccc53a67f2cc02"
integrity sha512-3k7yE8BEVJsKx8mR4LcI4IN0O8pngmq44OcJ/fRUUBAPqsT38jsJdP2CaWhdlM1jiNUzUDB1ktBv6/lY+VgcoQ==
dependencies:
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
"@sentry/types" "5.12.0"
"@sentry/utils" "5.12.0"
tslib "^1.9.3"
"@sentry/minimal@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.6.1.tgz#09d92b26de0b24555cd50c3c33ba4c3e566009a1"
integrity sha512-ercCKuBWHog6aS6SsJRuKhJwNdJ2oRQVWT2UAx1zqvsbHT9mSa8ZRjdPHYOtqY3DoXKk/pLUFW/fkmAnpdMqRw==
"@sentry/minimal@5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.12.0.tgz#2611e2aa520c1edb7999e6de51bd65ec66341757"
integrity sha512-fk73meyz4k4jCg9yzbma+WkggsfEIQWI2e2TWfYsRGcrV3RnlSrXyM4D91/A8Bjx10SNezHPUFHjasjlHXOkyA==
dependencies:
"@sentry/hub" "5.6.1"
"@sentry/types" "5.6.1"
"@sentry/hub" "5.12.0"
"@sentry/types" "5.12.0"
tslib "^1.9.3"
"@sentry/types@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.6.1.tgz#5915e1ee4b7a678da3ac260c356b1cb91139a299"
integrity sha512-Kub8TETefHpdhvtnDj3kKfhCj0u/xn3Zi2zIC7PB11NJHvvPXENx97tciz4roJGp7cLRCJsFqCg4tHXniqDSnQ==
"@sentry/types@5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.12.0.tgz#5367e53c74261beea01502e3f7b6f3d822682a31"
integrity sha512-aZbBouBLrKB8wXlztriIagZNmsB+wegk1Jkl6eprqRW/w24Sl/47tiwH8c5S4jYTxdAiJk+SAR10AAuYmIN3zg==
"@sentry/utils@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.6.1.tgz#69d9e151e50415bc91f2428e3bcca8beb9bc2815"
integrity sha512-rfgha+UsHW816GqlSRPlniKqAZylOmQWML2JsujoUP03nPu80zdN43DK9Poy/d9OxBxv0gd5K2n+bFdM2kqLQQ==
"@sentry/utils@5.12.0":
version "5.12.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.12.0.tgz#62967f934a3ee6d21472eac0219084e37225933e"
integrity sha512-fYUadGLbfTCbs4OG5hKCOtv2jrNE4/8LHNABy9DwNJ/t5DVtGqWAZBnxsC+FG6a3nVqCpxjFI9AHlYsJ2wsf7Q==
dependencies:
"@sentry/types" "5.6.1"
"@sentry/types" "5.12.0"
tslib "^1.9.3"
"@sindresorhus/is@^0.14.0":
@ -1261,12 +1261,10 @@ adm-zip@~0.4.x:
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.13.tgz#597e2f8cc3672151e1307d3e95cddbc75672314a"
integrity sha512-fERNJX8sOXfel6qCBCMPvZLzENBEhZTzKqg6vrOW5pvoEaQuJhRU4ndTAh6lHOxn1I6jnz2NHra56ZODM751uw==
agent-base@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
dependencies:
es6-promisify "^5.0.0"
agent-base@5:
version "5.1.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
ajv-errors@^1.0.0:
version "1.0.1"
@ -2615,20 +2613,20 @@ debug@2, debug@2.6.9, debug@^2.1.1, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, de
dependencies:
ms "2.0.0"
debug@^3.1.0, debug@^3.2.6:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
dependencies:
ms "^2.1.1"
debug@^4.0.1, debug@^4.1.0:
debug@4, debug@^4.0.1, debug@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
dependencies:
ms "^2.1.1"
debug@^3.2.6:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
dependencies:
ms "^2.1.1"
decamelize@3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-3.2.0.tgz#84b8e8f4f8c579f938e35e2cc7024907e0090851"
@ -3113,7 +3111,7 @@ es6-promise@^4.0.3:
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
es6-promisify@5.0.0, es6-promisify@^5.0.0:
es6-promisify@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
@ -4296,13 +4294,13 @@ https-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=
https-proxy-agent@^2.2.1:
version "2.2.2"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz#271ea8e90f836ac9f119daccd39c19ff7dfb0793"
integrity sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==
https-proxy-agent@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b"
integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==
dependencies:
agent-base "^4.3.0"
debug "^3.1.0"
agent-base "5"
debug "4"
hyphenate-style-name@^1.0.2:
version "1.0.3"