Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use typescript #194

Merged
merged 46 commits into from
Mar 8, 2022
Merged

feat: use typescript #194

merged 46 commits into from
Mar 8, 2022

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Mar 3, 2022

See the gh-pages gateway checker website from my fork: https://sgtpooki.github.io/public-gateway-checker/

There are a number of changes included in this PR:

  1. Migrated to typescript
  2. Uses ipfs/aegir
  3. Static site is now in /dist, and README.md is updated to reflect that

SgtPooki and others added 28 commits March 2, 2022 10:56
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.5.5...v4.6.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…t-4.6.2

Bump typescript from 4.5.5 to 4.6.2
@SgtPooki SgtPooki requested a review from lidel March 3, 2022 00:47
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up @SgtPooki !

Did a quick pass and noticed some test regressions:

Old This PR
2022-03-03_17-21 2022-03-03_17-21_1

Online column has false-negatives and CORS test does not work at all – is this wip?

package.json Outdated Show resolved Hide resolved
@SgtPooki
Copy link
Member Author

SgtPooki commented Mar 4, 2022

I noticed a few regressions:

  1. "X/X Tested" string appears instantly with changes from this PR. It should only count gateways as they're actually tested.
  2. Cors field "onerror" should be empty on error (@lidel do we want to keep this logic... or should we make the UI consistent by showing X icon or caution?)
  3. Some pending icons (clocks) show forever.
  4. Online column shows X even when actually online

The json was generated by rendering the public-gateway-checker locally, and then running the following snippet in the console:

```javascript
console.log(JSON.stringify(Array.from(document.querySelectorAll('.Node')).map((el) => Array.from(el.querySelectorAll('div')).reduce((acc, item) => {

    let content = item.textContent

    if (item.className.includes('Flag')) {
        content = item.style.getPropertyValue('background-image')
    }
    if (item.className.includes('Took')) {
        // Do not serialized the time it took because it may always change
        return acc
    }
    acc[item.className] = content
    return acc
}, {})).sort((a, b) => {
    if (a.Link > b.Link) return 1
    if (a.Link < b.Link) return -1
    return 0
}), null, 2))
```
@SgtPooki
Copy link
Member Author

SgtPooki commented Mar 5, 2022

@lidel I was able to serialize the results of the site before my changes, and after

I believe the difference lies in the fault of the existing logic, and that I've removed all obvious regressions except for one: The total gateways tested still shows "90/90 tested" on page load, immediately. I'll look into that now, but let me know what you think about the rest.

I also significantly improved the DNS lookup (more intelligent rate-limiting with an additional DNS-query endpoint via google) and the timings of the various asynchronous things. I also replaced two XMLHttpRequest calls with fetch calls. There is only one left, in the expectSubdomainRedirect function.

@SgtPooki SgtPooki requested a review from lidel March 5, 2022 07:09
SgtPooki and others added 4 commits March 4, 2022 23:51
Also fixed online checks. All gateways show online. Verified manually by clicking each link
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SgtPooki LGTM, thank you for cleaning this all up! ❤️

Before we merge this, mind addressing small nits described below?

package.json Outdated Show resolved Hide resolved
src/index.html Show resolved Hide resolved
.github/workflows/build-and-publish-github-pages.yml Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
.github/workflows/js-test-and-release.yml Show resolved Hide resolved
.github/workflows/js-test-and-release.yml Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
SgtPooki and others added 5 commits March 7, 2022 12:33
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
@SgtPooki
Copy link
Member Author

SgtPooki commented Mar 8, 2022

Good to merge now @lidel ?

@SgtPooki SgtPooki requested a review from lidel March 8, 2022 22:39
@SgtPooki SgtPooki merged commit 10958e6 into ipfs:master Mar 8, 2022
@SgtPooki SgtPooki removed the status/in-progress In progress label Mar 14, 2022
github-actions bot pushed a commit that referenced this pull request Apr 17, 2023
## 1.0.0 (2023-04-17)

### Features

* /ipns/ check ([#313](#313)) ([10a5c13](10a5c13))
* add countly metrics ([#309](#309)) ([c727202](c727202))
* add cthd.icu ([#294](#294)) ([a2e0102](a2e0102))
* add https://ipfs.czip.it ([#374](#374)) ([f3dde51](f3dde51))
* add https://ipfs.joaoleitao.org ([#323](#323)) ([787f131](787f131))
* add ipfs.1-2.dev ([#169](#169)) ([c764ad6](c764ad6))
* add ipfs.drink.cafe ([#116](#116)) ([cc84899](cc84899))
* add ipfs.jpu.jp ([#348](#348)) ([b52b8c7](b52b8c7))
* add ipfs.litnet.work ([#222](#222)) ([1fd2e68](1fd2e68))
* add ipfs.pinksheep.whizzzkid.dev ([#326](#326)) ([d40a2c1](d40a2c1))
* add ipfs.soul-network.com ([#389](#389)) ([57fe04d](57fe04d))
* add nftstorage.link gateway ([#204](#204)) ([e588108](e588108))
* add Onion Gateway (TOR)  fzdqwfb5ml56oadins5jpuhe6ki6bk33umri35p5kt2tue4fpws5efid.onion ([#212](#212)) ([01ff12f](01ff12f))
* add w3s.link gateway ([#288](#288)) ([000a26f](000a26f))
* country flags ([#96](#96)) ([84a31fe](84a31fe))
* Create CODEOWNERS ([#283](#283)) ([b62b41c](b62b41c))
* Deleted https://ipfs.czip.it ([#393](#393)) ([77d67a4](77d67a4))
* Implementing Trustless Server Checks ([#310](#310)) ([4a2c926](4a2c926))
* improved Origin detection via img tag ([#117](#117)) ([8407e80](8407e80))
* improved origin isolation check ([#148](#148)) ([abd4c1c](abd4c1c))
* Introducing Service Worker For Cache Busting ([#357](#357)) ([0536782](0536782))
* new gateway https://ipfs.tayfundogdas.me/ipfs ([#321](#321)) ([9d5b552](9d5b552))
* remove ipfs.foxgirl.dev ([#155](#155)) ([15fd028](15fd028))
* remove smartsignature.io ([#146](#146)) ([77b45b6](77b45b6))
* subdomain gateways and Origin isolation check ([#78](#78)) ([afcbffa](afcbffa))
* update geoip dataset (2020-10-13) ([4187738](4187738))
* update geoip dataset (2020-10-13) ([#115](#115)) ([782b66b](782b66b))
* use typescript ([#194](#194)) ([10958e6](10958e6))

### Bug Fixes

* ⏪ Reverting [#323](#323): ipfs.joaoleitao.org ([#394](#394)) ([b5bb34c](b5bb34c))
* **ci:** add empty commit to fix lint checks on master ([3ae6aa0](3ae6aa0))
* **ci:** skip test if no code changed ([#210](#210)) ([7d6d628](7d6d628))
* cleanup entries missing DNS A record ([#180](#180)) ([2b7ad30](2b7ad30))
* do not redirect IPNS checks ([#325](#325)) ([79bb51d](79bb51d))
* flag column and new ipfs-geoip dataset ([#319](#319)) ([f5fc723](f5fc723))
* metrics consent prompt location and styling ([#353](#353)) ([e709f2b](e709f2b))
* npm start should work without prior cmds ([#307](#307)) ([7ebe2e5](7ebe2e5))
* opt-out from redirects done by browser extension ([6dd5f51](6dd5f51))
* origin typo ([#200](#200)) ([d198abb](d198abb))
* **origin:** confirm paths redirect to subdomain ([#156](#156)) ([b837a35](b837a35))
* remove heart ([#332](#332)) ([f61ec84](f61ec84))
* update ipfs.ivoputzer.xyz gateway entry ([#152](#152)) ([4b760d9](4b760d9))
* update metrics collection banner to modal with management toggle settings ([#373](#373)) ([d925b36](d925b36))
* update redirect opt-out symbol to final version ([efd5dbf](efd5dbf))

### Trivial Changes

* **deps-dev:** bump aegir from 36.2.3 to 37.5.5 ([#305](#305)) ([1d62fc3](1d62fc3))
* **deps-dev:** bump aegir from 37.5.5 to 37.5.6 ([#316](#316)) ([d3cd9bd](d3cd9bd))
* **deps-dev:** bump browserslist from 4.19.3 to 4.21.4 ([#295](#295)) ([7850071](7850071))
* **deps-dev:** bump eslint-config-ipfs from 2.1.0 to 3.1.1 ([#300](#300)) ([f1bce91](f1bce91))
* **deps-dev:** bump eslint-config-ipfs from 3.1.1 to 3.1.2 ([#315](#315)) ([0506c19](0506c19))
* **deps-dev:** bump ipfs from 0.62.1 to 0.64.2 ([#296](#296)) ([d47e503](d47e503))
* **deps-dev:** bump ipfs from 0.64.2 to 0.65.0 ([#322](#322)) ([b400349](b400349))
* **deps-dev:** bump typescript from 4.6.2 to 4.8.3 ([#293](#293)) ([c56afa1](c56afa1))
* **deps-dev:** bump typescript from 4.8.3 to 4.8.4 ([#304](#304)) ([899b4fc](899b4fc))
* **deps:** bump @dutu/rate-limiter from v1.3.0 to v1.3.1 ([#299](#299)) ([5e598e8](5e598e8))
* **deps:** bump aegir from 36.1.3 to 36.2.3 ([#202](#202)) ([8fa5851](8fa5851))
* **deps:** bump jpeg-js from 0.4.3 to 0.4.4 ([#253](#253)) ([65f99f3](65f99f3))
* **deps:** ipfs-http-client@58.0.1 ([#308](#308)) ([1bcda7c](1bcda7c))
* improve submission/PR info ([#119](#119)) ([a238f3f](a238f3f))
* improved security notes ([#151](#151)) ([5893f35](5893f35)), closes [#148](#148) [/github.com//pull/151#issuecomment-857193370](https://github.com/ipfs//github.com/ipfs/public-gateway-checker/pull/151/issues/issuecomment-857193370)
* ipfs-geoip v5 ([0d8091e](0d8091e))
* ipfs-geoip@8.0.0 ([c4e8180](c4e8180))
* readme cleanup ([798777e](798777e))
* remove dead hostnames ([#280](#280)) ([e861280](e861280))
* remove expired domains ([#179](#179)) ([16c9985](16c9985))
* remove ipfs-zod.tv ([#234](#234)) ([6f79a80](6f79a80))
* removed birds-are-nice.me ([#173](#173)) ([ff2e05c](ff2e05c)), closes [#172](#172)
* removing my gateway for now ([#335](#335)) ([cf61e68](cf61e68))
* style formatting and linting fixes ([#366](#366)) ([a81d48b](a81d48b))
* Update .github/workflows/stale.yml [skip ci] ([5fc4a68](5fc4a68))
* update readme with link to fleek ([#337](#337)) ([3dc5dbe](3dc5dbe))
ipfs-mgmt-read-write bot added a commit that referenced this pull request Jun 14, 2023
* migrate classes to separate typescript files

* fixed all typescript errors

* add aegir

* compile new app.js: npx tsc

* add vscode config

* move app.js to dist/

* chore: improve dev setup

* chore: fix with aegir lint -f

* chore: replace all tab characters

* chore: fix majority of lint errors

* chore: clean up comments & fix docs

* run check-aegir-project

* remove docker publish action

* use dist folder

* publish github pages on push to master branch

* deploy to gh-pages on merge to master

* remove release job

* temporarily disable running test scripts

* clock icon no longer blocks flag icon

* create npm start script

* minor refactor, misc improvements; dep updates

* fix a few UI issues

* Bump typescript from 4.5.5 to 4.6.2

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.5.5...v4.6.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* feat: use jsipfs to publish to ipfs

* chore: fix package.json 'main' and 'files'

* fix: correct aegir settings & type failures

* use gh-pages

* fix: Cors onerror clears Tag

* revert ipfs client and ipfs-geoip versions

* CORS results update correctly

* All checks are async

* Online icon displays globe on success

* minor touchup

* commit serialized version of site before changes

The json was generated by rendering the public-gateway-checker locally, and then running the following snippet in the console:

```javascript
console.log(JSON.stringify(Array.from(document.querySelectorAll('.Node')).map((el) => Array.from(el.querySelectorAll('div')).reduce((acc, item) => {

    let content = item.textContent

    if (item.className.includes('Flag')) {
        content = item.style.getPropertyValue('background-image')
    }
    if (item.className.includes('Took')) {
        // Do not serialized the time it took because it may always change
        return acc
    }
    acc[item.className] = content
    return acc
}, {})).sort((a, b) => {
    if (a.Link > b.Link) return 1
    if (a.Link < b.Link) return -1
    return 0
}), null, 2))
```

* serialize changes after update

* fix origin checks

* #/# tested correctly updates

Also fixed online checks. All gateways show online. Verified manually by clicking each link

* runaway fixes...

* Update package.json

Co-authored-by: Marcin Rataj <lidel@lidel.org>

* Update .github/workflows/js-test-and-release.yml

Co-authored-by: Marcin Rataj <lidel@lidel.org>

* Update .github/workflows/build-and-publish-github-pages.yml

Co-authored-by: Marcin Rataj <lidel@lidel.org>

* use versioned rate-limter pkg

* comment out test github actions

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
github-actions bot pushed a commit that referenced this pull request Jun 14, 2023
## [1.3.0](v1.2.2...v1.3.0) (2023-06-14)

### Features

* use typescript ([#194](#194)) ([9bbe1b5](9bbe1b5))

### Trivial Changes

* Update .github/workflows/stale.yml [skip ci] ([25aecd9](25aecd9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants