Giter VIP home page Giter VIP logo

haruneko's Introduction

HakuNeko


Prototype of HakuNeko based on NW.js + TypeScript + Vite

1. Status

total?color=blue&label=HaruNeko%20%28Nightly%29&logo=azure devops badge 814f4127d85245e0a763f13a901ba1b4 localized

2. Development

Make sure git and NodeJS + NPM are installed on your system.

2.1. Installation

First start by cloning the repository from https://github.com/manga-download/haruneko.git

git clone "https://github.com/manga-download/haruneko.git"

Then change into the project directory and install the dependencies

npm install
# If you are on Apple Silicon (arm64) and NW isn't starting, try:
# See: https://github.com/nwjs/nw.js/issues/8157
xattr -cr ./node_modules/nw/nwjs/nwjs.app

2.2. Run

HakuNeko consists of two parts, a web-application that needs to be hosted and an NW.js client running the web-application.

As a developer you probably want to launch the application and also want changes made to the source code reflecting in the running application. This can be achieved by hosting the source code directly on http://localhost:3000

npm run serve:dev --workspace web

Then launch the NW.js application to load the hosted web-application

npm run launch:dev --workspace app/nw

The same procedure can be applied to run a production build of both parts, but these can not be modified while running. Host the production web-application on http://localhost:5000

npm run serve:prod --workspace web

And then start the production NW.js application

npm run launch:prod --workspace app/nw

2.3. Continuous Inspection

After making changes to the source code, it is recommend to validate the code style, check for code smells and perform a static code analysis.

npm run check

2.4. Testing

To ensure the application behaves as expected, tests need to be added. The popular jest framework is used as test runner and for mocking. All tests are written side by side to their (logical) corresponding implementation directly in the source code directory. Overall, there are two test categories.

2.4.1. Unit and Component Tests

Unit tests (file extension ⋆.test.ts) are very lightweight within a limited scope (e.g. single method of a class). Component tests (file extension ⋆.spec.ts) can be more complex and test relations and coherences within a module (e.g. a composed UI control). To start these tests, simply run

npm run test

2.4.2. End-To-End Tests

End-To-End tests (file extension ⋆.e2e.ts) are performed by interacting with the (web-)application itself. This includes tests which are consuming the engine API as well as tests that run against the UI. The environment for these tests is a running instance of the NW.js production build, controlled by the tests through puppeteer. To start these tests, simply run

npm run test:e2e

2.4.3. Website Tests

Website tests (file extension ⋆.e2e.ts in /src/engine/websites) will run some basic checks for each website. The environment for these tests is a running instance of the NW.js production build, controlled by the tests through puppeteer.

⚠️
Running all tests will take very very long and may use up a lot of your internet bandwidth.

To start these test(s), simply run

# Test all websites
npm run test:websites
# Test a certain website
npm run test:websites -- MangaDex

haruneko's People

Contributors

manga-download-owner avatar mikezedev avatar observeroftime avatar pierre-monier avatar ronny1982 avatar sheepux avatar sisco0 avatar yoshiyes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haruneko's Issues

Use correct Accept Header mime type when directly fetching image

Case : https://raw.senmanga.com/akuyaku-reijou-no-shitsuji-sama-hametsu-flag-wa-ore-ga-tsubusasete-itadakimasu

THIS IS NOT A FILE RENAMING PROBLEM BUT A REQUEST PROBLEM.

Images links ends with webp. Browser downloads WEBP. Haruneko downloads files and rename as jpg as content is really JPG.

Browser uses

Accept : text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8

Haru uses

Accept : */*

Solution Proposed

In Common.ImageDirect, try to guess mime type of the link using MangaPlugin.mimeFileExtension dictionary and modify request headers accordingly.

Expired Download links Handling

Some websites put tokens in picture links that expires after some times. If for some reason you add chapters in bulk / you download volumes, and your internet is crappy, there is a chance that when the time come to download a chapter/volume queued pages links are expired and you got 403.

Some users encountered that in Hakuneko, when testing MyAnimeList, but similar website can be affected.
I think the issue could ofc come in haruneko

Possible workaround:

  • Having the ability to put our own TTL on a queued item, and the time when it has been added to the queue
  • When the times come to download it, check if expired
  • If expired, worst case : warn user. best case : renew links? another call to get the pages again? 🤷

Sending Referer by default in requests

  • Since its a given that we have to mimic browser behavior in order not to trigger server errors and Cloudflare, make sure all requests sends at least the website url as referer by default.

  • Having the possibility to override this for "pages" without having to overload a function (ie. using the plugin requests options when downloading pages)

[Feature Idea] Launch Anime in an external program

Once we got the playlist URL/video link we could allow opening it in an external player.
This could be a nice feature, and a possible workaround in case downloading / previewing with Haru doest work.

I'd see that as an option available on right click on a anime chapter .

HaruNeko Reader

Discussed in #46

Originally posted by korason7117 June 25, 2022

  • Webtoons example:
  • No Gaps
  • Obviously, Long strip.
  • Of course, No bottom scrollbar
  • If in Full screen, there should be no toolbars, like the one from the current hakuneko. It should be hided somewhere or simply a 100% fade effect
  • Manga example
  • Dunno about the gaps between images here, some people prefer them but I honestly dont mind them, they come in handy sometimes (I dont know when that sometimes is, though)
  • Yep, Long strip (mainly mentioning this because MComix doesnt have this support, reason why I got used to use my spacebar for MComix)
  • "Manual zoom mode." Theres a thing in Mcomix when you press the key a it toggles what mcomix call "manual zoom mode" it just display the real deal of resolution of the image i.e : if you have a 1080p screen and the image resolution is 2200 x 1500, you'll be seeing more detail of the image, and thats quite neat. Manga double paged images doesnt go way overhead in resolution. Having a keybind for toggling this "manual zoom mode" which is actually the original resolution would be a big plus C:
  • I dunno about the scrollbars here. While on "Manual zoom mode," for some people it could be inconvenient to see

Recommend trying MComix for getting a general idea of the reader, for some, it could be a bad reader because you have to scroll with the spacebar.

Here my configs for MComix
preferences.conf: https://pastebin.com/Swzh5GGL
keybindings.conf: https://pastebin.com/6iXtg1w0

Dev edit:
Todo:

  • longstrip (vertical)
  • paginated (horizontal)
  • gap control
  • scrollbar hide
  • Investigate if longstrips could be somehow detected based on image width/height ratio. Gaps could be automatically set to zero
  • Change the toolbar position and try to hide it as much as possible
  • "Native Resolution" manual zoom
  • widescreen type parameter (browser window wide or OS full screen like F11)

[Experimental Zone] Nice to have features

suggestion: Mobi format for kindle users

Theres only epub for e-readers and its not supported in kindles. I have to download a .cbz and I need to convert using kcc(kindle comic converter), there i can even enable manga mode to flip through the pages from right to left.
Also i can use stretch/upscale so the pages panels will fit kindle's screen.

Thats it, mobi format!

[Feedback] Haruneko - Centralised topic

You can leave some feedback here. Make sure to explain the UI flaws you find out or the good points that should be worked more and any suggestions on how to improve a specific part.

This is not a feature request topic.
This is not about HakuNeko but HaruNeko the WIP/POC of the HakuNeko rework (and probably called HakuNeko 10)

Take note that haruneko is currently in early developement stage

Feature : improving language support for medias

Some random thoughts on how we could have better language support for medias.

  • Set a default language for a website plugin . Deduced from website unique language tag or manually?

  • By default children inherit the language property from their parent (no need to modify already done plugins). May add a default arguments in constructors?

  • What about Extractors? For now they return only ID and / or title. They should return language too. I think about making them return JSON array

{ id : 1234, title : One Piece, language : en_US }

instead of

{ 1234, "One Piece", en_US }

for clarity. This could help avoid errors because i think further. We may have to extract other things in the future and messing with values order will have disastrous effects.

This could event help in other cases : when you have to return a custom ID in copy/paste decorators, you are forced to rewrite FetchManga to match the rest of the code (think "API"). If extractor value got "id", use it instead of default (pathname or pathname+search according to arguments)

This way is more flexible as we can further expand it with stuff for animes : { audio : jp_JP, subtitles : [])

TLDR : Extractors revamping.

Now there are questions :

  • What to do with multilingual tag?

  • Language normalization : website use custom codes or values. Exactly what are we using, when , what to store,, how to we translate ? dictionary? where to put it? and many other questions

  • UI and settings : Having setting by default for subtitles and audio or per plugin?
    Dont really have ideas here, i need to think further.

Problem with HTTP only websites

So i was porting another legacy website .

  1. trying to fetch manga pages for GNTAI.net (NSFW)
  2. website is http only
  3. First page is http://www.gntai.net/page/1 which get redirected to http://www.gntai.net/ (doesnt mater as it happends on other pages too)
  4. On Firefox no problem (i have to click to allow http but it works). In Haruneko, it keeps trying to fetch the httpS url which doesnt exists
  5. Too many redirections => error

image

Happened on other websites i tried to port too.

Additional Tag for Chapter Title Format Variables

Since the Rename string is applied to both the view and the file name, it would be convenient to add a language tag. Multi-language sites have their files all renamed to the same name despite one being English, one being Russian, etc. (especially obvious on MangaDex).

A simple tag to indicate the language (even if just the two-letter code EN, ES, RU, IT, etc.) would be great.

resource busy or locked when relaunching NW.js in dev mode

Step to repoduce:

  • git clone https://github.com/manga-download/haruneko.git
  • cd haruneko
  • npm install
  • npm run serve:web-dev
  • npm run launch:app-dev
  • close haruneko desktop client
  • npm run launch:app-dev receive error message

Known workaround

  • Restart os

Expected behavior

  • Able to relaunch haruneko desktop client without restarting os

Additional info

image
image

System Info

  • OS: Windows 10 Build 19403
  • Node Version: v17.4.0
  • NPM Version: 8.3.1

fuzzy search option

cause of the multiple titles translations problem

so currently HN will not get
Tensei Kizoku no Isekai Boukenroku - Jichou wo Shiranai Kamigami no Shito
if the site is
Tensei Kizoku no Isekai Boukenroku - Jichou o Shiranai Kamigami no Shito
the only differance is the missing w but its a pretty common differance
fuzzy would deal with this quite handily
english example:
She Professed Herself Pupil of the Wiseman
She Professed Herself the Pupil of the Wise Man
and exact matches would still be at the top of the list, so its not gonna make it any worse

Post Command samples

Provide a multiple step post command generator including examples provided by the community.
Common requested use cases needs to be listed.

Requests throttling

Requests to website (get mangas, get chapters, get img) are throttled at the connector level

Set-Cookie in response issue

Case:

URL 1 : https://mangayeh.com/chapter/cheat-kusushi-no-slow-life-isekai-ni-tsukurou-drugstore/chapter-44

This url redirect (302) to

URL 2 : https://gamesk.pro/chapter/cheat-kusushi-no-slow-life-isekai-ni-tsukurou-drugstore/chapter-44?t=db2ef9772b744e93ac21d023d74e6446e1612014959.

Then there is another redirection on URL2 (302 again) which is

URL3 : https://gamesk.pro/games/d/serial-cleaners-459051 (randomized)

In browser, URL3 behave differently if you open it in a new tab than if you followed redirections.

Direct access : ads for videogames
Redirected access : page with chapters pictures.

image

If the last request, Firefox got JSESSION in cookies, which Haru didnt. Cookie which should have been added according to the 'Set-Cookie' directive in PREVIOUS Request response, even if the response code was 302.

This may definitely be this JSESSION cookie that we miss. That and maybe referer (but i added it and it doesn't change anything) or the cloudflare cookie (that will be a problem).

In any case, we should have seen JSESSION cookie in last request i guess.

Solution ;

Intercept the requests response (with a handler) and set the cookie.

Add a notification when plugins have been updated

Context : people keep thinking Haku hasnt been updated for years when its false.
Users feedback is important and it should be considered. That is a simple way to tell people "we are working on it".

Ofc user must be able to disable it.

mockup webrequests tracking

"http trafic tracking":
https://developer.chrome.com/docs/extensions/reference/devtools_network/
https://developer.chrome.com/docs/extensions/reference/webRequest/
https://developer.chrome.com/docs/extensions/reference/debugger/

Check if devtools api are acessible from the UI code.

//The following code logs URLs of all images larger than 40KB as they are loaded:
chrome.devtools.network.onRequestFinished.addListener(
  function(request) {
    if (request.response.bodySize > 40*1024) {
      chrome.devtools.inspectedWindow.eval(
          'console.log("Large image: " + unescape("' +
          escape(request.request.url) + '"))');
    }
  }
);

Having the possibility to store custom properties for a manga/chapter

Use cases : On some websites you have to mix different methods for fetching infos : using urls, their own api, etc..

I.e you have to chose an identifier for each manga : sometimes an internal id (for their api or not) sometimes a pathname.
And sometimes you need both or various reasons. The information is lost between "getmangas, getchapters and getpages" procedures

Storing it inside as class variable (In Plugin/Connector) is not a good idea as its a per-item thing and we can, for example, update manga list while downloading pages. I cant name a particular manga or website but it happened when i was working on connectors.

Encoding problem (CartoonMad)

image

Manga names and Chapters names are like that.

In Haku, FetchDOM are using an encoding parameter 'big5'.

There is no such option in FetchCSS.

Having a dispatcher for Streaming hosting websites

Copied from Haku issue but relevant for haru too :

Currently we have to manually import one videostream mjs per video hoster we want to use. And perform checks on the urls in the connector itself to know which one we need to use.

It would be handy if we could just instanciate one single dispatcher to get the stream url we need.

let streamwhatever = new StreamDispatcher("[https://ok.ru/embed").getstreams(preferered_quality]

Or better : Just returning the embeded url as "page" in _getpages and HN does the job itself (maybe wrapping it inside anobject)

Hardware Acceleration Toggle Option

On some machines, hardware acceleration will make apps look blurry or fuzzy. Adding a hardware acceleration toggle option in the settings would be great.

mockup tutorial

Implement the "how to use hakuneko" pages accessible from the home screen

  • Create browseable pages
  • Fill basic sections
  • Remove/splify the use of custom css class and try to use carbon component or carbon css classes

Handle edge cases to stream animes (HLS compo & referer)

Case ; Animepahe uses Kwix. We are able to get Kwix playlist.
Downloading the video is ok it works through FFMpeg.

However, its not possible to preview the video. Fragments in the playlist cant be fetched to be previewed in Haku because we need a custom referer to get them, and HLS.min doesn't allow custom referer afaik (and its not planed to be added). While its understandable in a browser context its problematic for us.

Not sure what could be the solution tho.

Add an artificial-intelligence based solution for studying new connectors

Creating and updating connectors are recurrent issues present in the hakuneko repository, as the community like to see their favourite sources integrated into the application.

A feasible first solution would base itself on a Github bot that runs a query over the given URLs (main portal, content list, content details, and content reader URLs) and compare styling, structure, and a overall score for each one of these pages against an already present cache for the set of connectors. These scores could be easily calculated by https://github.com/matiskay/html-similarity. Considering that we already have ground thruth connectors parent class this solution seems fair enough.

Further developments could base theirselves at integrating new pages directly at the client, giving our newcomer developer users the power to contribute to the haruneko codebase.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.