Skip to content

Commit 8c39ef2

Browse files
committed
Added config. cleaned up around. Should be ready for prod.
1 parent 78ccbbe commit 8c39ef2

17 files changed

Lines changed: 167 additions & 86 deletions

File tree

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ repositories {
1515
name "pixelServicesReleases"
1616
url "https://maven.pixel-services.com/releases"
1717
}
18+
repositories {
19+
maven { url 'https://jitpack.io' }
20+
}
1821
}
1922

2023
jar {
@@ -31,13 +34,15 @@ shadowJar {
3134
dependencies {
3235
include(dependency('com.pixelservices:flash'))
3336
include(dependency('com.pixelservices:PTK'))
37+
include(dependency('com.github.Carleslc.Simple-YAML:Simple-Yaml'))
3438
include(dependency('com.google.code.gson:gson'))
3539
}
3640
}
3741

3842
dependencies {
3943
implementation 'com.pixelservices:flash:1.4.3'
4044
implementation 'com.pixelservices:PTK:1.3.2'
45+
implementation 'com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4'
4146
implementation 'com.google.code.gson:gson:2.12.1'
4247
implementation("net.mcbrawls.inject:http:3.1.2")
4348
testImplementation platform('org.junit:junit-bom:5.10.0')

frontend/public/favicon.ico

-3.78 KB
Binary file not shown.

frontend/public/index.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
8-
<meta
9-
name="description"
10-
content="Web site created using create-react-app"
11-
/>
12-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
138
<!--
149
manifest.json provides metadata used when your web app is installed on a
1510
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
@@ -42,8 +37,6 @@
4237
.home-link { margin-top: 30px; display: inline-block; padding: 10px 20px; background-color: #1a202c; color: #fff; border-radius: 5px; text-decoration: none; }
4338
.home-link:hover { background-color: #2d3748; }
4439
</style>
45-
46-
<title>React App</title>
4740
</head>
4841
<body>
4942
<noscript>You need to enable JavaScript to run this app.</noscript>

frontend/public/logo192.png

-5.22 KB
Binary file not shown.

frontend/public/logo512.png

-9.44 KB
Binary file not shown.

frontend/src/App.js

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
import './App.css';
2-
3-
import React from 'react';
2+
import React, { useEffect, useState } from 'react';
43
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
54
import FileExplorer from './components/FileExplorer';
65
import Error404 from './pages/Error404';
76
import Error403 from './pages/Error403';
87

98
function App() {
10-
return (
11-
<Router>
12-
<Routes>
13-
<Route path="/*" element={<FileExplorer />} />
14-
<Route path="/403" element={<Error403 />} />
15-
<Route path="/404" element={<Error404 />} />
16-
</Routes>
17-
</Router>
18-
);
9+
const [config, setConfig] = useState({ title: '', logoUrl: '', faviconUrl: '' });
10+
11+
useEffect(() => {
12+
const fetchConfig = async () => {
13+
try {
14+
const response = await fetch('/api/configuration');
15+
const data = await response.json();
16+
setConfig(data);
17+
document.title = data.title;
18+
19+
const link = document.createElement('link');
20+
link.rel = 'icon';
21+
link.href = data.faviconUrl;
22+
document.head.appendChild(link);
23+
} catch (err) {
24+
console.error('Failed to fetch configuration:', err);
25+
}
26+
};
27+
28+
fetchConfig();
29+
}, []);
30+
31+
return (
32+
<Router>
33+
<Routes>
34+
<Route path="/*" element={<FileExplorer config={config} />} />
35+
<Route path="/403" element={<Error403 logoUrl={config.logoUrl} />} />
36+
<Route path="/404" element={<Error404 logoUrl={config.logoUrl} />} />
37+
</Routes>
38+
</Router>
39+
);
1940
}
2041

21-
export default App;
42+
export default App;

frontend/src/components/FileExplorer.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
33
import FileItem from './FileItem';
44
import Breadcrumb from './Breadcrumb';
55

6-
const FileExplorer = () => {
6+
const FileExplorer = ({ config }) => {
77
const { '*': path } = useParams(); // Capture the wildcard path
88
const [files, setFiles] = useState([]);
99
const [loading, setLoading] = useState(true);
@@ -28,7 +28,7 @@ const FileExplorer = () => {
2828
}
2929
};
3030

31-
fetchFiles();
31+
fetchFiles().then(r => r);
3232
}, [path, navigate]);
3333

3434
if (loading) return <div className="spinner"></div>;
@@ -39,11 +39,11 @@ const FileExplorer = () => {
3939
<div className="flex items-center justify-between mb-6">
4040
<div className="flex items-center space-x-3">
4141
<img
42-
src="https://static.pixel-services.com/static/assets/wemx/moonlogo_cropped.png"
42+
src={config.logoUrl}
4343
alt="Logo"
4444
className="logo w-8 h-8 rounded-lg"
4545
/>
46-
<h1 className="text-xl font-bold text-gray-900">File Explorer</h1>
46+
<h1 className="text-xl font-bold text-gray-900">{config.title}</h1>
4747
</div>
4848
</div>
4949

frontend/src/components/FileItem.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ const DownloadIcon = () => (
5757
<svg className="download-icon" width="20px" height="20px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
5858
<path
5959
d="M3 15C3 17.8284 3 19.2426 3.87868 20.1213C4.75736 21 6.17157 21 9 21H15C17.8284 21 19.2426 21 20.1213 20.1213C21 19.2426 21 17.8284 21 15"
60-
stroke="#1C274C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
61-
<path d="M12 3V16M12 16L16 11.625M12 16L8 11.625" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"
62-
stroke-linejoin="round"/>
60+
stroke="#1C274C" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
61+
<path d="M12 3V16M12 16L16 11.625M12 16L8 11.625" stroke="#1C274C" strokeWidth="1.5" strokeLinecap="round"
62+
strokeLinejoin="round"/>
6363
</svg>
6464
);
6565

frontend/src/index.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ code {
2727
margin: auto;
2828
}
2929

30-
@keyframes spin {
31-
to {
32-
transform: rotate(360deg);
33-
}
34-
}
35-
3630
.file-item .download-icon {
3731
opacity: 0;
3832
transition: opacity 0.2s;

0 commit comments

Comments
 (0)