Compare commits

...

9 Commits

Author SHA1 Message Date
de68cb23dd 索引更多数据 2023-10-21 11:18:39 +08:00
c07211706b 索引更多数据 2023-10-21 11:05:25 +08:00
f232c612bf 索引更多数据 2023-10-20 18:02:44 +08:00
86ebef7b5c 索引更多数据 2023-10-20 17:37:44 +08:00
499bc19be5 索引更多数据 2023-10-20 15:40:29 +08:00
e1c57cb63d 索引更多数据 2023-10-19 18:52:55 +08:00
dcbbae4603 优化搜索长度 2023-09-06 10:04:32 +08:00
954af8537b 优化 2023-09-06 09:58:44 +08:00
eb7ce30da9 setTimeout 2023-09-06 00:00:14 +08:00
4 changed files with 1167 additions and 38 deletions

View File

@ -3,7 +3,6 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app WORKDIR /home/node/app
COPY --chown=node:node . . COPY --chown=node:node . .
RUN npm install -g npm
USER node USER node
RUN npm install --force RUN npm install --force

View File

@ -15,7 +15,8 @@ window.__ = __
if(typeof WEB !== 'undefined') if(typeof WEB !== 'undefined')
{ {
const io = require("socket.io-client"); const io = require("socket.io-client");
window.torrentSocket = io(document.location.protocol + '//' + document.location.hostname + (process.env.NODE_ENV === 'production' ? '/' : ':8095/')); // window.torrentSocket = io(document.location.protocol + '//' + document.location.hostname + (process.env.NODE_ENV === 'production' ? '/' : ':8095/'));
window.torrentSocket = io(document.location.protocol + '//' + document.location.host + '/');
const emit = window.torrentSocket.emit.bind(window.torrentSocket); const emit = window.torrentSocket.emit.bind(window.torrentSocket);
window.torrentSocket.emit = (...data) => { window.torrentSocket.emit = (...data) => {
let id; let id;

View File

@ -285,7 +285,7 @@ module.exports = async ({
if(typeof callback != 'function') if(typeof callback != 'function')
return; return;
if(!text || text.length <= 2) { if(!text || text.length < 2) {
callback(undefined); callback(undefined);
return; return;
} }
@ -347,7 +347,7 @@ module.exports = async ({
{ {
logT('search', 'get torrent via infohash with dht') logT('search', 'get torrent via infohash with dht')
// 3 try to get torrent from metadata // 3 try to get torrent from metadata
const getTorrentMetadata = (tryCount = 4) => { const getTorrentMetadata = (tryCount = 8) => {
if(tryCount <= 0) { if(tryCount <= 0) {
logT('search', 'dht NOT found anything with dht', text); logT('search', 'dht NOT found anything with dht', text);
return return
@ -356,7 +356,7 @@ module.exports = async ({
dhtCheckTimeout = setTimeout(() => { dhtCheckTimeout = setTimeout(() => {
lock = true lock = true
getTorrentMetadata(--tryCount) getTorrentMetadata(--tryCount)
}, 8000); }, 16000);
torrentClient.getMetadata(text, (torrent) => { torrentClient.getMetadata(text, (torrent) => {
if(lock) { if(lock) {
logT('search', 'this dht response not actual for', text); logT('search', 'this dht response not actual for', text);
@ -407,7 +407,7 @@ module.exports = async ({
if(typeof callback != 'function') if(typeof callback != 'function')
return; return;
if(!text || text.length <= 2) { if(!text || text.length < 2) {
callback(undefined); callback(undefined);
return; return;
} }

File diff suppressed because it is too large Load Diff