-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
50444d5
commit 81c534c
Showing
22 changed files
with
539 additions
and
501 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
assets/userConfig.json | ||
assets/favorites.db | ||
assets/.files | ||
.output |
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,14 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"arrowParens": "avoid", | ||
"requirePragma": false, | ||
"insertPragma": false, | ||
"proseWrap": "preserve" | ||
} |
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 |
---|---|---|
@@ -1,27 +1,31 @@ | ||
# JSBox Booru | ||
JSBox平台的Booru客户端。在JSBox上连接Gelbooru或Danbooru类型的站点,并欣赏数以万计的动漫相关图片! | ||
# JSBooru | ||
|
||
JSBox 平台的 Booru 客户端。在 JSBox 上连接 Gelbooru 或 Danbooru 类型的站点,并欣赏数以万计的动漫相关图片! | ||
现已支持十余个不同的站点。 | ||
|
||
## Features | ||
|
||
- 标签搜索 | ||
- 幻灯片播放 | ||
- 检索、收藏、管理标签 | ||
- 收藏图片 | ||
- 下载不同尺寸的图片 | ||
- 支持安全搜索模式,过滤NSFW图片 | ||
- 支持17个网站 | ||
- 支持安全搜索模式,过滤 NSFW 图片 | ||
- 支持 17 个网站 | ||
|
||
## Requirements | ||
1. JSBox>=2.2.0,需要Node.js功能,iOS>=13.0.0 | ||
|
||
1. JSBox>=2.2.0,需要 Node.js 功能,iOS>=13.0.0 | ||
2. 良好的网络环境,此部分请参见 [Known issues](#known-issues) | ||
3. node modules `booru`,点击左上角按钮并选择“解决模块依赖”来安装 | ||
|
||
## Known issues | ||
|
||
1. 网络错误 | ||
|
||
- 墙国居民请先确定自己的设备已经科学上网 | ||
- Node.js使用了SSL Pinning(证书锁定)技术,因此不能使用MITM工具 | ||
- 一部分代理App的自动分流功能不能正确分类Node.js的访问请求,请自行修正规则,或者直接改为全局代理模式 | ||
- 墙国居民请先确定自己的设备已经科学上网 | ||
- Node.js 使用了 SSL Pinning(证书锁定)技术,因此不能使用 MITM 工具 | ||
- 一部分代理 App 的自动分流功能不能正确分类 Node.js 的访问请求,请自行修正规则,或者直接改为全局代理模式 | ||
|
||
2. Node.js运行时偶尔会有不工作的情况,如果遇到请重启JSBox | ||
3. 部分站点工作不正常。修复此问题需要首先解决上游依赖项目的bug,不过你可以先反馈问题 | ||
2. Node.js 运行时偶尔会有不工作的情况,如果遇到请重启 JSBox | ||
3. 部分站点工作不正常。修复此问题需要首先解决上游依赖项目的 bug,不过你可以先反馈问题 |
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 |
---|---|---|
@@ -1,7 +1,2 @@ | ||
let socketLogger = require("socketLogger") | ||
typeof socketLogger.init === 'function' && socketLogger.init('192.168.50.134') | ||
// SocketLogger Auto Generation Code | ||
|
||
const app = require("scripts/app") | ||
|
||
app.init() | ||
const app = require("scripts/app"); | ||
app.init(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "jsbox-booru", | ||
"name": "jsbooru", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.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
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
const constants = require("scripts/utils/constants") | ||
const listView = require("scripts/views/listView") | ||
const { createDB } = require("scripts/utils/database") | ||
const constants = require("scripts/utils/constants"); | ||
const listView = require("scripts/views/listView"); | ||
const { createDB } = require("scripts/utils/database"); | ||
|
||
function initDatabase() { | ||
if (!$file.exists(constants.databaseFile)) { | ||
createDB() | ||
createDB(); | ||
} | ||
} | ||
|
||
function checkPrefs() { | ||
const intervals = $prefs.get("slideshow_intervals") | ||
const intervals = $prefs.get("slideshow_intervals"); | ||
if (intervals < 1 || intervals > 30) { | ||
$prefs.set("slideshow_intervals", 5) | ||
$prefs.set("slideshow_intervals", 5); | ||
} | ||
} | ||
|
||
async function init() { | ||
constants.initConfig() | ||
initDatabase() | ||
checkPrefs() | ||
await listView() | ||
$app.tips("右上角按钮 - Servers切换站点,Help查看帮助,Settings查看设置") | ||
constants.initConfig(); | ||
initDatabase(); | ||
checkPrefs(); | ||
await listView(); | ||
$app.tips("右上角按钮 - Servers切换站点,Settings进行设置,Help查看帮助"); | ||
} | ||
|
||
module.exports = { | ||
init | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,52 +1,43 @@ | ||
const Booru = require('booru') | ||
const { BooruError, sites } = require('booru') | ||
const Booru = require("booru"); | ||
const { BooruError, sites } = require("booru"); | ||
|
||
const {site = 'safebooru', tags = [], limit = 50, random = false, page = 1 } = $context.query | ||
console.log("Node.js works") | ||
const { | ||
site = "safebooru", | ||
tags = [], | ||
limit = 50, | ||
random = false, | ||
page = 1 | ||
} = $context.query; | ||
console.log("Node.js works"); | ||
|
||
function sendResult({ | ||
posts = null, | ||
error = null | ||
}) { | ||
function sendResult({ posts = null, error = null }) { | ||
$jsbox.notify("booruSearch", { | ||
posts, | ||
error | ||
}); | ||
} | ||
|
||
function search({ | ||
site, | ||
tags, | ||
limit, | ||
random, | ||
page | ||
}) { | ||
function search({ site, tags, limit, random, page }) { | ||
// Search with promises | ||
Booru.search(site, tags, { limit: limit, random: random, page: page}) | ||
.then(posts => { | ||
//Log the direct link to each image | ||
sendResult(posts) | ||
}) | ||
.catch(err => { | ||
if (err instanceof BooruError) { | ||
// It's a custom error thrown by the package | ||
// Typically results from errors the boorus returns, eg. "too many tags" | ||
sendResult({ | ||
error: err.message | ||
}) | ||
} else { | ||
// This means something pretty bad happened | ||
sendResult({ | ||
error: err | ||
}) | ||
} | ||
}) | ||
Booru.search(site, tags, { limit, random, page }) | ||
.then(posts => { | ||
//Log the direct link to each image | ||
sendResult(posts); | ||
}) | ||
.catch(err => { | ||
if (err instanceof BooruError) { | ||
// It's a custom error thrown by the package | ||
// Typically results from errors the boorus returns, eg. "too many tags" | ||
sendResult({ | ||
error: err.message | ||
}); | ||
} else { | ||
// This means something pretty bad happened | ||
sendResult({ | ||
error: err | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
search({ | ||
site, | ||
tags, | ||
limit, | ||
random, | ||
page | ||
}) | ||
search({ site, tags, limit, random, page }); |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
function safeSearchFilter(items) { | ||
return items.filter(n => n.rating === 's') | ||
return items.filter(n => n.rating === "s"); | ||
} | ||
|
||
module.exports = { | ||
safeSearchFilter | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,32 +1,20 @@ | ||
function booruSearch({ | ||
site, | ||
tags, | ||
limit, | ||
random, | ||
page | ||
}) { | ||
function booruSearch({ site, tags, limit, random, page }) { | ||
return new Promise((resolve, reject) => { | ||
$nodejs.run({ | ||
path: "scripts/booru/booru.js", | ||
query: { | ||
site, | ||
tags, | ||
limit, | ||
random, | ||
page | ||
}, | ||
query: { site, tags, limit, random, page }, | ||
listener: { | ||
id: "booruSearch", | ||
handler: result => { | ||
if (result.posts) { | ||
resolve(result.posts) | ||
resolve(result.posts); | ||
} else { | ||
reject(result.error) | ||
reject(result.error); | ||
} | ||
} | ||
} | ||
}) | ||
}) | ||
}); | ||
}); | ||
} | ||
|
||
module.exports = booruSearch | ||
module.exports = booruSearch; |
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.