Compare commits
3 Commits
37149c83c4
...
feature/ma
| Author | SHA1 | Date | |
|---|---|---|---|
| 55e729422b | |||
| 2660aef473 | |||
| 7eff09765b |
@@ -6,6 +6,6 @@
|
|||||||
<h1>Update not available</h1>
|
<h1>Update not available</h1>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<app-header (searchEvent)="onSearch($event)"></app-header>
|
<app-header></app-header>
|
||||||
<div class="h-10"></div>
|
<div class="h-10"></div>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import { Component } from "@angular/core";
|
|||||||
import { RouterModule } from "@angular/router";
|
import { RouterModule } from "@angular/router";
|
||||||
import { AppService } from "./app.service";
|
import { AppService } from "./app.service";
|
||||||
import { HeaderComponent } from "./components/header/header.component";
|
import { HeaderComponent } from "./components/header/header.component";
|
||||||
import { LibSocialParserService } from "./services/parsers/rulib/lib.social.parser.service";
|
import { Datum } from "./services/parsers/rulib/rulib.search.dto";
|
||||||
import { Datum } from "./services/parsers/rulib/rulib.dto";
|
|
||||||
import { SearchService } from "./services/search.service";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -17,11 +15,7 @@ import { SearchService } from "./services/search.service";
|
|||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
title = "NwaifuAnime";
|
title = "NwaifuAnime";
|
||||||
items: Datum[] = [];
|
items: Datum[] = [];
|
||||||
constructor(
|
constructor(private sw: AppService) {}
|
||||||
private sw: AppService,
|
|
||||||
private parser: LibSocialParserService,
|
|
||||||
private searchService: SearchService,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
get hasUpdate() {
|
get hasUpdate() {
|
||||||
return this.sw.isUpdateAvailable;
|
return this.sw.isUpdateAvailable;
|
||||||
@@ -34,8 +28,4 @@ export class AppComponent {
|
|||||||
get serviceWorkerEnabled() {
|
get serviceWorkerEnabled() {
|
||||||
return this.sw.serviceWorkerEnabled;
|
return this.sw.serviceWorkerEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch(text: string) {
|
|
||||||
this.searchService.search(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import { Route } from "@angular/router";
|
import { Route } from "@angular/router";
|
||||||
|
import { DetailComponent } from "./components/detail/detail.component";
|
||||||
import { HomeComponent } from "./components/home/home.component";
|
import { HomeComponent } from "./components/home/home.component";
|
||||||
|
import { ReaderComponent } from "./components/reader/reader.component";
|
||||||
|
|
||||||
export const appRoutes: Route[] = [
|
export const appRoutes: Route[] = [
|
||||||
{
|
{
|
||||||
path: "",
|
path: "",
|
||||||
component: HomeComponent,
|
component: HomeComponent,
|
||||||
},
|
},
|
||||||
|
{ path: "detail", component: DetailComponent },
|
||||||
|
{ path: "reader", component: ReaderComponent },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<div class="flex flex-col items-center">
|
||||||
|
@if (detail_item) {
|
||||||
|
<h1>{{ detail_item.name }}</h1>
|
||||||
|
<h2>{{ detail_item.rus_name }}</h2>
|
||||||
|
<img [src]="detail_item.cover.default" [alt]="detail_item.slug" />
|
||||||
|
@for (chapter of chapters.data; track $index) {
|
||||||
|
<h3>
|
||||||
|
<strong>{{ chapter.number }}.</strong> {{ chapter.name || "Нет названия" }}
|
||||||
|
</h3>
|
||||||
|
}
|
||||||
|
<button class="p-3 text-white bg-slate-600 w-[400px] mt-5 rounded-lg" (click)="goToReader()">
|
||||||
|
Читать
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { CommonModule } from "@angular/common";
|
||||||
|
import { AfterViewInit, Component } from "@angular/core";
|
||||||
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
import { IRulibChaptersResult } from "../../services/parsers/rulib/rulib.chapters.dto";
|
||||||
|
import { Data } from "../../services/parsers/rulib/rulib.detail.dto";
|
||||||
|
import { SearchService } from "../../services/search.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "app-detail",
|
||||||
|
templateUrl: "./detail.component.html",
|
||||||
|
styleUrls: ["./detail.component.less"],
|
||||||
|
standalone: true,
|
||||||
|
imports: [CommonModule],
|
||||||
|
})
|
||||||
|
export class DetailComponent implements AfterViewInit {
|
||||||
|
detail_item: Data | null = null;
|
||||||
|
chapters: IRulibChaptersResult = { data: [] };
|
||||||
|
constructor(
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private searchService: SearchService,
|
||||||
|
private router: Router,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
private getDetails(url: string) {
|
||||||
|
this.searchService.getDetails(url).subscribe((data) => {
|
||||||
|
this.detail_item = data.data;
|
||||||
|
});
|
||||||
|
this.searchService.getChapters(url).subscribe((data) => {
|
||||||
|
this.chapters = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit(): void {
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
const url = params["url"];
|
||||||
|
if (url) {
|
||||||
|
this.getDetails(url);
|
||||||
|
} else {
|
||||||
|
this.router.navigate(["/"]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
goToReader() {
|
||||||
|
//TODO: Not only first chapter
|
||||||
|
this.router.navigate(["/", "reader"], {
|
||||||
|
queryParams: {
|
||||||
|
url: this.detail_item?.slug_url,
|
||||||
|
chapter: this.chapters.data[0].number,
|
||||||
|
volume: this.chapters.data[0].volume,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
class="header fixed flex justify-between w-full p-2 bg-gray-700 md:h-8 h-auto items-center md:flex-row flex-col md:gap-0 gap-3"
|
class="header fixed flex justify-between w-full p-2 bg-gray-700 md:h-8 h-auto items-center md:flex-row flex-col md:gap-0 gap-3"
|
||||||
>
|
>
|
||||||
<div class="flex justify-between flex-row w-full align-middle">
|
<div class="flex justify-between flex-row w-full align-middle">
|
||||||
<h1 class="text-white">NwaifuAnime</h1>
|
<a href="/"><h1 class="text-white" title="Main page">NwaifuAnime</h1></a>
|
||||||
<!-- Search bar on small screens -->
|
<!-- Search bar on small screens -->
|
||||||
<button type="button" class="md:hidden" (click)="changeMenu()">
|
<button type="button" class="md:hidden" (click)="changeMenu()">
|
||||||
<i [class]="menuBtnClass"></i>
|
<i [class]="menuBtnClass"></i>
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
type="search"
|
type="search"
|
||||||
#searchInput
|
#searchInput
|
||||||
class="outline-none ps-1 text-sm leading-6 w-full border-0 bg-transparent border-r border-gray-700"
|
class="outline-none ps-1 text-sm leading-6 w-full border-0 bg-transparent border-r border-gray-700"
|
||||||
|
(keydown.enter)="search()"
|
||||||
/>
|
/>
|
||||||
<button class="align-middle w-[100px] text-center" type="submit" (click)="search()">
|
<button class="align-middle w-[100px] text-center" type="submit" (click)="search()">
|
||||||
<span class="text-sm text-black h-full">Поиск</span>
|
<span class="text-sm text-black h-full">Поиск</span>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component, ElementRef, EventEmitter, Output, ViewChild } from "@angular/core";
|
import { AfterViewInit, Component, ElementRef, ViewChild } from "@angular/core";
|
||||||
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-header",
|
selector: "app-header",
|
||||||
@@ -8,10 +9,13 @@ import { Component, ElementRef, EventEmitter, Output, ViewChild } from "@angular
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule],
|
imports: [CommonModule],
|
||||||
})
|
})
|
||||||
export class HeaderComponent {
|
export class HeaderComponent implements AfterViewInit {
|
||||||
@Output() searchEvent: EventEmitter<string> = new EventEmitter();
|
|
||||||
@ViewChild("searchInput") searchInput: ElementRef<HTMLInputElement> | null = null;
|
@ViewChild("searchInput") searchInput: ElementRef<HTMLInputElement> | null = null;
|
||||||
menuOpened = false;
|
menuOpened = false;
|
||||||
|
constructor(
|
||||||
|
private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
) {}
|
||||||
changeMenu() {
|
changeMenu() {
|
||||||
this.menuOpened = !this.menuOpened;
|
this.menuOpened = !this.menuOpened;
|
||||||
}
|
}
|
||||||
@@ -27,7 +31,16 @@ export class HeaderComponent {
|
|||||||
search() {
|
search() {
|
||||||
if (this.searchInput) {
|
if (this.searchInput) {
|
||||||
const text = this.searchInput.nativeElement.value;
|
const text = this.searchInput.nativeElement.value;
|
||||||
this.searchEvent.emit(text);
|
this.router.navigateByUrl(`/?search=${text}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit(): void {
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
const search = params["search"];
|
||||||
|
if (search && this.searchInput) {
|
||||||
|
this.searchInput.nativeElement.value = search;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<h1>It's home component</h1>
|
<h1>It's home component</h1>
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
@for (item of items; track $index) {
|
@for (item of items; track $index) {
|
||||||
<div class="card">
|
<button (click)="getDetails(item.slug_url)" title="{{ item.name }}" class="mb-6">
|
||||||
|
<div class="card flex flex-col items-center border-black border-2 rounded-md p-4">
|
||||||
<h1>{{ item.rus_name }}</h1>
|
<h1>{{ item.rus_name }}</h1>
|
||||||
<img [src]="item.cover.thumbnail" [alt]="item.slug" />
|
<img [src]="item.cover.thumbnail" [alt]="item.slug" class="w-[200px] h-auto aspect-auto" />
|
||||||
</div>
|
</div>
|
||||||
|
</button>
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from "@angular/common";
|
||||||
import { Component, Input, OnDestroy, OnInit } from "@angular/core";
|
import { AfterViewInit, Component, Input, OnDestroy, OnInit } from "@angular/core";
|
||||||
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { Subscription } from "rxjs";
|
import { Subscription } from "rxjs";
|
||||||
import { Datum } from "../../services/parsers/rulib/rulib.dto";
|
import { Datum } from "../../services/parsers/rulib/rulib.search.dto";
|
||||||
import { SearchService } from "../../services/search.service";
|
import { SearchService } from "../../services/search.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -11,11 +12,15 @@ import { SearchService } from "../../services/search.service";
|
|||||||
styleUrls: ["./home.component.less"],
|
styleUrls: ["./home.component.less"],
|
||||||
imports: [CommonModule],
|
imports: [CommonModule],
|
||||||
})
|
})
|
||||||
export class HomeComponent implements OnInit, OnDestroy {
|
export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
@Input() items: Datum[] = [];
|
@Input() items: Datum[] = [];
|
||||||
private subscription: Subscription = new Subscription();
|
private subscription: Subscription = new Subscription();
|
||||||
|
|
||||||
constructor(private searchService: SearchService) {}
|
constructor(
|
||||||
|
private searchService: SearchService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.subscription = this.searchService.currentItemsTerm.subscribe((data) => {
|
this.subscription = this.searchService.currentItemsTerm.subscribe((data) => {
|
||||||
@@ -23,7 +28,21 @@ export class HomeComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDetails(slug_url: string) {
|
||||||
|
this.router.navigate(["/", "detail"], { queryParams: { url: slug_url } });
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit(): void {
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
const search = params["search"];
|
||||||
|
console.log(params);
|
||||||
|
if (search) {
|
||||||
|
this.searchService.search(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<h1>It's reader page</h1>
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
|
@for (page of pages; track $index) {
|
||||||
|
<img [src]="page.url" [alt]="page.slug" />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { CommonModule } from "@angular/common";
|
||||||
|
import { AfterViewInit, Component } from "@angular/core";
|
||||||
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
|
import { Page } from "../../services/parsers/rulib/rulib.chapter.dto";
|
||||||
|
import { SearchService } from "../../services/search.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "app-reader",
|
||||||
|
templateUrl: "./reader.component.html",
|
||||||
|
styleUrls: ["./reader.component.less"],
|
||||||
|
standalone: true,
|
||||||
|
imports: [CommonModule],
|
||||||
|
})
|
||||||
|
export class ReaderComponent implements AfterViewInit {
|
||||||
|
pages: Page[] = [];
|
||||||
|
constructor(
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private searchService: SearchService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngAfterViewInit(): void {
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
const url = params["url"];
|
||||||
|
const chapter = params["chapter"];
|
||||||
|
const volume = params["volume"];
|
||||||
|
if (url && chapter && volume) {
|
||||||
|
this.searchService.getChapter(url, chapter, volume).subscribe((data) => {
|
||||||
|
this.pages = data.data.pages.map((page) => {
|
||||||
|
return { ...page, url: this.searchService.getImageServer() + page.url };
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.router.navigate(["/"]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,10 @@ import { HttpClient } from "@angular/common/http";
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { Observable, catchError, map, throwError } from "rxjs";
|
import { Observable, catchError, map, throwError } from "rxjs";
|
||||||
import { ESiteUrls } from "../urls";
|
import { ESiteUrls } from "../urls";
|
||||||
import { IRulibSearchResult } from "./rulib.dto";
|
import { IRulibChapterResult } from "./rulib.chapter.dto";
|
||||||
|
import { IRulibChaptersResult } from "./rulib.chapters.dto";
|
||||||
|
import { IRulibDetailResult } from "./rulib.detail.dto";
|
||||||
|
import { IRulibSearchResult } from "./rulib.search.dto";
|
||||||
|
|
||||||
//TODO: Make abstract classes
|
//TODO: Make abstract classes
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -12,6 +15,10 @@ export class LibSocialParserService {
|
|||||||
private readonly url = ESiteUrls.LIB_SOCIAL;
|
private readonly url = ESiteUrls.LIB_SOCIAL;
|
||||||
constructor(private readonly http: HttpClient) {}
|
constructor(private readonly http: HttpClient) {}
|
||||||
|
|
||||||
|
get imageServer() {
|
||||||
|
return "https://img33.imgslib.link";
|
||||||
|
}
|
||||||
|
|
||||||
searchManga(query: string): Observable<IRulibSearchResult> {
|
searchManga(query: string): Observable<IRulibSearchResult> {
|
||||||
return this.http
|
return this.http
|
||||||
.get(`${this.url}/api/manga?fields[]=rate_avg&fields[]=rate&q=${query}&site_id[]=1`)
|
.get(`${this.url}/api/manga?fields[]=rate_avg&fields[]=rate&q=${query}&site_id[]=1`)
|
||||||
@@ -24,4 +31,39 @@ export class LibSocialParserService {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDetails(slug_url: string): Observable<IRulibDetailResult> {
|
||||||
|
return this.http
|
||||||
|
.get(
|
||||||
|
`${this.url}/api/manga/${slug_url}?fields[]=summary&fields[]=genres&fields[]=tags&fields[]=authors`,
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
map((data: object) => {
|
||||||
|
return data as IRulibDetailResult;
|
||||||
|
}),
|
||||||
|
catchError((error) => {
|
||||||
|
return throwError(() => `Now found ${error}`);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapters(url: string): Observable<IRulibChaptersResult> {
|
||||||
|
return this.http.get(`${this.url}/api/manga/${url}/chapters`).pipe(
|
||||||
|
map((data) => {
|
||||||
|
return data as IRulibChaptersResult;
|
||||||
|
}),
|
||||||
|
catchError((error) => {
|
||||||
|
return throwError(() => `Now found ${error}`);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapter(url: string, chapter: string, volume: string): Observable<IRulibChapterResult> {
|
||||||
|
return this.http
|
||||||
|
.get(`${this.url}/api/manga/${url}/chapter?number=${chapter}&volume=${volume}`)
|
||||||
|
.pipe(
|
||||||
|
map((data) => data as IRulibChapterResult),
|
||||||
|
catchError((error) => throwError(() => `Now found ${error}`)),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
export interface IRulibChapterResult {
|
||||||
|
data: Chapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Chapter {
|
||||||
|
id: number;
|
||||||
|
type: string;
|
||||||
|
volume: string;
|
||||||
|
number: string;
|
||||||
|
number_secondary: string;
|
||||||
|
name: string;
|
||||||
|
slug: string;
|
||||||
|
branch_id: null;
|
||||||
|
manga_id: number;
|
||||||
|
created_at: Date;
|
||||||
|
moderated: Moderated;
|
||||||
|
likes_count: number;
|
||||||
|
teams: Team[];
|
||||||
|
pages: Page[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Moderated {
|
||||||
|
id: number;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Page {
|
||||||
|
id: number;
|
||||||
|
image: string;
|
||||||
|
slug: number;
|
||||||
|
external: number;
|
||||||
|
chunks: number;
|
||||||
|
chapter_id: number;
|
||||||
|
created_at: Date;
|
||||||
|
updated_at: UpdatedAt;
|
||||||
|
height: number;
|
||||||
|
width: number;
|
||||||
|
url: string;
|
||||||
|
ratio: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum UpdatedAt {
|
||||||
|
The0000011130T000000000000Z = "-000001-11-30T00:00:00.000000Z",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Team {
|
||||||
|
id: number;
|
||||||
|
slug: string;
|
||||||
|
slug_url: string;
|
||||||
|
model: string;
|
||||||
|
name: string;
|
||||||
|
cover: Cover;
|
||||||
|
vk: null;
|
||||||
|
discord: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cover {
|
||||||
|
filename: null;
|
||||||
|
thumbnail: string;
|
||||||
|
default: string;
|
||||||
|
md: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
export interface IRulibChaptersResult {
|
||||||
|
data: IRulibChapter[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IRulibChapter {
|
||||||
|
id: number;
|
||||||
|
index: number;
|
||||||
|
item_number: number;
|
||||||
|
volume: string;
|
||||||
|
number: string;
|
||||||
|
number_secondary: string;
|
||||||
|
name: string;
|
||||||
|
branches_count: number;
|
||||||
|
branches: Branch[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Branch {
|
||||||
|
id: number;
|
||||||
|
branch_id: null;
|
||||||
|
created_at: Date;
|
||||||
|
teams: Team[];
|
||||||
|
user: User;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Team {
|
||||||
|
id: number;
|
||||||
|
slug: Slug;
|
||||||
|
slug_url: SlugURL;
|
||||||
|
model: Model;
|
||||||
|
name: Name;
|
||||||
|
cover: Cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cover {
|
||||||
|
filename: null | string;
|
||||||
|
thumbnail: Thumbnail;
|
||||||
|
default: Default;
|
||||||
|
md: Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Default {
|
||||||
|
StaticImagesPlaceholdersUserAvatarPNG = "/static/images/placeholders/user_avatar.png",
|
||||||
|
UploadsTeamAnyasyavaCoverJSazXO7JdAKV250X350Jpg = "/uploads/team/anyasyava/cover/jSazXO7JdAKV_250x350.jpg",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Thumbnail {
|
||||||
|
StaticImagesPlaceholdersUserAvatarPNG = "/static/images/placeholders/user_avatar.png",
|
||||||
|
UploadsTeamAnyasyavaCoverJSazXO7JdAKVThumbJpg = "/uploads/team/anyasyava/cover/jSazXO7JdAKV_thumb.jpg",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Model {
|
||||||
|
Team = "team",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Name {
|
||||||
|
Abame = "abame",
|
||||||
|
Anyasyava = "ANYASYAVA",
|
||||||
|
Cabel = "Cabel",
|
||||||
|
Deadvm = "deadvm",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Slug {
|
||||||
|
Abame = "abame",
|
||||||
|
Anyasyava = "anyasyava",
|
||||||
|
Cabel = "cabel",
|
||||||
|
Deadvm = "deadvm",
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum SlugURL {
|
||||||
|
The13801Anyasyava = "13801--anyasyava",
|
||||||
|
The33106Abame = "33106--abame",
|
||||||
|
The42374Cabel = "42374--cabel",
|
||||||
|
The45635Deadvm = "45635--deadvm",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
username: Username;
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Username {
|
||||||
|
Deadvm = "deadvm",
|
||||||
|
Gjunyaa = "gjunyaa ❤️\ud83e\ude79",
|
||||||
|
Oksas = "oksas",
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
export interface IRulibDetailResult {
|
||||||
|
data: Data;
|
||||||
|
meta: Meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Data {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
rus_name: string;
|
||||||
|
eng_name: string;
|
||||||
|
slug: string;
|
||||||
|
slug_url: string;
|
||||||
|
cover: Cover;
|
||||||
|
ageRestriction: AgeRestriction;
|
||||||
|
site: number;
|
||||||
|
type: AgeRestriction;
|
||||||
|
summary: string;
|
||||||
|
is_licensed: boolean;
|
||||||
|
genres: Genre[];
|
||||||
|
tags: Genre[];
|
||||||
|
authors: Author[];
|
||||||
|
model: string;
|
||||||
|
status: AgeRestriction;
|
||||||
|
releaseDateString: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AgeRestriction {
|
||||||
|
id: number;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Author {
|
||||||
|
id: number;
|
||||||
|
slug: string;
|
||||||
|
slug_url: string;
|
||||||
|
model: string;
|
||||||
|
name: string;
|
||||||
|
rus_name: null;
|
||||||
|
alt_name: null;
|
||||||
|
cover: Cover;
|
||||||
|
subscription: Subscription;
|
||||||
|
confirmed: null;
|
||||||
|
user_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cover {
|
||||||
|
filename: null | string;
|
||||||
|
thumbnail: string;
|
||||||
|
default: string;
|
||||||
|
md: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Subscription {
|
||||||
|
is_subscribed: boolean;
|
||||||
|
source_type: string;
|
||||||
|
source_id: number;
|
||||||
|
relation: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Genre {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
adult: boolean;
|
||||||
|
alert: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Meta {
|
||||||
|
country: string;
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { BehaviorSubject } from "rxjs";
|
import { BehaviorSubject, Observable, map } from "rxjs";
|
||||||
import { LibSocialParserService } from "./parsers/rulib/lib.social.parser.service";
|
import { LibSocialParserService } from "./parsers/rulib/lib.social.parser.service";
|
||||||
import { Datum } from "./parsers/rulib/rulib.dto";
|
import { IRulibChapterResult } from "./parsers/rulib/rulib.chapter.dto";
|
||||||
|
import { IRulibChaptersResult } from "./parsers/rulib/rulib.chapters.dto";
|
||||||
|
import { IRulibDetailResult } from "./parsers/rulib/rulib.detail.dto";
|
||||||
|
import { Datum } from "./parsers/rulib/rulib.search.dto";
|
||||||
|
|
||||||
@Injectable({ providedIn: "root" })
|
@Injectable({ providedIn: "root" })
|
||||||
export class SearchService {
|
export class SearchService {
|
||||||
@@ -14,4 +17,32 @@ export class SearchService {
|
|||||||
this.itemsTerm.next(data.data);
|
this.itemsTerm.next(data.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDetails(slug_url: string): Observable<IRulibDetailResult> {
|
||||||
|
return this.parser.getDetails(slug_url).pipe(
|
||||||
|
map((data) => {
|
||||||
|
return data;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapters(url: string): Observable<IRulibChaptersResult> {
|
||||||
|
return this.parser.getChapters(url).pipe(
|
||||||
|
map((data) => {
|
||||||
|
return data;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapter(url: string, chapter: string, volume: string): Observable<IRulibChapterResult> {
|
||||||
|
return this.parser.getChapter(url, chapter, volume).pipe(
|
||||||
|
map((data) => {
|
||||||
|
return data;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getImageServer() {
|
||||||
|
return this.parser.imageServer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user