Compare commits

...

2 Commits

Author SHA1 Message Date
backuppc
d63590620f add adsense 2026-01-21 13:02:00 +09:00
backuppc
76fb06dc31 .. 2026-01-21 11:57:22 +09:00
4 changed files with 39 additions and 12 deletions

31
App.tsx
View File

@@ -12,6 +12,28 @@ import ConflictModal from './components/ConflictModal';
import DownloadModal from './components/DownloadModal';
import { formatBytes } from './utils/formatters';
const AdSenseBanner: React.FC = () => {
useEffect(() => {
try {
// @ts-ignore
(window.adsbygoogle = window.adsbygoogle || []).push({});
} catch (e) {
console.error("AdSense error", e);
}
}, []);
return (
<div className="w-full h-full flex items-center justify-center overflow-hidden bg-slate-50">
<ins className="adsbygoogle"
style={{ display: "block", width: "100%", height: "100%" }}
data-ad-client="ca-pub-4444852135420953"
data-ad-slot="7799405796"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
</div>
);
};
const App: React.FC = () => {
// --- State ---
const savedPref = localStorage.getItem('save_connection_info') !== 'false';
@@ -1037,13 +1059,8 @@ const App: React.FC = () => {
<div className="w-1/2 min-w-0 h-full">
<LogConsole logs={logs} />
</div>
<div className="w-1/2 min-w-0 h-full bg-white border border-slate-300 rounded-lg shadow-sm flex flex-col items-center justify-center relative overflow-hidden group cursor-pointer">
<div className="absolute top-0 right-0 bg-slate-100 text-[9px] text-slate-500 px-1.5 py-0.5 rounded-bl border-b border-l border-slate-200 z-10">SPONSORED</div>
<div className="text-slate-300 flex flex-col items-center gap-1 group-hover:text-slate-400 transition-colors">
<div className="font-bold text-lg tracking-widest flex items-center gap-2"><MousePointerClick size={20} /> GOOGLE ADSENSE</div>
<div className="text-xs">Premium Ad Space Available</div>
</div>
<div className="absolute inset-0 -z-0 opacity-30" style={{ backgroundImage: 'radial-gradient(#cbd5e1 1px, transparent 1px)', backgroundSize: '10px 10px' }}></div>
<div className="w-1/2 min-w-0 h-full bg-white border border-slate-300 rounded-lg shadow-sm flex flex-col items-center justify-center relative overflow-hidden">
<AdSenseBanner />
</div>
</div>

View File

@@ -99,10 +99,20 @@ function startServer() {
}
}
let filePath = path.join(__dirname, 'dist', req.url === '/' ? 'index.html' : req.url);
// Fix for Windows: req.url starts with / which path.join treats as absolute
const requestPath = req.url === '/' ? '/index.html' : req.url;
// Remove leading slash for path.join to work relatively
const relativePath = requestPath.startsWith('/') ? requestPath.slice(1) : requestPath;
// Decoding URL (handling spaces etc)
const decodedPath = decodeURIComponent(relativePath);
let filePath = path.join(__dirname, 'dist', decodedPath);
// Prevent directory traversal
if (!filePath.startsWith(path.join(__dirname, 'dist'))) {
const distRoot = path.join(__dirname, 'dist');
if (!filePath.startsWith(distRoot)) {
console.log(`[Security Block] ${filePath} is outside ${distRoot}`);
res.writeHead(403);
res.end('Forbidden');
return;

View File

@@ -1,3 +1 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";

View File

@@ -3,6 +3,8 @@
<head>
<meta charset="UTF-8" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4444852135420953"
crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WebFTP by SIMP</title>
<style>