forked from zsakvo/yuedu-my716
-
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.
- Loading branch information
0 parents
commit 872bf0f
Showing
26 changed files
with
2,499 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk |
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,43 @@ | ||
# 99lib4yd | ||
|
||
## 描述 | ||
|
||
中转追书神器内部源(book.my716.com),为「阅读」提供数据。 | ||
|
||
## 准备 | ||
|
||
首先你的系统需要安装有 Node.js 以及 Git。 | ||
|
||
可以从官网获取相关安装包,亦可以通过仓库或者类似于[nvm](https://github.com/creationix/nvm "nvm")等脚本进行安装。 | ||
|
||
## 安装 / 更新 / 卸载 | ||
|
||
启动终端(Windows 为命令提示符或者 Powershell),执行命令 | ||
|
||
``` | ||
git clone https://github.com/zsakvo/yuedu-my716.git | ||
# 亦可以直接下载源码包而后解压之 | ||
npm i | ||
``` | ||
|
||
至此,必要的模块安装成功。 | ||
|
||
## 配置 | ||
|
||
找到`config.js`,仅有的几个配置项均由此文件控制,按照内部注释自行修改相关值即可(改完别忘记保存) | ||
|
||
## 使用 | ||
|
||
直接执行命令 | ||
|
||
``` | ||
node app.js | ||
``` | ||
|
||
按照提示访问网址生成书源即可 | ||
|
||
值得注意的是,如果你要把这个程序运行在 80 端口,可能会需要以 root 权限执行。 | ||
|
||
## ToDo | ||
|
||
- [ ] 有空再说 |
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,73 @@ | ||
const express = require("express"); | ||
const bodyParser = require("body-parser"); | ||
var gs = require("./lib/getSearch"); | ||
var bd = require("./lib/bookDetail"); | ||
var gc = require("./lib/getContent"); | ||
var bs = require("./lib/bs.json"); | ||
var gi = require("./lib/getIP"); | ||
var cheerio = require("cheerio"); | ||
var rp = require("request-promise"); | ||
var ip = require("ip"); | ||
var config = require("./config"); | ||
|
||
var app = express(); | ||
app.listen(config.port); | ||
|
||
app.use( | ||
bodyParser.urlencoded({ | ||
extended: false | ||
}) | ||
); | ||
app.use(bodyParser.json()); | ||
|
||
app.get("/book/search", async function(req, res) { | ||
var keyword = req.query.keyword; | ||
res.write(await gs(keyword)); | ||
res.end(); | ||
}); | ||
|
||
app.get(/^\/book\/(\w.+)$/, async function(req, res) { | ||
var bid = req.url.split("/")[2]; | ||
res.write(await bd(bid)); | ||
res.end(); | ||
}); | ||
|
||
app.get(/^\/chapter\/(\w.+)$/, async function(req, res) { | ||
var url = req.url.split("/chapter/")[1]; | ||
res.write(await gc(url)); | ||
res.end(); | ||
}); | ||
|
||
app.post("/gbs", function(req, res) { | ||
var body = req.body; | ||
var bsn = body.bsn; | ||
var bsu = body.bsu; | ||
bs.bookSourceName = bsn; | ||
bs.bookSourceUrl = bsu; | ||
bs.ruleSearchUrl = bsu + "/book/search?keyword=searchKey"; | ||
res.json(bs); | ||
}); | ||
|
||
app.use("/gbs", express.static(__dirname + "/html")); | ||
|
||
console.log("服务器启动成功"); | ||
console.log("当前监听端口:" + config.port); | ||
|
||
var eip; | ||
var iip; | ||
|
||
async function getIPs() { | ||
var res = await rp("http://ip.gs"); | ||
var $ = cheerio.load(res); | ||
eip = $(".btn-outline-primary").text(); | ||
iip = ip.address(); | ||
|
||
console.log( | ||
"若为公网,请访问 http://" + eip + ":" + config.port + "/gbs 生成书源。" | ||
); | ||
console.log( | ||
"若为内网,请访问 http://" + iip + ":" + config.port + "/gbs 生成书源。\n" | ||
); | ||
} | ||
|
||
getIPs(); |
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 @@ | ||
var config = { | ||
port: 80, //服务在本地运行的端口,如果不准备分配域名,请使用80(需要高级权限) | ||
proxy: "", //如果无法正常访问,可以设置代理,支持http&socks | ||
timeout: 2000, //设置适当的超时时间,以免出错 | ||
ua: | ||
"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,比较玄学,没必要改 | ||
}; | ||
module.exports = config; |
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,13 @@ | ||
{ | ||
"main.css": "/static/css/main.b52dd0fb.chunk.css", | ||
"main.js": "/static/js/main.237a74cd.chunk.js", | ||
"main.js.map": "/static/js/main.237a74cd.chunk.js.map", | ||
"static/js/1.3de2428a.chunk.js": "/static/js/1.3de2428a.chunk.js", | ||
"static/js/1.3de2428a.chunk.js.map": "/static/js/1.3de2428a.chunk.js.map", | ||
"runtime~main.js": "/static/js/runtime~main.229c360f.js", | ||
"runtime~main.js.map": "/static/js/runtime~main.229c360f.js.map", | ||
"static/css/main.b52dd0fb.chunk.css.map": "/static/css/main.b52dd0fb.chunk.css.map", | ||
"index.html": "/index.html", | ||
"precache-manifest.2072d129d979b0cebe124a31a77ab32c.js": "/precache-manifest.2072d129d979b0cebe124a31a77ab32c.js", | ||
"service-worker.js": "/service-worker.js" | ||
} |
Binary file not shown.
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,21 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="shortcut icon" href="./favicon.ico"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"> | ||
<meta name="theme-color" content="#000000"> | ||
<link rel="manifest" href="./manifest.json"> | ||
<title>书源生成</title> | ||
<link href="./static/css/main.b52dd0fb.chunk.css" rel="stylesheet"> | ||
</head> | ||
|
||
<body><noscript>要运行本页面,请启用 JavaScript 。</noscript> | ||
<div id="root"></div> | ||
<script>!function (l) { function e(e) { for (var r, t, n = e[0], o = e[1], u = e[2], f = 0, i = []; f < n.length; f++)t = n[f], p[t] && i.push(p[t][0]), p[t] = 0; for (r in o) Object.prototype.hasOwnProperty.call(o, r) && (l[r] = o[r]); for (s && s(e); i.length;)i.shift()(); return c.push.apply(c, u || []), a() } function a() { for (var e, r = 0; r < c.length; r++) { for (var t = c[r], n = !0, o = 1; o < t.length; o++) { var u = t[o]; 0 !== p[u] && (n = !1) } n && (c.splice(r--, 1), e = f(f.s = t[0])) } return e } var t = {}, p = { 2: 0 }, c = []; function f(e) { if (t[e]) return t[e].exports; var r = t[e] = { i: e, l: !1, exports: {} }; return l[e].call(r.exports, r, r.exports, f), r.l = !0, r.exports } f.m = l, f.c = t, f.d = function (e, r, t) { f.o(e, r) || Object.defineProperty(e, r, { enumerable: !0, get: t }) }, f.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, f.t = function (r, e) { if (1 & e && (r = f(r)), 8 & e) return r; if (4 & e && "object" == typeof r && r && r.__esModule) return r; var t = Object.create(null); if (f.r(t), Object.defineProperty(t, "default", { enumerable: !0, value: r }), 2 & e && "string" != typeof r) for (var n in r) f.d(t, n, function (e) { return r[e] }.bind(null, n)); return t }, f.n = function (e) { var r = e && e.__esModule ? function () { return e.default } : function () { return e }; return f.d(r, "a", r), r }, f.o = function (e, r) { return Object.prototype.hasOwnProperty.call(e, r) }, f.p = "/"; var r = window.webpackJsonp = window.webpackJsonp || [], n = r.push.bind(r); r.push = e, r = r.slice(); for (var o = 0; o < r.length; o++)e(r[o]); var s = n; a() }([])</script> | ||
<script src="./static/js/1.3de2428a.chunk.js"></script> | ||
<script src="./static/js/main.237a74cd.chunk.js"></script> | ||
</body> | ||
|
||
</html> |
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,15 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
22 changes: 22 additions & 0 deletions
22
html/precache-manifest.2072d129d979b0cebe124a31a77ab32c.js
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,22 @@ | ||
self.__precacheManifest = [ | ||
{ | ||
"revision": "229c360febb4351a89df", | ||
"url": "/static/js/runtime~main.229c360f.js" | ||
}, | ||
{ | ||
"revision": "237a74cd63a2bbfe7f22", | ||
"url": "/static/js/main.237a74cd.chunk.js" | ||
}, | ||
{ | ||
"revision": "3de2428afdfb227f495c", | ||
"url": "/static/js/1.3de2428a.chunk.js" | ||
}, | ||
{ | ||
"revision": "237a74cd63a2bbfe7f22", | ||
"url": "/static/css/main.b52dd0fb.chunk.css" | ||
}, | ||
{ | ||
"revision": "e5cb6cc00f77f5c185c48fe9e3fe0695", | ||
"url": "/index.html" | ||
} | ||
]; |
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,34 @@ | ||
/** | ||
* Welcome to your Workbox-powered service worker! | ||
* | ||
* You'll need to register this file in your web app and you should | ||
* disable HTTP caching for this file too. | ||
* See https://goo.gl/nhQhGp | ||
* | ||
* The rest of the code is auto-generated. Please don't update this file | ||
* directly; instead, make changes to your Workbox build configuration | ||
* and re-run your build process. | ||
* See https://goo.gl/2aRDsh | ||
*/ | ||
|
||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.2/workbox-sw.js"); | ||
|
||
importScripts( | ||
"/precache-manifest.2072d129d979b0cebe124a31a77ab32c.js" | ||
); | ||
|
||
workbox.clientsClaim(); | ||
|
||
/** | ||
* The workboxSW.precacheAndRoute() method efficiently caches and responds to | ||
* requests for URLs in the manifest. | ||
* See https://goo.gl/S9QRab | ||
*/ | ||
self.__precacheManifest = [].concat(self.__precacheManifest || []); | ||
workbox.precaching.suppressWarnings(); | ||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); | ||
|
||
workbox.routing.registerNavigationRoute("/index.html", { | ||
|
||
blacklist: [/^\/_/,/\/[^\/]+\.[^\/]+$/], | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.