diff --git a/config.js b/config.js index c902fec052..741f047bb1 100644 --- a/config.js +++ b/config.js @@ -1773,8 +1773,6 @@ var config = { // tileTime: 5000, // // Limit results by rating: g, pg, pg-13, r. Default value: g. // rating: 'pg', - // // The proxy server url for giphy requests in the web app. - // proxyUrl: 'https://giphy-proxy.example.com', // }, // Logging diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts index 65818c8fe1..6a183e8ca9 100644 --- a/react/features/base/config/configType.ts +++ b/react/features/base/config/configType.ts @@ -375,7 +375,6 @@ export interface IConfig { giphy?: { displayMode?: 'all' | 'tile' | 'chat'; enabled?: boolean; - proxyUrl?: string; rating?: 'g' | 'pg' | 'pg-13' | 'r'; sdkKey?: string; tileTime?: number; diff --git a/react/features/gifs/components/native/GifsMenu.tsx b/react/features/gifs/components/native/GifsMenu.tsx index 7986b4bc6f..cbf59785e7 100644 --- a/react/features/gifs/components/native/GifsMenu.tsx +++ b/react/features/gifs/components/native/GifsMenu.tsx @@ -9,7 +9,7 @@ import JitsiScreen from '../../../base/modal/components/JitsiScreen'; import Input from '../../../base/ui/components/native/Input'; import { sendMessage } from '../../../chat/actions.any'; import { goBack } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef'; -import { formatGifUrlMessage, getGifRating, getGifUrl, getGiphyProxyUrl } from '../../functions.native'; +import { formatGifUrlMessage, getGifRating, getGifUrl } from '../../functions.native'; import GifsMenuFooter from './GifsMenuFooter'; import styles from './styles'; @@ -19,8 +19,6 @@ const GifsMenu = () => { const dispatch = useDispatch(); const { t } = useTranslation(); const rating = useSelector(getGifRating) as GiphyRating; - const proxyUrl = useSelector(getGiphyProxyUrl); - const options = { mediaType: GiphyMediaType.Gif, limit: 20, @@ -35,7 +33,7 @@ const GifsMenu = () => { }); const sendGif = useCallback(e => { - const url = getGifUrl(e.nativeEvent.media, proxyUrl); + const url = getGifUrl(e.nativeEvent.media); sendAnalytics(createGifSentEvent()); diff --git a/react/features/gifs/components/web/GifsMenu.tsx b/react/features/gifs/components/web/GifsMenu.tsx index 4e7d05f1c8..f392ddbd16 100644 --- a/react/features/gifs/components/web/GifsMenu.tsx +++ b/react/features/gifs/components/web/GifsMenu.tsx @@ -1,4 +1,4 @@ -import { GiphyFetch, TrendingOptions, setServerUrl } from '@giphy/js-fetch-api'; +import { GiphyFetch, TrendingOptions } from '@giphy/js-fetch-api'; import { Grid } from '@giphy/react-components'; import React, { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -20,8 +20,7 @@ import { formatGifUrlMessage, getGifAPIKey, getGifRating, - getGifUrl, - getGiphyProxyUrl + getGifUrl } from '../../function.any'; const OVERFLOW_DRAWER_PADDING = 16; @@ -104,7 +103,6 @@ function GifsMenu({ columns = 2, parent }: IProps) { = parent === IReactionsMenuParent.OverflowDrawer || parent === IReactionsMenuParent.OverflowMenu; const { clientWidth } = useSelector((state: IReduxState) => state['features/base/responsive-ui']); const rating = useSelector(getGifRating); - const proxyUrl = useSelector(getGiphyProxyUrl); const fetchGifs = useCallback(async (offset = 0) => { const options: TrendingOptions = { @@ -126,7 +124,7 @@ function GifsMenu({ columns = 2, parent }: IProps) { const handleGifClick = useCallback((gif, e) => { e?.stopPropagation(); - const url = getGifUrl(gif, proxyUrl); + const url = getGifUrl(gif); sendAnalytics(createGifSentEvent()); batch(() => { @@ -189,12 +187,6 @@ function GifsMenu({ columns = 2, parent }: IProps) { // This fixes that. useEffect(() => setSearchKey(''), []); - useEffect(() => { - if (proxyUrl) { - setServerUrl(proxyUrl); - } - }, []); - const onInputKeyPress = useCallback((e: React.KeyboardEvent) => { e.stopPropagation(); }, []); diff --git a/react/features/gifs/function.any.ts b/react/features/gifs/function.any.ts index 61a507924f..066fcaa889 100644 --- a/react/features/gifs/function.any.ts +++ b/react/features/gifs/function.any.ts @@ -33,15 +33,6 @@ export function getGifRating(state: IReduxState) { return getGifConfig(state).rating || GIF_DEFAULT_RATING; } -/** - * Get the Giphy proxy url. - * - * @param {IReduxState} state - Redux state. - * @returns {string} - */ -export function getGiphyProxyUrl(state: IReduxState) { - return getGifConfig(state).proxyUrl; -} /** * Gets the URL of the GIF for the given participant or null if there's none. @@ -69,18 +60,13 @@ export function isGifMessage(message: string) { * Returns the url of the gif selected in the gifs menu. * * @param {Object} gif - The gif data. - * @param {string} proxyUrl - The proxy server url. * @returns {boolean} */ -export function getGifUrl(gif?: { data?: { embed_url: string; }; embed_url?: string; }, proxyUrl?: string) { +export function getGifUrl(gif?: { data?: { embed_url: string; }; embed_url?: string; }) { const embedUrl = gif?.embed_url || gif?.data?.embed_url || ''; const idx = embedUrl.lastIndexOf('/'); const id = embedUrl.substr(idx + 1); - if (proxyUrl) { - return `${proxyUrl}gifs/id/${id}`; - } - return `https://i.giphy.com/media/${id}/giphy.gif`; } diff --git a/resources/giphy-proxy.conf b/resources/giphy-proxy.conf deleted file mode 100644 index c4fdb03e78..0000000000 --- a/resources/giphy-proxy.conf +++ /dev/null @@ -1,53 +0,0 @@ -server { - listen 443 ssl; - - server_name giphy-proxy.example.com; - - ssl_certificate /etc/nginx/ssl/giphy-proxy.example.com.crt; - ssl_certificate_key /etc/nginx/ssl/giphy-proxy.example.com.key; - - ssl_stapling on; - ssl_stapling_verify on; - resolver 8.8.4.4 8.8.8.8 valid=300s; - resolver_timeout 10s; - - location / { - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - - add_header 'Access-Control-Max-Age' 1728000; - add_header 'Content-Type' 'text/plain; charset=utf-8'; - add_header 'Content-Length' 0; - return 204; - } - if ($request_method = 'POST') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; - } - if ($request_method = 'GET') { - add_header 'Access-Control-Allow-Origin' '*'; - add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; - add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; - add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; - } - - root /usr/share/nginx/html; - index index.html index.htm; - } - - location /gifs/trending { - proxy_pass https://api.giphy.com/v1/gifs/trending; - } - - location /gifs/search { - proxy_pass https://api.giphy.com/v1/gifs/search; - } - - location ~ /gifs/id/(.*) { - proxy_pass https://i.giphy.com/media/$1/giphy.gif; - } -}