├── .gitignore ├── README.md ├── app.js ├── config.js ├── html ├── asset-manifest.json ├── favicon.ico ├── index.html ├── manifest.json ├── precache-manifest.8c12fe09fe98e7815bd5a8128ed4f7f5.js ├── service-worker.js └── static │ ├── css │ ├── main.b52dd0fb.chunk.css │ └── main.b52dd0fb.chunk.css.map │ └── js │ ├── 1.3de2428a.chunk.js │ ├── 1.3de2428a.chunk.js.map │ ├── main.30919260.chunk.js │ ├── main.30919260.chunk.js.map │ ├── runtime~main.229c360f.js │ └── runtime~main.229c360f.js.map ├── lib ├── bookDetail.js ├── bs.json ├── ex.html ├── getContent.js ├── getIP.js └── getSearch.js ├── package-lock.json ├── package.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/* 2 | !.vscode/settings.json 3 | !.vscode/tasks.json 4 | !.vscode/launch.json 5 | !.vscode/extensions.json 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # Optional npm cache directory 48 | .npm 49 | 50 | # Optional eslint cache 51 | .eslintcache 52 | 53 | # Optional REPL history 54 | .node_repl_history 55 | 56 | # Output of 'npm pack' 57 | *.tgz 58 | 59 | # Yarn Integrity file 60 | .yarn-integrity 61 | 62 | # dotenv environment variables file 63 | .env 64 | 65 | # parcel-bundler cache (https://parceljs.org/) 66 | .cache 67 | 68 | # next.js build output 69 | .next 70 | 71 | # nuxt.js build output 72 | .nuxt 73 | 74 | # vuepress build output 75 | .vuepress/dist 76 | 77 | # Serverless directories 78 | .serverless 79 | # General 80 | .DS_Store 81 | .AppleDouble 82 | .LSOverride 83 | 84 | # Icon must end with two \r 85 | Icon 86 | 87 | 88 | # Thumbnails 89 | ._* 90 | 91 | # Files that might appear in the root of a volume 92 | .DocumentRevisions-V100 93 | .fseventsd 94 | .Spotlight-V100 95 | .TemporaryItems 96 | .Trashes 97 | .VolumeIcon.icns 98 | .com.apple.timemachine.donotpresent 99 | 100 | # Directories potentially created on remote AFP share 101 | .AppleDB 102 | .AppleDesktop 103 | Network Trash Folder 104 | Temporary Items 105 | .apdisk 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yuedu-my716 2 | 3 | ## 新版本阅读已经支持JsonPath,XPath等,并支持运行JavaScript语句,本项目已经无意义存在,就此关闭。 4 | 5 | ## 描述 6 | 7 | 中转追书神器内部源(book.my716.com),为「阅读」提供数据。 8 | 9 | ## 准备 10 | 11 | 首先你的系统需要安装有 Node.js 以及 Git。 12 | 13 | 可以从官网获取相关安装包,亦可以通过仓库或者类似于[nvm](https://github.com/creationix/nvm "nvm")等脚本进行安装。 14 | 15 | ## 安装 / 更新 / 卸载 16 | 17 | 启动终端(Windows 为命令提示符或者 Powershell),执行命令 18 | 19 | ``` 20 | git clone https://github.com/zsakvo/yuedu-my716.git 21 | cd yuedu-my716/ 22 | # 亦可以直接下载源码包而后解压之 23 | npm i 24 | ``` 25 | 26 | 至此,必要的模块安装成功。 27 | 28 | ## 配置 29 | 30 | 找到`config.js`,仅有的几个配置项均由此文件控制,按照内部注释自行修改相关值即可(改完别忘记保存) 31 | 32 | ## 使用 33 | 34 | 直接执行命令 35 | 36 | ``` 37 | node app.js 38 | ``` 39 | 40 | 按照提示访问网址生成书源即可 41 | 42 | 值得注意的是,如果你要把这个程序运行在 80 端口,可能会需要以 root 权限执行。 43 | 44 | ## ToDo 45 | 46 | - [ ] 有空再说 47 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const bodyParser = require("body-parser"); 3 | var gs = require("./lib/getSearch"); 4 | var bd = require("./lib/bookDetail"); 5 | var gc = require("./lib/getContent"); 6 | var bs = require("./lib/bs.json"); 7 | var gi = require("./lib/getIP"); 8 | var cheerio = require("cheerio"); 9 | var rp = require("request-promise"); 10 | var ip = require("ip"); 11 | var config = require("./config"); 12 | 13 | var app = express(); 14 | app.listen(config.port); 15 | 16 | app.use( 17 | bodyParser.urlencoded({ 18 | extended: false 19 | }) 20 | ); 21 | app.use(bodyParser.json()); 22 | 23 | app.get("/book/search", async function(req, res) { 24 | var keyword = req.query.keyword; 25 | res.write(await gs(keyword)); 26 | res.end(); 27 | }); 28 | 29 | app.get("/book/detail", async function(req, res) { 30 | var bid = req.query.bid; 31 | var intro = req.query.intro; 32 | res.write(await bd(bid, intro)); 33 | res.end(); 34 | }); 35 | 36 | app.get(/^\/chapter\/(\w.+)$/, async function(req, res) { 37 | var url = req.url.split("/chapter/")[1]; 38 | res.write(await gc(url)); 39 | res.end(); 40 | }); 41 | 42 | app.post("/gbs", function(req, res) { 43 | var body = req.body; 44 | var bsn = body.bsn; 45 | var bsu = body.bsu; 46 | bs.bookSourceName = bsn; 47 | bs.bookSourceUrl = bsu; 48 | bs.ruleSearchUrl = bsu + "/book/search?keyword=searchKey"; 49 | res.json(bs); 50 | }); 51 | 52 | app.use("/gbs", express.static(__dirname + "/html")); 53 | 54 | console.log("服务器启动成功"); 55 | console.log("当前监听端口:" + config.port); 56 | 57 | var eip; 58 | var iip; 59 | 60 | async function getIPs() { 61 | var res = await rp("http://ip.gs"); 62 | var $ = cheerio.load(res); 63 | eip = $(".btn-outline-primary").text(); 64 | iip = ip.address(); 65 | 66 | console.log( 67 | "若为公网,请访问 http://" + eip + ":" + config.port + "/gbs 生成书源。" 68 | ); 69 | console.log( 70 | "若为内网,请访问 http://" + iip + ":" + config.port + "/gbs 生成书源。\n" 71 | ); 72 | } 73 | 74 | getIPs(); 75 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | port: 8081, //服务在本地运行的端口,如果不准备分配域名,请使用80(需要高级权限) 3 | timeout: 2000, //设置适当的超时时间,以免出错 4 | ua: 5 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" //设置User-Agent,比较玄学,没必要改 6 | }; 7 | module.exports = config; 8 | -------------------------------------------------------------------------------- /html/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "main.css": "/static/css/main.b52dd0fb.chunk.css", 3 | "main.js": "/static/js/main.30919260.chunk.js", 4 | "main.js.map": "/static/js/main.30919260.chunk.js.map", 5 | "static/js/1.3de2428a.chunk.js": "/static/js/1.3de2428a.chunk.js", 6 | "static/js/1.3de2428a.chunk.js.map": "/static/js/1.3de2428a.chunk.js.map", 7 | "runtime~main.js": "/static/js/runtime~main.229c360f.js", 8 | "runtime~main.js.map": "/static/js/runtime~main.229c360f.js.map", 9 | "static/css/main.b52dd0fb.chunk.css.map": "/static/css/main.b52dd0fb.chunk.css.map", 10 | "index.html": "/index.html", 11 | "precache-manifest.8c12fe09fe98e7815bd5a8128ed4f7f5.js": "/precache-manifest.8c12fe09fe98e7815bd5a8128ed4f7f5.js", 12 | "service-worker.js": "/service-worker.js" 13 | } -------------------------------------------------------------------------------- /html/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsakvo/yuedu-my716/62fee710530016f14b9d83fb6732c8afef37179f/html/favicon.ico -------------------------------------------------------------------------------- /html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 书源生成 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /html/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /html/precache-manifest.8c12fe09fe98e7815bd5a8128ed4f7f5.js: -------------------------------------------------------------------------------- 1 | self.__precacheManifest = [ 2 | { 3 | "revision": "229c360febb4351a89df", 4 | "url": "/static/js/runtime~main.229c360f.js" 5 | }, 6 | { 7 | "revision": "309192607dad4a851dd4", 8 | "url": "/static/js/main.30919260.chunk.js" 9 | }, 10 | { 11 | "revision": "3de2428afdfb227f495c", 12 | "url": "/static/js/1.3de2428a.chunk.js" 13 | }, 14 | { 15 | "revision": "309192607dad4a851dd4", 16 | "url": "/static/css/main.b52dd0fb.chunk.css" 17 | }, 18 | { 19 | "revision": "4bcdde66e6dd0f0542a88c24a4e63414", 20 | "url": "/index.html" 21 | } 22 | ]; -------------------------------------------------------------------------------- /html/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Welcome to your Workbox-powered service worker! 3 | * 4 | * You'll need to register this file in your web app and you should 5 | * disable HTTP caching for this file too. 6 | * See https://goo.gl/nhQhGp 7 | * 8 | * The rest of the code is auto-generated. Please don't update this file 9 | * directly; instead, make changes to your Workbox build configuration 10 | * and re-run your build process. 11 | * See https://goo.gl/2aRDsh 12 | */ 13 | 14 | importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.2/workbox-sw.js"); 15 | 16 | importScripts( 17 | "/precache-manifest.8c12fe09fe98e7815bd5a8128ed4f7f5.js" 18 | ); 19 | 20 | workbox.clientsClaim(); 21 | 22 | /** 23 | * The workboxSW.precacheAndRoute() method efficiently caches and responds to 24 | * requests for URLs in the manifest. 25 | * See https://goo.gl/S9QRab 26 | */ 27 | self.__precacheManifest = [].concat(self.__precacheManifest || []); 28 | workbox.precaching.suppressWarnings(); 29 | workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); 30 | 31 | workbox.routing.registerNavigationRoute("/index.html", { 32 | 33 | blacklist: [/^\/_/,/\/[^\/]+\.[^\/]+$/], 34 | }); 35 | -------------------------------------------------------------------------------- /html/static/css/main.b52dd0fb.chunk.css: -------------------------------------------------------------------------------- 1 | body{margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace} 2 | /*# sourceMappingURL=main.b52dd0fb.chunk.css.map */ -------------------------------------------------------------------------------- /html/static/css/main.b52dd0fb.chunk.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["/Users/zsakvo/project/gbs-web/src/index.css"],"names":[],"mappings":"AAAA,KACE,SAAU,AACV,UAAW,AACX,oIAEa,AACb,mCAAoC,AACpC,iCAAmC,CACpC,AAED,KACE,uEACY,CACb","file":"main.b52dd0fb.chunk.css","sourcesContent":["body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n}\n"]} -------------------------------------------------------------------------------- /html/static/js/main.30919260.chunk.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{105:function(e,t,n){e.exports=n(272)},110:function(e,t,n){},272:function(e,t,n){"use strict";n.r(t);var a=n(1),i=n.n(a),o=n(14),r=n.n(o),l=(n(110),n(23)),c=n(24),s=n(26),d=n(25),u=n(27),h=n(16),p=n(92),m=n.n(p),f=n(93),g=n.n(f),b=n(22),w=n.n(b),v=n(94),y=n.n(v),E=n(58),C=n.n(E),k=Object(h.createMuiTheme)({palette:{primary:{main:"#3d5afe",light:"#8187ff",dark:"#0031ca"},secondary:{main:"#ffffff",light:"#ffffff",dark:"#ffffff"},typography:{fontFamily:'"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif',fontSize:14,fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500}}}),j=function(e){function t(){return Object(l.a)(this,t),Object(s.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(u.a)(t,e),Object(c.a)(t,[{key:"render",value:function(){var e=this.props.classes;return i.a.createElement(h.MuiThemeProvider,{theme:k},i.a.createElement(m.a,{color:"primary",className:e.appBar},i.a.createElement(g.a,{className:e.hero},i.a.createElement(w.a,{variant:"h6",color:"inherit",className:e.grow},"\u4e66\u6e90\u914d\u7f6e\u6587\u4ef6\u751f\u6210"),i.a.createElement("div",{onClick:function(){window.location="https://github.com/zsakvo/yuedu-my716"}},i.a.createElement(y.a,null,i.a.createElement(C.a,{style:{fill:"#fff"}},i.a.createElement("path",{d:"M12 0.3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2 0 1.9 1.2 1.9 1.2 1 1.8 2.8 1.3 3.5 1 0-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.2-.4-.6-1.6 0-3.2 0 0 1-.3 3.4 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8 0 3.2.9.8 1.3 1.9 1.3 3.2 0 4.6-2.8 5.6-5.5 5.9.5.4.9 1 .9 2.2v3.3c0 .3.1.7.8.6A12 12 0 0 0 12 .3"})))))))}}]),t}(i.a.Component),x=Object(h.withStyles)({root:{flexGrow:1},grow:{flexGrow:1}})(j),O=n(59),S=n.n(O),W=n(95),N=n(96),H=n.n(N),T=n(104),M=n.n(T),z=n(60),B=n.n(z),A=n(44),I=n.n(A),P=n(99),R=n.n(P),F=n(103),L=n.n(F),G=n(101),J=n.n(G),D=n(102),U=n.n(D),V=n(100),Y=n.n(V),Q=n(98),$=n.n(Q),q={get:function(e){return fetch(e,{method:"GET",mode:"cors"}).then(function(e){return e.json()})},post:function(e,t){return fetch(e,{method:"POST",mode:"cors",credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},body:t}).then(function(e){return e.json()})}},K=q,X=n(97),Z=n.n(X),_=n(193);function ee(e){return i.a.createElement($.a,Object.assign({direction:"up"},e))}var te=function(e){function t(){var e,n;Object(l.a)(this,t);for(var a=arguments.length,i=new Array(a),o=0;o\n \n \n \n 书源配置文件生成\n \n {\n window.location = \"https://github.com/zsakvo/yuedu-my716\";\n }}\n >\n \n \n \n \n \n \n \n \n \n );\n }\n}\n\nexport default withStyles(styles)(AppTopBar);\n","var HTTPUtil = {};\n\nHTTPUtil.get = function(url) {\n return fetch(url, {\n method: \"GET\",\n mode: \"cors\"\n }).then(function(response) {\n return response.json();\n });\n};\n\nHTTPUtil.post = function(url, formData) {\n return fetch(url, {\n method: \"POST\",\n mode: \"cors\",\n credentials: \"include\",\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\n body: formData\n }).then(response => {\n return response.json();\n });\n};\n\nexport default HTTPUtil;\n","import React from \"react\";\nimport { withStyles, MuiThemeProvider } from \"@material-ui/core/styles\";\nimport compose from \"recompose/compose\";\n\nimport Card from \"@material-ui/core/Card\";\n\nimport TextField from \"@material-ui/core/TextField\";\n\nimport Button from \"@material-ui/core/Button\";\n\nimport Typography from \"@material-ui/core/Typography\";\nimport Dialog from \"@material-ui/core/Dialog\";\nimport DialogActions from \"@material-ui/core/DialogActions\";\nimport DialogContent from \"@material-ui/core/DialogContent\";\nimport DialogContentText from \"@material-ui/core/DialogContentText\";\nimport DialogTitle from \"@material-ui/core/DialogTitle\";\nimport Slide from \"@material-ui/core/Slide\";\n\nimport Theme from \"../Theme\";\n\nimport Hu from \"../HttpUtil\";\nimport copy from \"copy-to-clipboard\";\nvar QRCode = require(\"qrcode.react\");\n\nconst styles = theme => ({\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n background: \"#fff\",\n maxWidth: \"100%\",\n height: \"100%\",\n position: \"relative\",\n zIndex: 2,\n alignItems: \"center\",\n justifyContent: \"center\"\n },\n card: {\n width: 450,\n minHeight: 480,\n paddingLeft: 40,\n paddingRight: 40,\n flexDirection: \"column\",\n alignItems: \"center\"\n },\n div0: {\n position: \"absolute\",\n height: window.innerHeight - 64,\n marginTop: \"64px\",\n width: \"100%\"\n },\n textField: {\n width: \"100%\",\n marginTop: \"20px\",\n height: \"78px\",\n paddingBottom: \"16px\",\n position: \"relative\",\n verticalAlign: \"top\"\n },\n i: {\n fontSize: \"12px\",\n marginTop: \"-32px\",\n userSelect: \"none\"\n }\n});\nfunction Transition(props) {\n return ;\n}\n\nclass MainCard extends React.Component {\n state = {\n url: \"http://\" + window.location.host,\n open: false,\n bs: \"By zsakvo\"\n };\n\n handleResize = () => {\n if (window.innerWidth <= 600) {\n this.setState({\n rootCardWidth: window.innerWidth - 80,\n rootCardHeight: window.innerHeight,\n eWidth: \"100%\"\n });\n } else {\n this.setState({\n rootCardWidth: \"auto\",\n rootCardHeight: \"auto\",\n eWidth: \"350px\"\n });\n }\n };\n\n componentDidMount() {\n if (window.innerWidth <= 600) {\n this.setState({\n rootCardWidth: window.innerWidth - 80,\n rootCardHeight: window.innerHeight,\n eWidth: \"100%\"\n });\n } else {\n this.setState({\n rootCardWidth: \"auto\",\n rootCardHeight: \"auto\",\n eWidth: \"350px\"\n });\n }\n window.addEventListener(\"resize\", this.handleResize);\n }\n\n gbs = async () => {\n var bsn = this.bookSourceName.value;\n var bsu = this.bookSourceUrl.value;\n var body = JSON.stringify({\n bsn: bsn,\n bsu: bsu\n });\n var bs = await Hu.post(\"/gbs\", body);\n this.setState({\n open: true,\n bs: JSON.stringify(bs)\n });\n };\n\n onCopy = () => {\n copy(this.state.bs);\n this.handleClose();\n };\n handleClickOpen = () => {\n this.setState({ open: true });\n };\n\n handleClose = () => {\n this.setState({ open: false });\n };\n\n render() {\n const { classes } = this.props;\n return (\n \n \n {\"导入书源\"}\n \n \n 你可以用手机直接扫描二维码获取书源代码,亦可以直接点击按钮直接复制代码到你的设备。\n
\n
\n \n
\n
\n \n \n \n \n
\n
\n \n
\n \n 请自定义参数\n \n (this.bookSourceName = el)}\n />\n
自定义书源名称
\n (this.bookSourceUrl = el)}\n />\n\n
\n 输入本机的外网ip/域名(需要以http://开头,若为ip则确保本程序运行于80端口)\n
\n this.gbs()}\n >\n {\"生成书源\"}\n \n
\n \n
\n
\n
\n );\n }\n}\nexport default compose(withStyles(styles))(MainCard);\n","import React, { Component } from \"react\";\nimport Bar from \"./modules/components/AppBar\";\nimport Card from \"./modules/components/MainCard\";\n\nclass App extends Component {\n render() {\n return (\n
\n \n \n
\n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read http://bit.ly/CRA-PWA.\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit http://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See http://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n if (\n response.status === 404 ||\n response.headers.get('content-type').indexOf('javascript') === -1\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport \"./index.css\";\nimport App from \"./App\";\nimport * as serviceWorker from \"./serviceWorker\";\n\nReactDOM.render(, document.getElementById(\"root\"));\n\nserviceWorker.unregister();\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /html/static/js/runtime~main.229c360f.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c { 33 | var json = JSON.parse(res); 34 | var chapters = json.chapters; 35 | var chtml = ""; 36 | chapters.forEach(element => { 37 | var chapter = element.title; 38 | var url = element.link; 39 | chtml += '
' + chapter + "
"; 40 | }); 41 | chtml = '
' + chtml + "
"; 42 | var body = 43 | '