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

Build: release shotit-api v0.9.11 #101

Merged
merged 6 commits into from
Jun 17, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/shotit/shotit-api/docker-image.yml?style=flat-square)](https://github.com/shotit/shotit-api/actions)
[![Codecov](https://img.shields.io/codecov/c/github/shotit/shotit-api?style=flat-square&token=8C25WLSEDJ)](https://codecov.io/gh/shotit/shotit-api)
[![Docker](https://img.shields.io/docker/pulls/lesliewong007/shotit-api?style=flat-square)](https://hub.docker.com/r/lesliewong007/shotit-api)
[![Docker Image Size](https://img.shields.io/docker/image-size/lesliewong007/shotit-api/v0.9.10?style=flat-square)](https://hub.docker.com/r/lesliewong007/shotit-api)
[![Docker Image Size](https://img.shields.io/docker/image-size/lesliewong007/shotit-api/v0.9.11?style=flat-square)](https://hub.docker.com/r/lesliewong007/shotit-api)

The ultimate brain of [shotit](https://github.com/shotit/shotit), in charge of task coordination.

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shotit-api",
"version": "0.9.10",
"version": "0.9.11",
"description": "The ultimate brain of shotit, in charge of task coordination",
"main": "server.js",
"type": "module",
Expand Down Expand Up @@ -48,6 +48,7 @@
"mysql": "^2.18.1",
"node-fetch": "^3.3.0",
"nodemailer": "^6.9.3",
"public-ip": "^6.0.2",
"redis": "^4.6.7",
"rss": "^1.2.2",
"ws": "^8.12.0"
Expand Down
14 changes: 13 additions & 1 deletion src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FormData from "form-data";
import aniep from "aniep";
import cv from "@soruly/opencv4nodejs-prebuilt";
import { performance } from "perf_hooks";
import { publicIpv6 } from "public-ip";
// import getSolrCoreList from "./lib/get-solr-core-list.js";

// const { TRACE_MEDIA_URL, TRACE_MEDIA_SALT, TRACE_ACCURACY = 1 } = process.env;
Expand Down Expand Up @@ -52,6 +53,14 @@ const search = async (image) => {
return [response];
};

let isIpv6 = false;
try {
isIpv6 = Boolean(await publicIpv6());
} catch (error) {
console.log(error);
isIpv6 = false;
}

const logAndDequeue = async (knex, redis, uid, priority, status, searchTime, accuracy) => {
if (status === 200) {
const searchCountCache = await knex("search_count").where({ uid: `${uid}` });
Expand Down Expand Up @@ -178,7 +187,10 @@ export default async (req, res) => {
"media.trace.moe",
].includes(new URL(req.query.url).hostname)
? req.query.url
: `https://trace.moe/image-proxy?url=${encodeURIComponent(req.query.url)}`
: `https://trace.moe/image-proxy?url=${encodeURIComponent(req.query.url)}`,
{
family: isIpv6 ? 6 : 4,
}
).catch((e) => {
console.log(e);
return { status: 400 };
Expand Down
Loading
Loading