Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed img path #501

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ VITE_APP_FIREBASE_STORAGEBUCKET=
VITE_APP_FIREBASE_MESSAGINGSENDERID=
VITE_APP_FIREBASE_APPID=
VITE_APP_IOS_APIKEY=
VITE_APP_ANDROID_APIKEY=
VITE_APP_ANDROID_APIKEY=
VITE_APP_PUBLIC_IMG_URL=
5 changes: 3 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ jobs:
env:
CI: false
VITE_APP_YBUG_ID: 01m1nn5zqystt1qq5n11
VITE_APP_PUBLIC_API_URL: https://api-stage.escolalms.com
VITE_APP_PUBLIC_API_URL: https://demo-stage.api.s.wellms.io
VITE_APP_SENTRYDSN: https://1abed5b3f95e41be8e1c39c33af12506@sentry.etd24.pl/96
VITE_APP_ROUTING_TYPE: HashRouter
# VITE_APP_PUBLIC_MOBILE_DEVICE: false
VITE_APP_PUBLIC_URL: https://demo-stage.escolalms.com
VITE_APP_PUBLIC_URL: https://demo-stage.app.s.wellms.io
VITE_APP_PUBLIC_IMG_URL: https://wellms-multidomain-demo-stage.s3.pl-waw.scw.cloud
run: |
npm i --legacy-peer-deps
npm run build
Expand Down
3 changes: 3 additions & 0 deletions config/php/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
if (isset($setup['VITE_APP_URL'])) {
$content = preg_replace('/(?<=window.VITE_APP_URL=")(.*)(?=")/', $setup['VITE_APP_URL'], $content);
}
if (isset($setup['VITE_APP_PUBLIC_IMG_URL'])) {
$content = preg_replace('/(?<=window.VITE_APP_PUBLIC_IMG_URL=")(.*)(?=")/', $setup['VITE_APP_PUBLIC_IMG_URL'], $content);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
window.VITE_APP_FIREBASE_APPID = null;
window.VITE_APP_IOS_APIKEY = null;
window.VITE_APP_ANDROID_APIKEY = null;
window.VITE_APP_PUBLIC_IMG_URL = null;
</script>
</head>

Expand Down
5 changes: 5 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ export const VITE_APP_ANDROID_APIKEY =
window.VITE_APP_ANDROID_APIKEY ||
import.meta.env.VITE_APP_ANDROID_APIKEY ||
null;

export const VITE_APP_PUBLIC_IMG_URL =
window.VITE_APP_PUBLIC_IMG_URL ||
import.meta.env.VITE_APP_PUBLIC_IMG_URL ||
null;
9 changes: 7 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import WebFont from "webfontloader";
import "./i18n";
import "./sentry";
import { GlobalThemeProvider } from "@escolalms/components/lib/theme/provider";
import { API_URL } from "./config";
import { API_URL, VITE_APP_PUBLIC_IMG_URL } from "./config";

declare global {
interface Window {
Expand All @@ -21,6 +21,7 @@ declare global {
VITE_APP_FIREBASE_APPID: string;
VITE_APP_IOS_APIKEY: string;
VITE_APP_ANDROID_APIKEY: string;
VITE_APP_PUBLIC_IMG_URL: string;
}
}

Expand All @@ -35,7 +36,11 @@ WebFont.load({
ReactDOM.createRoot(document.getElementById("root") as Element).render(
<React.StrictMode>
{API_URL ? (
<EscolaLMSContextProvider apiUrl={API_URL} initialFetch={false}>
<EscolaLMSContextProvider
apiUrl={API_URL}
initialFetch={false}
imagePrefix={`${VITE_APP_PUBLIC_IMG_URL}/imgcache`}
>
<GlobalThemeProvider>
<App />
</GlobalThemeProvider>
Expand Down
Loading