Skip to content

Commit

Permalink
fix(test): correct lookup.ts file import
Browse files Browse the repository at this point in the history
Update keywords in package.json and README.md
  • Loading branch information
hckhanh committed Mar 1, 2024
1 parent a283319 commit ec626b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ You can go to [Releases](https://github.com/hckhanh/google-safe-browsing/release

> [!NOTE]
> The Safe Browsing API is for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial
> purposes - meaning 'for sale or revenue-generating purposes' - please refer to the [Web Risk API](https://github.com/hckhanh/web-risk).
> purposes - meaning 'for sale or revenue-generating purposes' - please refer to the [Web Risk API](https://github.com/hckhanh/google-web-risk).
30 changes: 6 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,12 @@
},
"license": "MIT",
"keywords": [
"reader",
"read",
"number",
"vn",
"vietnam",
"vietnamese",
"vietnamese-language",
"vietnamese-currency",
"currency",
"vnd",
"vn-lang",
"lang",
"language",
"languages",
"language-processing",
"text-generation",
"helper",
"helpers",
"helpers-library",
"helper-tool",
"helper-methods",
"helper-class",
"helper-functions",
"helper-script"
"google",
"safe browsing",
"browsing",
"safe",
"api",
"url"
],
"devDependencies": {
"@edge-runtime/vm": "3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/lookup.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { findThreadMatches } from './lookup.js'
import { findThreadMatches } from './lookup.ts'

const apiKey = process.env.GOOGLE_SAFE_BROWSING_API_KEY as string

Expand Down
7 changes: 5 additions & 2 deletions src/lookup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ClientInfo, ThreatInfo, ThreatMatch } from './types.ts'
import { endpoint } from './configs.js'
import { endpoint } from './configs.ts'

type FindThreadMatchesRequest = {
client: ClientInfo
Expand All @@ -10,6 +10,9 @@ type FindThreadMatchesRequest = {
* The threat list matches. This may be empty if the client's threat list is empty.
*/
type FindThreadMatchesResponse = {
/**
* The threat list matches.
*/
matches: ThreatMatch[]
}

Expand All @@ -26,8 +29,8 @@ export async function findThreadMatches(
request: FindThreadMatchesRequest,
): Promise<FindThreadMatchesResponse> {
const res = await fetch(`${endpoint}/threatMatches:find?key=${apiKey}`, {
headers: { 'Content-Type': 'application/json' },
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request),
})

Expand Down

0 comments on commit ec626b6

Please sign in to comment.