From 4aeb0b193b498e65212ddf9cd74fab2d95c18d24 Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:42:04 +1030 Subject: [PATCH] Moved twemoji outside /public Now only the twemoji resources are copied to public at build time, that way we arent shipping any of the twemoji source as well --- .gitmodules | 4 ++-- {public/res => deps}/twemoji | 0 src/util/twemojify.jsx | 6 ++++-- vite.config.js | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) rename {public/res => deps}/twemoji (100%) diff --git a/.gitmodules b/.gitmodules index b6c6947f..dcf383f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "public/res/twemoji"] - path = public/res/twemoji +[submodule "deps/twemoji"] + path = deps/twemoji url = https://github.com/twitter/twemoji.git diff --git a/public/res/twemoji b/deps/twemoji similarity index 100% rename from public/res/twemoji rename to deps/twemoji diff --git a/src/util/twemojify.jsx b/src/util/twemojify.jsx index 505fdf2b..73a79571 100644 --- a/src/util/twemojify.jsx +++ b/src/util/twemojify.jsx @@ -8,11 +8,13 @@ import { sanitizeText } from './sanitize'; const Math = lazy(() => import('../app/atoms/math/Math')); -const CDN_LOCAL = "/public/res/twemoji/assets/" +const CDN_LOCAL = "/public/twemoji/assets/" const CDN_EXTERNAL = "https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/"; +var use_local = false; + export const GetTwemojiCDN = () => { - if(window.__TAURI__){ + if(window.__TAURI__ || use_local){ return CDN_LOCAL } else{ diff --git a/vite.config.js b/vite.config.js index b46913be..261408ec 100644 --- a/vite.config.js +++ b/vite.config.js @@ -20,6 +20,10 @@ const copyFiles = { { src: 'public/res/android', dest: 'public/', + }, + { + src: 'deps/twemoji/assets', + dest: 'public/twemoji' } ], }