RuliaReader / Rulia

This is a manga reader. It gives you different feeling. Give it a shot.
https://lancercomet.com/rulia
144 stars 0 forks source link

[Plugin] Sync reading history #137

Closed LancerComet closed 7 months ago

LancerComet commented 7 months ago

Rulia will invoke "addReadHistory" function that provides by plugin to add reading history to target site.

LancerComet commented 7 months ago

https://github.com/RuliaReader/plugin.bilibili-manga/issues/4

LancerComet commented 7 months ago

Now plugin can define a function named addReadHistory in plugin code:

/**
 *  Add reading history to the target server.
 *
 *  @param {string} url The manga chapter url that the Rulia requests to.
 */
async function addReadHistory (url: string) {
  // Get necessary information from the url.
  // For an example, the url is "https://www.my-manga-site.com/chapter/12450"
  const chapterId = getChapterIdFromUrl(url)  // 12450
  await fetch('https://www.my-manga-site.com/reading-history/add', { ... })
}

Rulia invokes this function when every chapter opens.

LancerComet commented 7 months ago

Done

LancerComet commented 7 months ago

Available since 0.18.0.