diff --git a/README.md b/README.md
index 7071cd32..a3292129 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# [tooot](https://tooot.app/) app for Mastodon
-[](LICENSE)   
+[](LICENSE)    [](https://crowdin.tooot.app/project/tooot)
  
diff --git a/package.json b/package.json
index 2766fc3b..70b1b477 100644
--- a/package.json
+++ b/package.json
@@ -83,7 +83,8 @@
"redux-persist": "^6.0.0",
"rn-placeholder": "^3.0.3",
"sentry-expo": "^3.0.5",
- "tslib": "^2.1.0"
+ "tslib": "^2.1.0",
+ "valid-url": "^1.0.9"
},
"devDependencies": {
"@babel/core": "~7.13.10",
@@ -103,6 +104,7 @@
"@types/react-redux": "^7.1.16",
"@types/react-test-renderer": "^17.0.1",
"@types/react-timeago": "^4.1.2",
+ "@types/valid-url": "^1.0.3",
"@welldone-software/why-did-you-render": "^6.1.1",
"babel-jest": "~26.6.3",
"babel-plugin-module-resolver": "^4.1.0",
diff --git a/src/components/GracefullyImage.tsx b/src/components/GracefullyImage.tsx
index ed2deccd..8800c95f 100644
--- a/src/components/GracefullyImage.tsx
+++ b/src/components/GracefullyImage.tsx
@@ -1,4 +1,3 @@
-import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useMemo, useRef, useState } from 'react'
import {
diff --git a/src/components/Instance.tsx b/src/components/Instance.tsx
index e9aeb412..ddb149b6 100644
--- a/src/components/Instance.tsx
+++ b/src/components/Instance.tsx
@@ -274,12 +274,6 @@ const styles = StyleSheet.create({
...StyleConstants.FontStyle.M,
marginRight: StyleConstants.Spacing.M
},
- privateInstance: {
- ...StyleConstants.FontStyle.S,
- fontWeight: StyleConstants.Font.Weight.Bold,
- marginLeft: StyleConstants.Spacing.Global.PagePadding,
- marginTop: StyleConstants.Spacing.XS
- },
instanceStats: {
flex: 1,
flexDirection: 'row'
diff --git a/src/components/Parse/Emojis.tsx b/src/components/Parse/Emojis.tsx
index ab9ffffd..ba18c002 100644
--- a/src/components/Parse/Emojis.tsx
+++ b/src/components/Parse/Emojis.tsx
@@ -7,6 +7,7 @@ import React, { useMemo } from 'react'
import { StyleSheet, Text } from 'react-native'
import FastImage from 'react-native-fast-image'
import { useSelector } from 'react-redux'
+import validUrl from 'valid-url'
const regexEmoji = new RegExp(/(:[A-Za-z0-9_]+:)/)
@@ -67,25 +68,30 @@ const ParseEmojis = React.memo(
const emojiIndex = emojis.findIndex(emoji => {
return emojiShortcode === `:${emoji.shortcode}:`
})
- return emojiIndex === -1 ? (
- {emojiShortcode}
- ) : (
-
- {/* When emoji starts a paragraph, lineHeight will break */}
- {i === 0 ? : null}
-
-
- )
+ if (emojiIndex === -1) {
+ return {emojiShortcode}
+ } else {
+ if (i === 0) {
+ return
+ } else {
+ const uri = reduceMotionEnabled
+ ? emojis[emojiIndex].static_url
+ : emojis[emojiIndex].url
+ if (validUrl.isHttpsUri(uri)) {
+ return (
+
+ )
+ } else {
+ return null
+ }
+ }
+ }
} else {
- return {str}
+ return {str}
}
})
) : (
diff --git a/src/components/Timeline/Shared/Attachment.tsx b/src/components/Timeline/Shared/Attachment.tsx
index fc004d24..0b91ae47 100644
--- a/src/components/Timeline/Shared/Attachment.tsx
+++ b/src/components/Timeline/Shared/Attachment.tsx
@@ -95,15 +95,46 @@ const TimelineAttachment = React.memo(
/>
)
default:
- return (
-
- )
+ if (
+ attachment.preview_url.endsWith('.jpg') ||
+ attachment.preview_url.endsWith('.jpeg') ||
+ attachment.preview_url.endsWith('.png') ||
+ attachment.preview_url.endsWith('.gif') ||
+ attachment.remote_url?.endsWith('.jpg') ||
+ attachment.remote_url?.endsWith('.jpeg') ||
+ attachment.remote_url?.endsWith('.png') ||
+ attachment.remote_url?.endsWith('.gif')
+ ) {
+ imageUrls.push({
+ id: attachment.id,
+ url: attachment.url,
+ remote_url: attachment.remote_url,
+ blurhash: attachment.blurhash,
+ width: attachment.meta?.original?.width,
+ height: attachment.meta?.original?.height
+ })
+ return (
+
+ )
+ } else {
+ return (
+
+ )
+ }
}
}),
[sensitiveShown]
diff --git a/src/screens/Compose/Root/Footer/Emojis.tsx b/src/screens/Compose/Root/Footer/Emojis.tsx
index d2cee289..890d2f6c 100644
--- a/src/screens/Compose/Root/Footer/Emojis.tsx
+++ b/src/screens/Compose/Root/Footer/Emojis.tsx
@@ -1,13 +1,14 @@
import analytics from '@components/analytics'
import haptics from '@components/haptics'
+import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useCallback, useContext, useMemo } from 'react'
import { Pressable, SectionList, StyleSheet, Text, View } from 'react-native'
-import ComposeContext from '../../utils/createContext'
-import updateText from '../../updateText'
import FastImage from 'react-native-fast-image'
-import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
+import validUrl from 'valid-url'
+import updateText from '../../updateText'
+import ComposeContext from '../../utils/createContext'
const SingleEmoji = ({ emoji }: { emoji: Mastodon.Emoji }) => {
const { reduceMotionEnabled } = useAccessibility()
@@ -21,21 +22,21 @@ const SingleEmoji = ({ emoji }: { emoji: Mastodon.Emoji }) => {
newText: `:${emoji.shortcode}:`,
type: 'emoji'
})
- // composeDispatch({
- // type: 'emoji',
- // payload: { ...composeState.emoji, active: false }
- // })
haptics('Light')
}, [composeState])
- const children = useMemo(
- () => (
-
- ),
- []
- )
+ const children = useMemo(() => {
+ const uri = reduceMotionEnabled ? emoji.static_url : emoji.url
+ if (validUrl.isHttpsUri(uri)) {
+ return (
+
+ )
+ } else {
+ return null
+ }
+ }, [])
return (
)
diff --git a/src/screens/Tabs/Shared/Search.tsx b/src/screens/Tabs/Shared/Search.tsx
index 4f12712b..e15e4b5a 100644
--- a/src/screens/Tabs/Shared/Search.tsx
+++ b/src/screens/Tabs/Shared/Search.tsx
@@ -81,25 +81,35 @@ const TabSharedSearch: React.FC = ({
components={{ bold: }}
/>
-
+
{t('shared.search.empty.advanced.header')}
-
+
@username@domain
{' '}
{t('shared.search.empty.advanced.example.account')}
-
+
#example
{' '}
{t('shared.search.empty.advanced.example.hashtag')}
-
+
URL
{' '}
{t('shared.search.empty.advanced.example.statusLink')}
-
+
URL
{' '}
{t('shared.search.empty.advanced.example.accountLink')}
@@ -113,9 +123,14 @@ const TabSharedSearch: React.FC = ({
const sectionHeader = useCallback(
({ section: { translation } }) => (
-
+
{translation}
@@ -126,11 +141,14 @@ const TabSharedSearch: React.FC = ({
({ section: { data, translation } }) =>
!data.length ? (
}}
/>
diff --git a/yarn.lock b/yarn.lock
index c8b46619..89ec14b4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2798,6 +2798,11 @@
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff"
integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw==
+"@types/valid-url@^1.0.3":
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/@types/valid-url/-/valid-url-1.0.3.tgz#a124389fb953559c7f889795a98620e91adb3687"
+ integrity sha512-+33x29mg+ecU88ODdWpqaie2upIuRkhujVLA7TuJjM823cNMbeggfI6NhxewaRaRF8dy+g33e4uIg/m5Mb3xDQ==
+
"@types/yargs-parser@*":
version "20.2.0"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9"
@@ -10463,6 +10468,11 @@ v8-to-istanbul@^7.0.0:
convert-source-map "^1.6.0"
source-map "^0.7.3"
+valid-url@^1.0.9:
+ version "1.0.9"
+ resolved "https://registry.yarnpkg.com/valid-url/-/valid-url-1.0.9.tgz#1c14479b40f1397a75782f115e4086447433a200"
+ integrity sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA=
+
validate-npm-package-license@^3.0.1:
version "3.0.4"
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"