add todos and small changes

This commit is contained in:
Jurgis Sakalauskas
2023-07-07 16:12:29 +03:00
parent daaeda539b
commit 27f76a08f0
10 changed files with 2401 additions and 2891 deletions
@@ -27,7 +27,6 @@ export class LrtApiSearchClient {
const loadedCategories = new Set();
//todo - move to mapper
const responseDto = new SearchResponseDto(
parseInt(searchResponse.page),
parseInt(searchResponse.total_found),
+3 -1
View File
@@ -337,7 +337,9 @@ export class TorrentService {
.catch(() => false);
return new NotificationResponse(
result ? 'torrent deleted' : 'deleting from wt not implemented',
result
? 'torrent deleted'
: 'deleting from wt not implemented, \nadd to transmission and delete',
true,
);
}
+1
View File
@@ -20,6 +20,7 @@ export class RequestLogMiddleware implements NestMiddleware {
strIP = strRemoteAddress.substring(strRemoteAddress.lastIndexOf(':') + 1);
}
//todo - x-forwarded-for
if (!strIP || strIP === '1') {
if (req.hostname === 'localhost') {
strIP = '127.0.0.1';
+1 -1
View File
@@ -49,7 +49,7 @@ export class FileEntity {
transmissionId: number;
@Column()
linkomanija: boolean;
linkomanija: boolean; //todo - not linkomanija, but mustSeed (e.g. for torrentleech also)
@Column({ name: 'torrent_id' })
torrentId: number;
@@ -14,7 +14,7 @@ import { TorrentSeedClient } from '../../SeedClient/torrent-seed.client';
@Injectable()
export class WebtorrentClient {
private client: Instance;
private readonly torrentOptions: TorrentOptions;
//private readonly torrentOptions: TorrentOptions;
private readonly configService = configService.getVideoFilesConfig();
constructor(
@@ -27,9 +27,25 @@ export class WebtorrentClient {
) {
this.client = new WebTorrent();
this.torrentOptions = {};
this.torrentOptions.path = this.configService.getTorrentDownloadDir();
this.torrentOptions.getAnnounceOpts = function() {
// this.torrentOptions = {};
// this.torrentOptions.path = this.configService.getTorrentDownloadDir();
// this.torrentOptions.getAnnounceOpts = function() {
// const that = this as Torrent;
//
// return {
// uploaded: 0, //this.uploaded,
// downloaded: 0, //this.downloaded,
// left: that.length, //Math.max(this.length - this.downloaded, 0)
// };
// };
this.resumeNotStopped();
}
getNewTorrentOptions(): TorrentOptions {
const torrentOptions: Record<string, any> = {};
torrentOptions.path = this.configService.getTorrentDownloadDir();
torrentOptions.getAnnounceOpts = function () {
const that = this as Torrent;
return {
@@ -39,7 +55,7 @@ export class WebtorrentClient {
};
};
this.resumeNotStopped();
return torrentOptions;
}
resumeNotStopped(): void {
@@ -123,7 +139,7 @@ export class WebtorrentClient {
return new Promise((resolve, reject) => {
const torrent = this.client.add(
torrentEntity.magnet,
this.torrentOptions,
this.getNewTorrentOptions(),
);
torrent.on('ready', () => {
@@ -3,6 +3,7 @@ import { LinkomanijaClient } from './linkomanija.client';
import { LinkomanijaHttpClient } from './HttpClient/linkomanija-http.client';
import { LinkomanijaResponseParser } from './ResponseParser/linkomanija-response.parser';
//todo - make this as separate library
@Module({
imports: [],
providers: [
+12 -1
View File
@@ -1,9 +1,20 @@
import { Controller, Get } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { InjectDataSource } from '@nestjs/typeorm';
@Controller('try')
export class TryController {
constructor(@InjectDataSource() private readonly ds: DataSource) {}
@Get('')
main() {
return { hello: 'world' };
//return this.ds.query('select category_url from lrt_categories where category_id = $1', ['2720']);
// return this.ds
// .createQueryBuilder()
// .select()
// .from(null, 'lrt_categories')
// .getMany();
return this.ds.query('select * from lrt_categories');
//return { hello: 'world' };
}
}