diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0c7dbf8 --- /dev/null +++ b/.env.example @@ -0,0 +1,36 @@ +# SnapCAD / YakNet cloud configuration. +# Copy this file to .env and fill in real values. Never commit .env. + +YAKNET_DB_HOST='127.0.0.1' +YAKNET_DB_PORT='3306' +YAKNET_DB_NAME='yaknet_auth' +YAKNET_DB_USER='root' +YAKNET_DB_PASS='replace-with-your-database-password' + +# Run `php database/migrate.php` once to create/update the schema. +# Leave this false; true is only for one-off automatic schema setup. +SNAPCAD_AUTO_MIGRATE='false' + +YAKNET_AUTH_BASE_URL='https://developer-console.yakhub.com.tr' +YAKNET_CDN_ACCOUNT_JS='https://cdnjs.yakhub.com.tr/ajax/libs/yaknet-account/latest/yaknet-account.js' +SNAPCAD_CANONICAL_URL='https://snap.yakhub.com.tr' +SNAPCAD_CALLBACK_URL='https://snap.yakhub.com.tr/callback.php' +YAKNET_CLIENT_ID='replace-with-oauth-client-id' +YAKNET_CLIENT_SECRET='replace-with-oauth-client-secret' +# Space or comma separated OAuth scopes. Defaults to '*'. +YAKNET_OAUTH_SCOPE='*' + +# Keep true in production. Set false only for a local development certificate issue. +YAKNET_OAUTH_VERIFY='true' + +# Origins allowed to send state-changing requests. +SNAPCAD_ALLOWED_ORIGINS='https://snap.yakhub.com.tr,http://localhost,http://127.0.0.1' + +# Request and storage limits. +SNAPCAD_MAX_BODY_BYTES='8388608' +SNAPCAD_MAX_PROJECT_BYTES='4194304' +SNAPCAD_MAX_PROJECTS_PER_USER='200' +SNAPCAD_MAX_STORAGE_BYTES_PER_USER='104857600' + +# Client-supplied SSO payloads are never trusted. Use OAuth callback or a verified token. +SNAPCAD_ENABLE_CLIENT_SSO_SYNC='false' diff --git a/.gitignore b/.gitignore index 945de90..32a336e 100644 --- a/.gitignore +++ b/.gitignore @@ -48,5 +48,41 @@ Thumbs.db # Claude Code local settings (machine-specific) .claude/settings.local.json -# Staged occt-wasm runtime (copied from node_modules by scripts/copy-occt-wasm.mjs) +# Staged WebAssembly runtimes (copied from node_modules by scripts/copy-*.mjs) apps/web/public/occt/ +apps/web/public/dwgdxf/ +apps/web/public/libredwg/ +apps/web/public/libredwg-web/ + +# PHP dependencies (install with composer install) +/vendor/ + +# Static export copied to the Laragon web root by scripts/sync-laragon-static.mjs +/_next/ +/assets/ +/404/ +/dwgdxf/ +/gizlilik/ +/guvenlik/ +/hakkimizda/ +/icons/ +/iletisim/ +/kullanim-kosullari/ +/kurumsal-guvenlik/ +/kvkk/ +/libredwg/ +/libredwg-web/ +/occt/ +/index.html +/index.txt +/404.html +/sw.js +/manifest.json +/manifest.webmanifest +/manifold.js +/manifold.wasm +/.htaccess + +# Local deploy/backup artifacts +*.bak +*.sql diff --git a/README.md b/README.md index 56f4bec..995e7ba 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,37 @@
-
- |
-
- SketchForge-A local-first 3D design editor that runs in your browser.-- Build shapes, cut holes, group parts, import STL files, and export models without accounts, cloud lock-in, or heavyweight CAD setup. - - |
-
Erişilebilir, tarayıcı tabanlı 3B parametrik CAD ve mimari modelleme stüdyosu.
+DWG/DXF/STEP/STL/OBJ/GLB içe aktarma, .skf proje paketleri, isteğe bağlı YakNet Bulut yedeği ve ekran okuyucu dostu arayüz.
SnapCAD Studio şu anda yüklenemedi. İnternet bağlantınızı kontrol edip sayfayı yenileyin.
", + { status: 503, statusText: "Offline", headers: { "Content-Type": "text/html; charset=utf-8" } }, + ); +} + +// Install Event - Pre-cache essential app shell +self.addEventListener("install", (event) => { + event.waitUntil( + caches + .open(CACHE_NAME) + .then((cache) => { + return cache.addAll(PRECACHE_ASSETS).catch((err) => { + console.warn("[SnapCAD SW] Precache warning:", err); + }); + }) + .then(() => self.skipWaiting()), + ); +}); + +// Activate Event - Clean up stale cache versions +self.addEventListener("activate", (event) => { + event.waitUntil( + caches + .keys() + .then((keys) => { + return Promise.all( + keys + .filter((key) => key !== CACHE_NAME) + .map((key) => caches.delete(key)), + ); + }) + .then(() => self.clients.claim()), + ); +}); + +// Fetch Event - Resilient caching strategies +self.addEventListener("fetch", (event) => { + const { request } = event; + const url = new URL(request.url); + + // Never cache non-GET requests or backend API endpoints + if ( + request.method !== "GET" || + url.pathname.startsWith("/api/") || + url.pathname.endsWith(".php") + ) { + return; + } + + // Cross-origin istekleri (ör. Cloudflare Analytics beacon) service worker'a + // sokma; aksi hâlde önbellekte olmayan istekler undefined döndürür. + if (url.origin !== self.location.origin) { + return; + } + + // Strategy 1: Cache-First for Immutable WebAssembly Runtimes + if ( + url.pathname.endsWith(".wasm") || + url.pathname.includes("/occt/") || + url.pathname.includes("/dwgdxf/") || + url.pathname.includes("/libredwg/") + ) { + event.respondWith( + caches.match(request).then(async (cached) => { + if (cached) return cached; + try { + const response = await fetch(request); + if (response && response.status === 200) { + const clone = response.clone(); + caches.open(CACHE_NAME).then((cache) => cache.put(request, clone)); + } + return response; + } catch { + return gatewayTimeoutResponse(); + } + }), + ); + return; + } + + // Strategy 2: Stale-While-Revalidate for Static Assets (_next/static, icons, images) + if ( + url.pathname.startsWith("/_next/static/") || + url.pathname.startsWith("/icons/") || + url.pathname.startsWith("/assets/") + ) { + event.respondWith( + caches.match(request).then(async (cached) => { + const fetchPromise = fetch(request) + .then((networkResponse) => { + if (networkResponse && networkResponse.status === 200) { + const clone = networkResponse.clone(); + caches.open(CACHE_NAME).then((cache) => cache.put(request, clone)); + } + return networkResponse; + }) + .catch(() => cached || gatewayTimeoutResponse()); + + return cached || fetchPromise; + }), + ); + return; + } + + // Strategy 3: Network-First with Offline Fallback for HTML Pages / Navigation + if (request.mode === "navigate") { + event.respondWith( + fetch(request) + .then((response) => { + if (response && response.status === 200) { + const clone = response.clone(); + caches.open(CACHE_NAME).then((cache) => cache.put(request, clone)); + } + return response; + }) + .catch(async () => { + const cached = await caches.match(request); + if (cached) return cached; + const fallback = await caches.match("/"); + return fallback || offlinePageResponse(); + }), + ); + return; + } + + // Default: Network with Cache Fallback + event.respondWith( + fetch(request).catch(async () => { + const cached = await caches.match(request); + return cached || gatewayTimeoutResponse(); + }), + ); +}); + +// Listen for message to skip waiting on update +self.addEventListener("message", (event) => { + if (event.data && event.data.type === "SKIP_WAITING") { + self.skipWaiting(); + } +}); diff --git a/apps/web/src/app/api/app-update/route.ts b/apps/web/src/app/api/app-update/route.ts index b160eb3..99dc176 100644 --- a/apps/web/src/app/api/app-update/route.ts +++ b/apps/web/src/app/api/app-update/route.ts @@ -8,7 +8,6 @@ import { appUpdateIsAvailable, OFFICIAL_UPDATE_GUIDE_URL, type AppUpdateStatus } import { SKF_CREATED_WITH_VERSION } from "@/lib/skfProject"; export const runtime = "nodejs"; -export const dynamic = "force-dynamic"; export const revalidate = false; const DEFAULT_MANIFEST_URL = "https://raw.githubusercontent.com/Formsmith746/SketchForge-3D/main/package.json"; diff --git a/apps/web/src/app/gizlilik/page.tsx b/apps/web/src/app/gizlilik/page.tsx new file mode 100644 index 0000000..960c0a9 --- /dev/null +++ b/apps/web/src/app/gizlilik/page.tsx @@ -0,0 +1,7 @@ +"use client"; + +import KVKKPage from "../kvkk/page"; + +export default function GizlilikPage() { + return
- SketchForge
+ SnapCAD STUDIO
- Do you actually want the project {projectPendingDelete.name} to be deleted? +
+ {projectPendingDelete.name} projesini kalıcı olarak silmek istediğinize emin misiniz?
- Delete {sharedProjectPendingDelete.name} from shared storage? This removes it for everyone using this shared space. +
Do you want to update from version {updateStatus.currentVersion}?
+{updateStatus.currentVersion} sürümünden güncellemek ister misiniz?
/data/projects volume.>
- )}
+ Tarayıcıdaki projeleriniz korunur.