Skip to content

Commit 5780c9c

Browse files
authored
🔀 Merge pull request #194 from AyakaLab/master
🔖 Release 1.0.2
2 parents cf54f49 + 54f27f0 commit 5780c9c

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
</p>
44
<h1 align="center">ArcLight</h1>
55
<p align="center">An Arweave Music and Podcast Distribution App for users to publish, listen and pay to the encrypted music</p>
6-
<p align="center"><strong>Now 1.0.0 Online</strong></p>
7-
<p align="center"><strong>Great Thanks to ❤️<a href="https://github.com/LittleSound">@LittleSound</a>❤️ for contributing this project</strong></p>
8-
<p align="center"><a href="https://arweave.net/XVwDlpEp8LQXDxgOpyXelHcGMwMQ92s80WIoTgZc0cY">Live Permaweb</a> for ArcLight</p>
6+
<p align="center"><strong>Now 1.0.1 Online</strong></p>
7+
<p align="center">Great Thanks to ❤️ <a href="https://github.com/LittleSound">@LittleSound</a> ❤️ for contributing this project</p>
8+
<p align="center"><a href="https://arweave.net/_q3p3tTIOv-IoOwfFnqKCAxF58VRIGiYNBs0rN2KKM4">Live Permaweb</a> for ArcLight</p>
99
<p align="center">
1010
<img src="https://github.com/AyakaLab/ArcLight/workflows/Node%20Build%20Test/badge.svg" />
1111
<img src="https://github.com/AyakaLab/ArcLight/workflows/Production%20CI%20Build%20Test/badge.svg">

src/api/arweave.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Axios from 'axios'
44

55
import { decryptBuffer } from '../util/encrypt'
66
import decode from '../util/decode'
7+
import stringUtil from '../util/string'
78

89
const arweaveHost = 'https://arweave.net/'
910

@@ -281,7 +282,7 @@ let arweave = {
281282
if (ids.length === 0) {
282283
resolve([])
283284
} else {
284-
resolve(ids)
285+
resolve(stringUtil.getBlockedArray(ids, type))
285286
}
286287
})
287288
})
@@ -335,7 +336,7 @@ let arweave = {
335336
if (ids.length === 0) {
336337
resolve([])
337338
} else {
338-
resolve(ids)
339+
resolve(stringUtil.getBlockedArray(ids, type))
339340
}
340341
})
341342
})
@@ -1222,7 +1223,7 @@ let arweave = {
12221223
return new Promise(async (resolve, reject) => {
12231224
const list = await this.getPostInfosByAddress(address)
12241225
if (!list.length) {
1225-
resolve({ data: null })
1226+
resolve(null)
12261227
} else {
12271228
let data = await this.getPostData(list[0], address)
12281229
if (!data) {

src/config/blocked.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"single": [
3+
"W_8i6MH0Z7G_c3HrGlDBKj-VRYLef_pDvrark1gHOVs",
4+
"vcts__2y35pRQ1KYpj7u0sipyXcDq1vhuZ0sCdGTjmo",
5+
"RqFvk2tk84pPg1_j47irPEkY_gxKF54uE8zDX-pzNCs"
6+
],
7+
"album": [
8+
9+
],
10+
"podcast": [
11+
12+
],
13+
"soundEffect": [
14+
15+
]
16+
}

src/util/string.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
const StringUtil = {
1+
import blockList from '../config/blocked.json'
2+
3+
export default class StringUtil {
24
/**
35
* 计算 Utf8 字符串的体积
46
* @param {String} str 需要计算的字符串
57
*/
6-
lengthInUtf8Bytes (str) {
8+
static lengthInUtf8Bytes (str) {
79
const m = encodeURIComponent(str).match(/%[89ABab]/g)
810
return str.length + (m ? m.length : 0)
9-
},
11+
}
1012

11-
toPlainString (num) {
13+
static toPlainString (num) {
1214
return ('' + num).replace(/(-?)(\d*)\.?(\d+)e([+-]\d+)/,
1315
function (a, b, c, d, e) {
1416
return e < 0
1517
? b + '0.' + Array(1 - e - c.length).join(0) + c + d
1618
: b + c + d + Array(e - d.length + 1).join(0)
1719
})
1820
}
19-
}
2021

21-
module.exports = StringUtil
22+
static getBlockedArray (array, type) {
23+
let res = []
24+
let filterList = [ ...blockList[type] ]
25+
res = array.filter(item => !filterList.find(elem => elem === item))
26+
27+
return res
28+
}
29+
}

0 commit comments

Comments
 (0)