Compare commits
No commits in common. "b99f1129a3a614559239fd2836d3389bab04ce45" and "eba2472f2fdc7712071b586be519ceb9030692f6" have entirely different histories.
b99f1129a3
...
eba2472f2f
1
package-lock.json
generated
1
package-lock.json
generated
@ -11,6 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nostr-dev-kit/ndk": "^0.8.1",
|
"@nostr-dev-kit/ndk": "^0.8.1",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"debug": "^4.3.4",
|
||||||
"file-type": "^18.5.0",
|
"file-type": "^18.5.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"form-data-encoder": "^3.0.0",
|
"form-data-encoder": "^3.0.0",
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nostr-dev-kit/ndk": "^0.8.1",
|
"@nostr-dev-kit/ndk": "^0.8.1",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"debug": "^4.3.4",
|
||||||
"file-type": "^18.5.0",
|
"file-type": "^18.5.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"form-data-encoder": "^3.0.0",
|
"form-data-encoder": "^3.0.0",
|
||||||
|
@ -13,7 +13,10 @@ importers:
|
|||||||
version: 0.8.1(typescript@5.0.4)
|
version: 0.8.1(typescript@5.0.4)
|
||||||
axios:
|
axios:
|
||||||
specifier: ^1.4.0
|
specifier: ^1.4.0
|
||||||
version: 1.4.0
|
version: 1.4.0(debug@4.3.4)
|
||||||
|
debug:
|
||||||
|
specifier: ^4.3.4
|
||||||
|
version: 4.3.4
|
||||||
file-type:
|
file-type:
|
||||||
specifier: ^18.5.0
|
specifier: ^18.5.0
|
||||||
version: 18.5.0
|
version: 18.5.0
|
||||||
@ -31,7 +34,7 @@ importers:
|
|||||||
version: 3.0.0
|
version: 3.0.0
|
||||||
lnbits:
|
lnbits:
|
||||||
specifier: ^1.1.5
|
specifier: ^1.1.5
|
||||||
version: 1.1.5
|
version: 1.1.5(debug@4.3.4)
|
||||||
tslib:
|
tslib:
|
||||||
specifier: ~2.5
|
specifier: ~2.5
|
||||||
version: 2.5.3
|
version: 2.5.3
|
||||||
@ -3595,15 +3598,15 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
possible-typed-array-names: 1.0.0
|
possible-typed-array-names: 1.0.0
|
||||||
|
|
||||||
axios@0.21.4:
|
axios@0.21.4(debug@4.3.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
follow-redirects: 1.15.2
|
follow-redirects: 1.15.2(debug@4.3.4)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- debug
|
- debug
|
||||||
|
|
||||||
axios@1.4.0:
|
axios@1.4.0(debug@4.3.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
follow-redirects: 1.15.2
|
follow-redirects: 1.15.2(debug@4.3.4)
|
||||||
form-data: 4.0.0
|
form-data: 4.0.0
|
||||||
proxy-from-env: 1.1.0
|
proxy-from-env: 1.1.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@ -4266,7 +4269,9 @@ snapshots:
|
|||||||
|
|
||||||
flatted@3.2.7: {}
|
flatted@3.2.7: {}
|
||||||
|
|
||||||
follow-redirects@1.15.2: {}
|
follow-redirects@1.15.2(debug@4.3.4):
|
||||||
|
optionalDependencies:
|
||||||
|
debug: 4.3.4
|
||||||
|
|
||||||
for-each@0.3.3:
|
for-each@0.3.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -4937,9 +4942,9 @@ snapshots:
|
|||||||
|
|
||||||
lines-and-columns@1.2.4: {}
|
lines-and-columns@1.2.4: {}
|
||||||
|
|
||||||
lnbits@1.1.5:
|
lnbits@1.1.5(debug@4.3.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
axios: 0.21.4
|
axios: 0.21.4(debug@4.3.4)
|
||||||
typescript: 4.9.5
|
typescript: 4.9.5
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- debug
|
- debug
|
||||||
|
@ -2,7 +2,6 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'
|
|||||||
import { log } from '../main.js'
|
import { log } from '../main.js'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { RelayInfo } from '../types/index.js'
|
import { RelayInfo } from '../types/index.js'
|
||||||
import https from 'https'
|
|
||||||
|
|
||||||
export const relayInfoJob = async (event: NDKEvent): Promise<string> => {
|
export const relayInfoJob = async (event: NDKEvent): Promise<string> => {
|
||||||
log('New relay-info job', event.rawEvent())
|
log('New relay-info job', event.rawEvent())
|
||||||
@ -23,15 +22,8 @@ export const relayInfoJob = async (event: NDKEvent): Promise<string> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const prefixes = { wss: 'wss://', https: 'https://', http: 'http://' }
|
const prefixes = { wss: 'wss://', https: 'https://', http: 'http://' }
|
||||||
|
const headers = {
|
||||||
// Relay may have outdated certificate 'rejectUnauthorized: false' will prevent
|
headers: { Accept: 'application/nostr+json' }
|
||||||
// throwing ann error on request
|
|
||||||
const agent = new https.Agent({
|
|
||||||
rejectUnauthorized: false
|
|
||||||
})
|
|
||||||
const config = {
|
|
||||||
headers: { Accept: 'application/nostr+json' },
|
|
||||||
httpsAgent: agent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const requests = relays.map((relay) => {
|
const requests = relays.map((relay) => {
|
||||||
@ -40,12 +32,12 @@ export const relayInfoJob = async (event: NDKEvent): Promise<string> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get<RelayInfo>((relay = `${prefixes.https}${relay}`), config)
|
.get<RelayInfo>((relay = `${prefixes.https}${relay}`), headers)
|
||||||
.catch(() =>
|
.catch(() => {
|
||||||
axios
|
return axios
|
||||||
.get<RelayInfo>(`${prefixes.http}${relay}`, config)
|
.get<RelayInfo>(`${prefixes.http}${relay}`, headers)
|
||||||
.catch(() => undefined)
|
.catch(() => undefined)
|
||||||
)
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
let responses = await Promise.all(requests)
|
let responses = await Promise.all(requests)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import NDK, { NDKEvent } from '@nostr-dev-kit/ndk'
|
import NDK, { NDKEvent } from '@nostr-dev-kit/ndk'
|
||||||
|
import debug from 'debug'
|
||||||
import { onNewSummarizationJob } from './job-types/summarization.js'
|
import { onNewSummarizationJob } from './job-types/summarization.js'
|
||||||
import { complete, speechToTextJob } from './job-types/speech-to-text.js'
|
import { complete, speechToTextJob } from './job-types/speech-to-text.js'
|
||||||
import getSigner from './local-signer.js'
|
import getSigner from './local-signer.js'
|
||||||
@ -13,7 +14,7 @@ import { blockChainBlockNumberJob } from './job-types/blockChain-block-number.js
|
|||||||
import { relayInfoJob } from './job-types/relay-info.js'
|
import { relayInfoJob } from './job-types/relay-info.js'
|
||||||
import { JobType, JobTypes } from './types/index.js'
|
import { JobType, JobTypes } from './types/index.js'
|
||||||
|
|
||||||
export const log = (obj1: any, obj2?: any) => console.log(obj1, obj2 || '')
|
export const log = debug('fool-me-once-dvm')
|
||||||
|
|
||||||
export const configFile =
|
export const configFile =
|
||||||
process.argv[2] || `${process.env.HOME}/.fool-me-once.json`
|
process.argv[2] || `${process.env.HOME}/.fool-me-once.json`
|
||||||
|
Loading…
Reference in New Issue
Block a user