Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlice committed Jul 30, 2023
1 parent 938ddae commit 6e41c68
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
logs
*.log
npm-debug.log*

**/ghost/*
# Runtime data
pids
*.pid
Expand Down Expand Up @@ -66,4 +66,4 @@ dist

node_modules/*
.env
serviceaccount.json
serviceaccount.json
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"
services:
search:
image: ghcr.io/askalice/search.emu.sh:master
restart: always
ports:
- "3006:8080"
env_file:
- .env
Binary file modified src/GeoLite2-City.mmdb
Binary file not shown.
7 changes: 5 additions & 2 deletions src/routes/suggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ const fetchResult = async (signal, request, reply) => {
if (await maxmind.validate(ip)) {
const lookup = await maxmind.open<CityResponse>("./src/GeoLite2-City.mmdb");
geolocation = await lookup.get(ip);
console.log(JSON.stringify(geolocation))
}
console.log("hmm");
results.push({
Expand Down Expand Up @@ -349,18 +350,20 @@ const fetchResult = async (signal, request, reply) => {
} catch (e) {
console.error(e.message);
}
console.log("results length", results.length);
if (results.length === 0) {
results = await new Promise<Array<any>>((resolve, reject) => {
const options = {
Method: "GET",
url: "https://www.google.com/complete/search",
params: googleQuery,
headers: {
"x-client-data": "CJS2yQEIpbbJAQjEtskBCKmdygEIvY7LAQjQmssBCKCgywEI5/HLAQis8ssBCN3yywEI6fLLAQjv98sBCJn4ywEItPjLAQie+csBGI6eywEYuvLLARjf+csB",
"x-client-data": "CKu1yQEIhbbJAQijtskBCKqdygEIm9/KAQiWocsBCPmKzQEIlo3NAQjtkc0BCIKTzQEIh5XNAQiXmM0BCNugzQEIgKbNAQjQp80BCLepzQEI5avNAQisr80BCNW0zQEI1LXNAQjqts0BCI+4zQEI27jNAQiXuc0BCIm6zQEIubvNAQiwvM0BCO+8zQEInr3NAQi4vc0BCMG9zQEI4r3NARikr80BGOmyzQE=",
"sec-fetch-site": "none",
"sec-fetch-mode": "no-cors",
"sec-fetch-dest": "empty",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.9",
cookie: "cgic=IgMqLyo",
},
Expand Down

0 comments on commit 6e41c68

Please sign in to comment.