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

fix: flag column and new ipfs-geoip dataset #319

Merged
merged 9 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
986 changes: 468 additions & 518 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@
},
"dependencies": {
"@dutu/rate-limiter": "github:dutu/rate-limiter#v1.3.1",
"url-ponyfill": "^0.5.10",
"ipfs-http-client": "^58.0.1"
"url-ponyfill": "^0.5.10"
},
"devDependencies": {
"aegir": "^37.5.6",
Expand All @@ -130,7 +129,7 @@
"eslint-plugin-compat": "^4.0.2",
"fetch-ponyfill": "^7.1.0",
"ipfs": "^0.64.2",
"ipfs-geoip": "^8.0.0",
"ipfs-geoip": "^9.0.0",
"typescript": "^4.8.4"
},
"aegir": {
Expand Down
7 changes: 4 additions & 3 deletions src/Flag.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { GatewayNode } from './GatewayNode'
import { Log } from './Log'
import { lookup as IpfsGeoIpLookup } from 'ipfs-geoip'
import { UiComponent } from './UiComponent'
import { ipfsHttpClient } from './ipfsHttpClient'
import { TokenBucketLimiter } from '@dutu/rate-limiter'
import { DEFAULT_IPFS_GATEWAY } from './constants'

const log = new Log('Flag')

Expand Down Expand Up @@ -88,7 +89,7 @@ class Flag extends UiComponent {

await this.handleDnsQueryResponse(responseJson)
} catch (err) {
log.error('problem submitting DNS request', err)
log.error('problem submitting DNS request', url, err)
this.onError()
}
}
Expand All @@ -107,7 +108,7 @@ class Flag extends UiComponent {
}
if (ip != null) {
try {
const geoipResponse = await window.IpfsGeoip.lookup(ipfsHttpClient, ip)
const geoipResponse = await IpfsGeoIpLookup(DEFAULT_IPFS_GATEWAY, ip)

if (geoipResponse?.country_code != null) {
this.onResponse(geoipResponse)
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ const IMG_HASH = 'bafybeibwzifw52ttrkqlikfzext5akxu7lz4xiwjgwzmqcpdzmp3n5vnbe' /
// const IFRAME_HASH = 'bafkreifx3g6bkkwl7b4v43lvcqfo5vshbiehuvmpky2zayhfpg5qj7y3ca'
const HASH_STRING = 'Hello from IPFS Gateway Checker'
const TRUSTLESS_RESPONSE_TYPES = ['raw', 'car']
const DEFAULT_IPFS_GATEWAY = 'https://ipfs.io'

export {
DEFAULT_IPFS_GATEWAY,
HASH_STRING,
HASH_TO_TEST,
// IFRAME_HASH,
Expand Down
4 changes: 1 addition & 3 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// import type { Checker } from './Checker'

declare module '@dutu/rate-limiter'
declare module 'ipfs-geoip'

// declare global {
/**
Expand All @@ -30,11 +31,8 @@ interface Visible {
}

interface Window {
IpfsHttpClient: typeof import('ipfs-http-client')
IpfsGeoip: typeof import('ipfs-geoip')
OnScriptloaded: typeof import('./onScriptLoaded').onScriptLoaded
checker: import('./Checker').Checker
client: ReturnValue<typeof import('ipfs-http-client').create>
}

declare namespace IpfsGeoip {
Expand Down
4 changes: 0 additions & 4 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tachyons@4.11.1/css/tachyons.min.css" integrity="sha256-XiJ+PedljEmPP2VaQzSzekfCZdPr0fpqmh9dY6kpsuQ=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ipfs-css@0.13.1/ipfs.css" integrity="sha256-crEOQ/1aKoWgku50e0aqNzt0Tt/ev2C97PV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FL/nplD/8vDZf+emUP/AAAAAAAAAACWjz3/op5G/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav+inkb/nplD/wAAAAAAAAAAAAAAAKKeRv+3slb/0cpq/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav+1sFX/op5G/wAAAAAAAAAAAAAAAAAAAAAAAAAAop5GUKKeRv/Nxmf/0cpq/9HKav/Rymr/0cpq/83GZ/+inkb/op5GSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAop5G16KeRv/LxWb/y8Vm/6KeRv+inkaPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAop5G/6KeRtcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/n8AAPgfAADwDwAAwAMAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAwAMAAPAPAAD4HwAA/n8AAA==" />
<!-- <script src="https://cdn.jsdelivr.net/npm/ipfs-http-client@56/index.min.js" integrity="sha384-nQtRd3sp3e41qrWYq2Kdr4uYrAYYFjpjVG8M76OR39X6ythvU/tl3ZBmMUtS54o+" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/ipfs-geoip@7/dist/index.min.js" integrity="sha384-xRhSHsWz2C384OynfHjLg113EXg3fohlDdASs7o6gCxkW1/nfciC5WynCV/s1Bpt" crossorigin="anonymous"></script> -->
<script src="https://cdn.jsdelivr.net/npm/ipfs-geoip@6.0.0/dist/index.min.js" integrity="sha256-Vhr0hZsdmsT81gd4u2bs3bLYLfDdr46nvcI/VaT9YZ4=" crossorigin="anonymous"></script>

Comment on lines -13 to -16
Copy link
Member

Choose a reason for hiding this comment

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

+1

<link href="styles.css?v=0.4" type="text/css" rel="stylesheet"/>
</head>
<body id="checker" class="sans-serif charcoal bg-snow-muted">
Expand Down
9 changes: 0 additions & 9 deletions src/ipfsHttpClient.ts

This file was deleted.