mirror of
https://github.com/tooot-app/app
synced 2024-12-12 09:10:19 +01:00
commit
d7e8c7260d
@ -4,7 +4,7 @@
|
|||||||
"native": "210511",
|
"native": "210511",
|
||||||
"major": 2,
|
"major": 2,
|
||||||
"minor": 0,
|
"minor": 0,
|
||||||
"patch": 3,
|
"patch": 4,
|
||||||
"expo": "41.0.0"
|
"expo": "41.0.0"
|
||||||
},
|
},
|
||||||
"description": "tooot app for Mastodon",
|
"description": "tooot app for Mastodon",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
|
import { Constants } from 'react-native-unimodules'
|
||||||
import * as Sentry from 'sentry-expo'
|
import * as Sentry from 'sentry-expo'
|
||||||
|
|
||||||
const ctx = new chalk.Instance({ level: 3 })
|
const ctx = new chalk.Instance({ level: 3 })
|
||||||
@ -45,6 +46,8 @@ const apiGeneral = async <T = unknown>({
|
|||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': `tooot/${Constants.manifest.version}`,
|
||||||
|
Accept: '*/*',
|
||||||
...headers
|
...headers
|
||||||
},
|
},
|
||||||
...(body && { data: body })
|
...(body && { data: body })
|
||||||
|
@ -2,6 +2,7 @@ import { RootState } from '@root/store'
|
|||||||
import axios, { AxiosRequestConfig } from 'axios'
|
import axios, { AxiosRequestConfig } from 'axios'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import li from 'li'
|
import li from 'li'
|
||||||
|
import { Constants } from 'react-native-unimodules'
|
||||||
|
|
||||||
const ctx = new chalk.Instance({ level: 3 })
|
const ctx = new chalk.Instance({ level: 3 })
|
||||||
|
|
||||||
@ -67,6 +68,8 @@ const apiInstance = async <T = unknown>({
|
|||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': `tooot/${Constants.manifest.version}`,
|
||||||
|
Accept: '*/*',
|
||||||
...headers,
|
...headers,
|
||||||
...(token && {
|
...(token && {
|
||||||
Authorization: `Bearer ${token}`
|
Authorization: `Bearer ${token}`
|
||||||
|
@ -44,24 +44,28 @@ export const shouldFilter = ({
|
|||||||
getInstanceAccount(store.getState())?.id === status.account.id
|
getInstanceAccount(store.getState())?.id === status.account.id
|
||||||
|
|
||||||
let shouldFilter = false
|
let shouldFilter = false
|
||||||
if (queryKey && !ownAccount) {
|
if (!ownAccount) {
|
||||||
const parser = new htmlparser2.Parser({
|
const parser = new htmlparser2.Parser({
|
||||||
ontext (text: string) {
|
ontext (text: string) {
|
||||||
const checkFilter = (filter: Mastodon.Filter) => {
|
const checkFilter = (filter: Mastodon.Filter) => {
|
||||||
|
const escapedPhrase = filter.phrase.replace(
|
||||||
|
/[.*+?^${}()|[\]\\]/g,
|
||||||
|
'\\$&'
|
||||||
|
) // $& means the whole matched string
|
||||||
switch (filter.whole_word) {
|
switch (filter.whole_word) {
|
||||||
case true:
|
case true:
|
||||||
if (new RegExp('\\b' + filter.phrase + '\\b').test(text)) {
|
if (new RegExp('\\b' + escapedPhrase + '\\b').test(text)) {
|
||||||
shouldFilter = true
|
shouldFilter = true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case false:
|
case false:
|
||||||
if (new RegExp(filter.phrase).test(text)) {
|
if (new RegExp(escapedPhrase).test(text)) {
|
||||||
shouldFilter = true
|
shouldFilter = true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instance?.filters.forEach(filter => {
|
instance?.filters?.forEach(filter => {
|
||||||
if (filter.expires_at) {
|
if (filter.expires_at) {
|
||||||
if (new Date().getTime() > new Date(filter.expires_at).getTime()) {
|
if (new Date().getTime() > new Date(filter.expires_at).getTime()) {
|
||||||
return
|
return
|
||||||
|
@ -115,7 +115,7 @@ const TabSharedAccount: React.FC<SharedAccountProp> = ({
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}, [data, fetchedTimeline.current, i18n.language, mode])
|
}, [data, fetchedTimeline.current, queryKey[1].page, i18n.language, mode])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user