Skip to content

Commit 2152479

Browse files
fix: images path fix in production
1 parent 5352cb0 commit 2152479

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

frontend/public/index.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
<head>
44
<meta charset="utf-8" />
55
<link rel="icon" href="./bitbyte.png" />
6-
<link rel="preconnect" href="https://fonts.gstatic.com">
7-
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;900&display=swap" rel="stylesheet">
6+
<link rel="preconnect" href="https://fonts.gstatic.com" />
7+
<link
8+
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;900&display=swap"
9+
rel="stylesheet"
10+
/>
811
<meta name="viewport" content="width=device-width, initial-scale=1" />
912
<meta name="theme-color" content="#000000" />
1013
<meta
@@ -29,6 +32,14 @@
2932
<title>The Programming Club IIITDMJ</title>
3033
</head>
3134
<body>
35+
<script>
36+
if (
37+
window.location.host === "www.webix.iiitdmj.ac.in" ||
38+
window.location.host === "webix.iiitdmj.ac.in"
39+
) {
40+
window.location.href = "https://www.iiitdmj.ac.in/webix.iiitdmj.ac.in";
41+
}
42+
</script>
3243
<noscript>You need to enable JavaScript to run this app.</noscript>
3344
<div id="root"></div>
3445
<!--

frontend/src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ ReactDOM.render(
99
<MuiThemeProvider theme={Theme}>
1010
<BrowserRouter
1111
basename={
12-
window.location.hostname === "iiitdmj.ac.in"
12+
window.location.hostname === "iiitdmj.ac.in" ||
13+
window.location.hostname === "www.iiitdmj.ac.in"
1314
? "/webix.iiitdmj.ac.in"
1415
: ""
1516
}

frontend/tools/imgRelativePath.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import os, fnmatch
2+
def findReplace(directory, find, replace, filePattern):
3+
for path, dirs, files in os.walk(os.path.abspath(directory)):
4+
for filename in fnmatch.filter(files, filePattern):
5+
filepath = os.path.join(path, filename)
6+
with open(filepath) as f:
7+
s = f.read()
8+
s = s.replace(find, replace)
9+
with open(filepath, "w") as f:
10+
f.write(s)
11+
12+
findReplace("/home/akshbansal/d/code/web/github/TPC-website/frontend/src",
13+
"src=\"/images", "src=\"/webix.iiitdmj.ac.in/images"
14+
,"*.tsx"
15+
)
16+
findReplace("/home/akshbansal/d/code/web/github/TPC-website/frontend/src",
17+
"\"/images", "\"/webix.iiitdmj.ac.in/images"
18+
,"*.ts"
19+
)
20+
findReplace("/home/akshbansal/d/code/web/github/TPC-website/frontend/src",
21+
"image=\"/images", "image=\"/webix.iiitdmj.ac.in/images"
22+
,"*.tsx"
23+
)

0 commit comments

Comments
 (0)