-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from chytanka/develop
Develop
- Loading branch information
Showing
23 changed files
with
293 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { ComickShellComponent } from './comick-shell/comick-shell.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', redirectTo: '/', pathMatch: 'full' }, | ||
{ | ||
path: ':id', | ||
component: ComickShellComponent | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class ComickRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<app-common-read [episode$]="episode$" [error$]="error$" [loading$]="loading$" (refreshData)="refreshData()" | ||
[playlist]="playlistService.playlist()" [playlistLink]="playlistLink()" [currentPlaylistItem]="currentPlItem()"> | ||
|
||
<p>{{lang.ph().imagesVia}}<a href="https://nhentai.net" target="_blank" rel="noopener noreferrer">Nhentai</a> | ||
API. | ||
{{lang.ph().thanks}}<br>{{lang.ph().detalisCopy}}</p> | ||
|
||
</app-common-read> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Component, inject, OnDestroy } from '@angular/core'; | ||
import { ComickService } from '../data-access/comick.service'; | ||
import { switchMap, of } from 'rxjs'; | ||
import { ReadBaseComponent } from '../../common/common-read'; | ||
import { Base64 } from '../../shared/utils'; | ||
import { COMICK_PATH } from '../../app-routing.module'; | ||
|
||
@Component({ | ||
selector: 'app-comick-shell', | ||
templateUrl: './comick-shell.component.html', | ||
styleUrl: './comick-shell.component.scss' | ||
}) | ||
export class ComickShellComponent extends ReadBaseComponent implements OnDestroy { | ||
comick = inject(ComickService) | ||
|
||
override episode$ = this.combineParamMapAndRefresh() | ||
.pipe(this.tapStartLoading(), | ||
switchMap(([params]) => { | ||
const pathParam = params?.get('id'); | ||
|
||
if (!pathParam) return of(null); | ||
|
||
const path = (Base64.isBase64(pathParam)) ? Base64.fromBase64(pathParam) : pathParam; | ||
|
||
return (this.comick.getComposition(path)).pipe(this.catchError(), this.tapSetTitle(), | ||
this.tapSaveToHistory(COMICK_PATH, path), | ||
this.tapSaveToCurrentPlaylistItem(COMICK_PATH, path), | ||
this.finalizeLoading()); | ||
}) | ||
); | ||
|
||
constructor() { | ||
super() | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.plObserv?.unsubscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { ComickRoutingModule } from './comick-routing.module'; | ||
import { ComickShellComponent } from './comick-shell/comick-shell.component'; | ||
import { CommonReadModule } from '../common/common-read'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [ | ||
ComickShellComponent | ||
], | ||
imports: [ | ||
CommonModule, | ||
ComickRoutingModule, | ||
CommonReadModule | ||
] | ||
}) | ||
export class ComickModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { inject, Injectable } from '@angular/core'; | ||
import { Observable, map } from 'rxjs'; | ||
import { environment } from '../../../environments/environment'; | ||
import { CompositionEpisode } from '../../common/common-read'; | ||
import { Base64 } from '../../shared/utils'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ComickService { | ||
http: HttpClient = inject(HttpClient) | ||
|
||
getComposition(id: string): Observable<CompositionEpisode> { | ||
// environment.proxy + Base64.toBase64 | ||
return this.http.get<any>((environment.comickHost + id)) | ||
.pipe(map((data) => { return this.map(data) })) | ||
} | ||
|
||
map(data: any): CompositionEpisode { | ||
const nsfw = data.matureContent; | ||
const mappedResponse = { | ||
title: data.chapTitle, | ||
nsfw: nsfw, //['erotica', 'suggestive'].includes(data.chapter.md_comics.content_rating), | ||
images: (data.chapter.md_images.map((item: any, index: number) => { | ||
return { | ||
src: `https://meo3.comick.pictures/${item.b2key}`, | ||
height: item.h, | ||
width: item.w | ||
}; | ||
})).filter((i: any) => i.src) | ||
// .map((img: any) => { | ||
// return { | ||
// src: environment.proxy + Base64.toBase64(`${img.src}`) | ||
// } | ||
// }) | ||
|
||
}; | ||
|
||
return mappedResponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { LinkParser } from "./link-parser"; | ||
|
||
export class ComickLinkParser extends LinkParser { | ||
override regex = /comick\.io\/comic\/(?:[\w-]+)\/(\w+)/; | ||
override site = 'comick'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { LinkParser } from "./link-parser"; | ||
|
||
export class NhentaiLinkParser extends LinkParser { | ||
override regex = /nhentai\.(?:net|to)\/g\/(\d+)/; | ||
override site = 'nhentai'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { inject, Injectable } from '@angular/core'; | ||
import { Observable, map } from 'rxjs'; | ||
import { environment } from '../../../environments/environment'; | ||
import { CompositionEpisode } from '../../common/common-read'; | ||
import { Base64 } from '../../shared/utils'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class NhentaiService { | ||
http: HttpClient = inject(HttpClient) | ||
|
||
getComposition(id: string): Observable<CompositionEpisode> { | ||
return this.http.get<any>(environment.proxy + Base64.toBase64(environment.nhentaiHost + id)) | ||
.pipe(map((data) => { return this.map(data) })) | ||
} | ||
|
||
imageType = new Map<string, string>().set('p', 'png').set('j', 'jpg').set('g', 'gif') | ||
|
||
map(data: any): CompositionEpisode { | ||
const mediaId = data.media_id; | ||
const mappedResponse = { | ||
title: data.title.pretty, | ||
nsfw: true, | ||
images: (data.images.pages.map((item: any, index: number) => { | ||
return { | ||
src: `https://i7.nhentai.net/galleries/${mediaId}/${index + 1}.${this.imageType.get(item.t)}`, | ||
height: item.h, | ||
width: item.w | ||
}; | ||
})).filter((i: any) => i.src) | ||
.map((img: any) => { | ||
return { src: environment.proxy + Base64.toBase64(`${img.src}`) } | ||
}) | ||
|
||
}; | ||
|
||
return mappedResponse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { NhentaiShellComponent } from './nhentai-shell/nhentai-shell.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', redirectTo: '/', pathMatch: 'full' }, | ||
{ | ||
path: ':id', | ||
component: NhentaiShellComponent | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class NhentaiRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<app-common-read [episode$]="episode$" [error$]="error$" [loading$]="loading$" (refreshData)="refreshData()" | ||
[playlist]="playlistService.playlist()" [playlistLink]="playlistLink()" [currentPlaylistItem]="currentPlItem()"> | ||
|
||
<p>{{lang.ph().imagesVia}}<a href="https://nhentai.net" target="_blank" rel="noopener noreferrer">Nhentai</a> | ||
API. | ||
{{lang.ph().thanks}}<br>{{lang.ph().detalisCopy}}</p> | ||
|
||
</app-common-read> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Component, inject, OnDestroy } from '@angular/core'; | ||
import { NhentaiService } from '../data-access/nhentai.service'; | ||
import { switchMap, of } from 'rxjs'; | ||
import { NHENTAI_PATH } from '../../app-routing.module'; | ||
import { Base64 } from '../../shared/utils'; | ||
import { ReadBaseComponent } from '../../common/common-read'; | ||
|
||
@Component({ | ||
selector: 'app-nhentai-shell', | ||
templateUrl: './nhentai-shell.component.html', | ||
styleUrl: './nhentai-shell.component.scss' | ||
}) | ||
export class NhentaiShellComponent extends ReadBaseComponent implements OnDestroy { | ||
nhentai = inject(NhentaiService) | ||
|
||
override episode$ = this.combineParamMapAndRefresh() | ||
.pipe(this.tapStartLoading(), | ||
switchMap(([params]) => { | ||
const pathParam = params?.get('id'); | ||
|
||
if (!pathParam) return of(null); | ||
|
||
const path = (Base64.isBase64(pathParam)) ? Base64.fromBase64(pathParam) : pathParam; | ||
|
||
return (this.nhentai.getComposition(path)).pipe(this.catchError(), this.tapSetTitle(), | ||
this.tapSaveToHistory(NHENTAI_PATH, path), | ||
this.tapSaveToCurrentPlaylistItem(NHENTAI_PATH, path), | ||
this.finalizeLoading()); | ||
}) | ||
); | ||
|
||
constructor() { | ||
super() | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.plObserv?.unsubscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { NhentaiRoutingModule } from './nhentai-routing.module'; | ||
import { NhentaiShellComponent } from './nhentai-shell/nhentai-shell.component'; | ||
import { CommonReadModule } from '../common/common-read'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [ | ||
NhentaiShellComponent | ||
], | ||
imports: [ | ||
CommonModule, | ||
NhentaiRoutingModule, | ||
CommonReadModule | ||
] | ||
}) | ||
export class NhentaiModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.