diff --git a/.drone.yml b/.drone.yml index 95efe75..62e235e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,33 +1,2 @@ -kind: pipeline -name: default -type: docker -steps: - - name: server - image: plugins/docker - environment: - DOCKER_BUILDKIT: 1 - settings: - username: kasperhermansen - password: - from_secret: docker_secret - repo: kasperhermansen/scel - tags: latest - context: . - dockerfile: Dockerfile - cache_from: kasperhermansen/scel:latest - when: - event: - include: - - push - - tag - - promote - - - name: send telegram notification - image: appleboy/drone-telegram - settings: - token: - from_secret: telegram_token - to: 2129601481 - format: markdown - when: - status: [failure] +kind: template +load: cuddle-rust-service-plan.yaml diff --git a/cuddle.yaml b/cuddle.yaml new file mode 100644 index 0000000..5f7f35b --- /dev/null +++ b/cuddle.yaml @@ -0,0 +1,21 @@ +# yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json + +base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-service-plan.git" + +vars: + service: "scel" + registry: kasperhermansen + + clusters: + clank-prod: + replicas: "3" + namespace: prod + + +deployment: + registry: git@git.front.kjuulh.io:kjuulh/clank-clusters + env: + prod: + clusters: + - clank-prod + diff --git a/data/downloads/The Blimp Extinction.mp4.part b/data/downloads/The Blimp Extinction.mp4.part new file mode 100644 index 0000000..8705f3a Binary files /dev/null and b/data/downloads/The Blimp Extinction.mp4.part differ diff --git a/src/lib/scel_api/src/lib.rs b/src/lib/scel_api/src/lib.rs index 73de3c4..cd2916f 100644 --- a/src/lib/scel_api/src/lib.rs +++ b/src/lib/scel_api/src/lib.rs @@ -68,7 +68,7 @@ impl Server { .expect("Could not parse url"), ]; - let app = Router::new() + let api_router = Router::new() .route( "/graphql", routing::get(graphql_playground).post(graphql_handler), @@ -93,6 +93,10 @@ impl Server { ) .layer(TraceLayer::new_for_http().make_span_with(DefaultMakeSpan::default())); + let app = Router::new() + .nest("/api", api_router) + .fallback(svc) + let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); Server { app, addr } diff --git a/src/lib/scel_core/src/services/mod.rs b/src/lib/scel_core/src/services/mod.rs index d9497a3..877e49c 100644 --- a/src/lib/scel_core/src/services/mod.rs +++ b/src/lib/scel_core/src/services/mod.rs @@ -44,14 +44,7 @@ impl InMemoryDownloadService { let id = Uuid::new_v4().to_string(); d.id = Some(id.clone()); - downloads.insert( - id.clone(), - ( - Arc::new(Mutex::new(d.clone())), - shared_tx, - rx, - ), - ); + downloads.insert(id.clone(), (Arc::new(Mutex::new(d.clone())), shared_tx, rx)); let args = vec![ Arg::new("--progress"), diff --git a/src/web/src/App.css b/src/web/src/App.css deleted file mode 100644 index 2c5e2ef..0000000 --- a/src/web/src/App.css +++ /dev/null @@ -1,41 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/src/web/src/App.tsx b/src/web/src/App.tsx index cd20136..c06c5fc 100644 --- a/src/web/src/App.tsx +++ b/src/web/src/App.tsx @@ -1,34 +1,12 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import './App.css' +import Body from "./components/body/Body" +import Navbar from "./components/navbar/Navbar" +import RequestDownload from "./components/request-download/RequestDownload" -function App() { - const [count, setCount] = useState(0) - - return ( -
-
- - Vite logo - - - React logo - -
-

Vite + React

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

-
- ) -} +const App = () =>
+ + + + +
export default App diff --git a/src/web/src/components/body/Body.tsx b/src/web/src/components/body/Body.tsx new file mode 100644 index 0000000..e6a50ee --- /dev/null +++ b/src/web/src/components/body/Body.tsx @@ -0,0 +1,8 @@ +import { FC, ReactNode } from "react" + +interface BodyProps { + children?: ReactNode +} +const Body: FC = ({ children }) =>
{children}
+ +export default Body diff --git a/src/web/src/components/navbar/Navbar.tsx b/src/web/src/components/navbar/Navbar.tsx new file mode 100644 index 0000000..c1895d9 --- /dev/null +++ b/src/web/src/components/navbar/Navbar.tsx @@ -0,0 +1,10 @@ +import { getServerUrl } from "../../lib/env" + +const Navbar = () => { + return +} + +export default Navbar diff --git a/src/web/src/components/request-download/RequestDownload.tsx b/src/web/src/components/request-download/RequestDownload.tsx new file mode 100644 index 0000000..4a147ed --- /dev/null +++ b/src/web/src/components/request-download/RequestDownload.tsx @@ -0,0 +1,7 @@ +const RequestDownload = () => { + return
+ +
+} + +export default RequestDownload diff --git a/src/web/src/index.css b/src/web/src/index.css deleted file mode 100644 index 917888c..0000000 --- a/src/web/src/index.css +++ /dev/null @@ -1,70 +0,0 @@ -:root { - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 24px; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} diff --git a/src/web/src/lib/env.ts b/src/web/src/lib/env.ts new file mode 100644 index 0000000..016c0eb --- /dev/null +++ b/src/web/src/lib/env.ts @@ -0,0 +1,3 @@ +export const getServerUrl = (): string => { + return import.meta.env.VITE_SERVER_BASE_URL +} diff --git a/src/web/src/main.tsx b/src/web/src/main.tsx index 611e848..197a6e3 100644 --- a/src/web/src/main.tsx +++ b/src/web/src/main.tsx @@ -1,7 +1,6 @@ import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' -import './index.css' ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(