add nsfw flag
This commit is contained in:
parent
28008a3463
commit
acbbc66b78
2 changed files with 9 additions and 4 deletions
5
dist/bundle.es.js
vendored
5
dist/bundle.es.js
vendored
|
@ -4055,7 +4055,7 @@ from, isBackgroundSearch = false, options = {}, resolveResults = true) => (dispa
|
|||
};
|
||||
|
||||
const doResolvedSearch = (rawQuery, size, // only pass in if you don't want to use the users setting (ex: related content)
|
||||
from, isBackgroundSearch = false, options = {}) => (dispatch, getState) => {
|
||||
from, isBackgroundSearch = false, options = {}, nsfw) => (dispatch, getState) => {
|
||||
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
|
||||
|
||||
if (!query) {
|
||||
|
@ -4086,7 +4086,8 @@ from, isBackgroundSearch = false, options = {}) => (dispatch, getState) => {
|
|||
dispatch(doUpdateSearchQuery(query));
|
||||
}
|
||||
|
||||
fetch(`${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`).then(handleFetchResponse).then(data => {
|
||||
const fetchUrl = nsfw ? `${CONNECTION_STRING}search?resolve=true&${queryWithOptions}` : `${CONNECTION_STRING}search?resolve=true&nsfw=false&${queryWithOptions}`;
|
||||
fetch(fetchUrl).then(handleFetchResponse).then(data => {
|
||||
const results = [];
|
||||
|
||||
data.forEach(result => {
|
||||
|
|
|
@ -167,7 +167,8 @@ export const doResolvedSearch = (
|
|||
isBackgroundSearch: boolean = false,
|
||||
options: {
|
||||
related_to?: string,
|
||||
} = {}
|
||||
} = {},
|
||||
nsfw: boolean
|
||||
) => (dispatch: Dispatch, getState: GetState) => {
|
||||
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
|
||||
|
||||
|
@ -203,7 +204,10 @@ export const doResolvedSearch = (
|
|||
dispatch(doUpdateSearchQuery(query));
|
||||
}
|
||||
|
||||
fetch(`${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`)
|
||||
const fetchUrl = nsfw
|
||||
? `${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`
|
||||
: `${CONNECTION_STRING}search?resolve=true&nsfw=false&${queryWithOptions}`;
|
||||
fetch(fetchUrl)
|
||||
.then(handleFetchResponse)
|
||||
.then((data: Array<ResolvedSearchResult>) => {
|
||||
const results = [];
|
||||
|
|
Loading…
Reference in a new issue