mirror of
https://github.com/Qortal/q-tube.git
synced 2025-02-11 17:55:51 +00:00
Merge pull request #17 from QuickMythril/superlike-fix
Improve Superlike validation
This commit is contained in:
commit
b408a99d8c
@ -143,46 +143,53 @@ const GlobalWrapper: React.FC<Props> = ({ children, setTheme }) => {
|
|||||||
|
|
||||||
const getSuperlikes = useCallback(async () => {
|
const getSuperlikes = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const url = `/arbitrary/resources/search?mode=ALL&service=BLOG_COMMENT&query=${SUPER_LIKE_BASE}&limit=20&includemetadata=true&reverse=true&excludeblocked=true`;
|
let totalCount = 0
|
||||||
const response = await fetch(url, {
|
let validCount = 0
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const responseData = await response.json();
|
|
||||||
let comments: any[] = [];
|
let comments: any[] = [];
|
||||||
for (const comment of responseData) {
|
while (validCount < 20 && totalCount < 100) {
|
||||||
if (
|
const url = `/arbitrary/resources/search?mode=ALL&service=BLOG_COMMENT&query=${SUPER_LIKE_BASE}&limit=1&offset=${totalCount}&includemetadata=true&reverse=true&excludeblocked=true`;
|
||||||
comment.identifier &&
|
const response = await fetch(url, {
|
||||||
comment.name &&
|
method: "GET",
|
||||||
comment?.metadata?.description
|
headers: {
|
||||||
) {
|
"Content-Type": "application/json",
|
||||||
try {
|
},
|
||||||
const result = extractSigValue(comment?.metadata?.description);
|
});
|
||||||
if (!result) continue;
|
const responseData = await response.json();
|
||||||
const res = await getPaymentInfo(result);
|
if (responseData && responseData.length > 0) {
|
||||||
|
for (const comment of responseData) {
|
||||||
if (
|
if (
|
||||||
+res?.amount >= minPriceSuperlike &&
|
comment.identifier &&
|
||||||
isTimestampWithinRange(res?.timestamp, comment.created)
|
comment.name &&
|
||||||
|
comment?.metadata?.description
|
||||||
) {
|
) {
|
||||||
addSuperlikeRawDataGetToList({
|
try {
|
||||||
name: comment.name,
|
const result = extractSigValue(comment?.metadata?.description);
|
||||||
identifier: comment.identifier,
|
if (!result) continue;
|
||||||
content: comment,
|
const res = await getPaymentInfo(result);
|
||||||
});
|
if (
|
||||||
|
+res?.amount >= minPriceSuperlike &&
|
||||||
comments = [
|
isTimestampWithinRange(res?.timestamp, comment.created)
|
||||||
...comments,
|
) {
|
||||||
{
|
addSuperlikeRawDataGetToList({
|
||||||
...comment,
|
name: comment.name,
|
||||||
message: "",
|
identifier: comment.identifier,
|
||||||
amount: res.amount,
|
content: comment,
|
||||||
},
|
});
|
||||||
];
|
comments = [
|
||||||
|
...comments,
|
||||||
|
{
|
||||||
|
...comment,
|
||||||
|
message: "",
|
||||||
|
amount: res.amount,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
validCount++;
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
}
|
||||||
}
|
}
|
||||||
|
totalCount++;
|
||||||
}
|
}
|
||||||
dispatch(setSuperlikesAll(comments));
|
dispatch(setSuperlikesAll(comments));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user