diff --git a/README.md b/README.md index 5d5e850..1cc4fee 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ Source code of [https://xmr.ditatompel.com](https://xmr.ditatompel.com), a websi ### Server & Prober requirements -- Go >= 1.22 -- Linux Machine (AMD64 or ARM64) +- Go >= 1.22 +- Linux Machine (AMD64 or ARM64) ### Server requirements -- MySQL/MariaDB -- [GeoIP Database](https://dev.maxmind.com/geoip/geoip2/geolite2/) (optional). Place it to `./assets/geoip`, see [./internal/geo/ip.go](./internal/geo/ip.go). +- MySQL/MariaDB +- [GeoIP Database](https://dev.maxmind.com/geoip/geoip2/geolite2/) (optional). Place it to `./assets/geoip`, see [./internal/geo/ip.go](./internal/geo/ip.go). ## Installation @@ -23,8 +23,6 @@ Source code of [https://xmr.ditatompel.com](https://xmr.ditatompel.com), a websi 3. Build the binary with `make build`. 4. Run the service with `./bin/xmr-nodes-server-linux- serve`. -To create admin user (for creating proberAPI key from Web-UI, execute `./bin/xmr-nodes-server-linux- admin create`). - Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resources/init/xmr-nodes-server.service). ### For initial prober setup: @@ -35,4 +33,3 @@ Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resou 4. Run the service with `./bin/xmr-nodes-client-linux- probe`. Systemd example: [xmr-nodes-prober.service](./tools/resources/init/xmr-nodes-prober.service) and [xmr-nodes-prober.timer](./tools/resources/init/xmr-nodes-prober.timer). - diff --git a/frontend/README.md b/frontend/README.md index 20d170f..0e4ddb5 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,35 +1,3 @@ # UI -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. - -## Deploying - -after running `npm run build` from development device, copy `./build`, `package.json` and `package-lock.json` to server. On the server, run `npm ci --omit dev` then restart the systemd service. - -Playbook example (run from root project): -```shell -ansible-playbook -i ./utils/ansible/inventory.ini -l production ./utils/ansible/deploy.yml -K -``` +The UI is generated and embedded when the Go project is built. See [./frontend/embed.go](https://github.com/ditatompel/xmr-remote-nodes/blob/main/frontend/embed.go#L10-L13). diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js index 2e7af2b..0f77216 100644 --- a/frontend/postcss.config.js +++ b/frontend/postcss.config.js @@ -1,6 +1,6 @@ export default { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} + plugins: { + tailwindcss: {}, + autoprefixer: {} + } +}; diff --git a/frontend/src/app.css b/frontend/src/app.css index c7bdac1..d65f56b 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -8,19 +8,18 @@ body { @apply h-full; } p { - @apply mb-2; + @apply mb-2; } .link { - @apply text-primary-800 dark:text-primary-500 hover:brightness-110; + @apply text-primary-800 dark:text-primary-500 hover:brightness-110; } a.external { - @apply link after:content-['_↗'] + @apply link after:content-['_↗']; } .section-container { - @apply mx-auto w-full max-w-7xl p-4; + @apply mx-auto w-full max-w-7xl p-4; } .hero-gradient { - background-image: - radial-gradient(at 0% 0%, rgba(242, 104, 34, .4) 0px, transparent 50%), - radial-gradient(at 98% 1%, rgba(var(--color-warning-900) / 0.33) 0px, transparent 50%); + background-image: radial-gradient(at 0% 0%, rgba(242, 104, 34, 0.4) 0px, transparent 50%), + radial-gradient(at 98% 1%, rgba(var(--color-warning-900) / 0.33) 0px, transparent 50%); } diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts index b2c6e13..b8cff3e 100644 --- a/frontend/src/app.d.ts +++ b/frontend/src/app.d.ts @@ -1,33 +1,33 @@ // See https://kit.svelte.dev/docs/types#app // for information about these interfaces declare global { - namespace App { - // interface Error {} - // interface Locals {} - // interface PageData {} - // interface PageState {} - // interface Platform {} - } - interface ImportMetaEnv { - VITE_API_URL: string; - } + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface PageState {} + // interface Platform {} + } + interface ImportMetaEnv { + VITE_API_URL: string; + } - interface MoneroNode { - id: number; - hostname: string; - ip: string; - port: number; - protocol: string; - is_tor: boolean; - is_available: boolean; - nettype: string; - } + interface MoneroNode { + id: number; + hostname: string; + ip: string; + port: number; + protocol: string; + is_tor: boolean; + is_available: boolean; + nettype: string; + } - interface ApiResponse { - status: string; - message: string; - data: null | object | object[]; - } + interface ApiResponse { + status: string; + message: string; + data: null | object | object[]; + } } export {}; diff --git a/frontend/src/app.html b/frontend/src/app.html index c128778..4721f4c 100644 --- a/frontend/src/app.html +++ b/frontend/src/app.html @@ -4,7 +4,7 @@ - + %sveltekit.head% diff --git a/frontend/src/lib/components/datatables/server/DtSrSearch.svelte b/frontend/src/lib/components/datatables/server/DtSrSearch.svelte index b7087fe..962624a 100644 --- a/frontend/src/lib/components/datatables/server/DtSrSearch.svelte +++ b/frontend/src/lib/components/datatables/server/DtSrSearch.svelte @@ -16,7 +16,7 @@ { }; export const loadCountries = async () => { - const response = await fetch(apiUri('/api/v1/countries')); - const json = await response.json(); - return json.data ?? []; + const response = await fetch(apiUri('/api/v1/countries')); + const json = await response.json(); + return json.data ?? []; }; const getParams = ({ pageNumber, rowsPerPage, sort, filters }) => { diff --git a/frontend/static/manifest.json b/frontend/static/manifest.json index 2f1fa03..ee01e11 100644 --- a/frontend/static/manifest.json +++ b/frontend/static/manifest.json @@ -1,63 +1,66 @@ { - "name": "xmr.ditatompel.com", - "short_name": "xmr-remote-nodes", - "start_url": "/", - "display": "standalone", - "background_color": "#272b31", - "theme_color": "#272b31", - "description": "Monero Remote Nodes", - "icons": [{ - "src": "/img/icon/android-icon-36x36.png", - "sizes": "36x36", - "type": "image/png", - "purpose": "any", - "density": "0.75" - }, { - "src": "/img/icon/android-icon-48x48.png", - "sizes": "48x48", - "type": "image/png", - "purpose": "any", - "density": "1.0" - }, - { - "src": "/img/icon/android-icon-72x72.png", - "sizes": "72x72", - "type": "image/png", - "purpose": "any", - "density": "1.5" - }, - { - "src": "/img/icon/android-icon-96x96.png", - "sizes": "96x96", - "type": "image/png", - "purpose": "any", - "density": "2.0" - }, - { - "src": "/img/icon/android-icon-144x144.png", - "sizes": "144x144", - "type": "image/png", - "purpose": "any", - "density": "3.0" - }, - { - "src": "/img/icon/android-icon-192x192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "any", - "density": "4.0" - }, - { - "src": "/img/icon/android-icon-512x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "any", - "density": "4.0" - }, - { - "src": "/img/icon/maskable-512x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - }] + "name": "xmr.ditatompel.com", + "short_name": "xmr-remote-nodes", + "start_url": "/", + "display": "standalone", + "background_color": "#272b31", + "theme_color": "#272b31", + "description": "Monero Remote Nodes", + "icons": [ + { + "src": "/img/icon/android-icon-36x36.png", + "sizes": "36x36", + "type": "image/png", + "purpose": "any", + "density": "0.75" + }, + { + "src": "/img/icon/android-icon-48x48.png", + "sizes": "48x48", + "type": "image/png", + "purpose": "any", + "density": "1.0" + }, + { + "src": "/img/icon/android-icon-72x72.png", + "sizes": "72x72", + "type": "image/png", + "purpose": "any", + "density": "1.5" + }, + { + "src": "/img/icon/android-icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "purpose": "any", + "density": "2.0" + }, + { + "src": "/img/icon/android-icon-144x144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "any", + "density": "3.0" + }, + { + "src": "/img/icon/android-icon-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any", + "density": "4.0" + }, + { + "src": "/img/icon/android-icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any", + "density": "4.0" + }, + { + "src": "/img/icon/maskable-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] } diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js index a356f7d..6dab6ef 100644 --- a/frontend/tailwind.config.js +++ b/frontend/tailwind.config.js @@ -4,7 +4,7 @@ import forms from '@tailwindcss/forms'; /** @type {import('tailwindcss').Config} */ export default { - darkMode: 'class', + darkMode: 'class', content: [ './src/**/*.{html,js,svelte,ts}', join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}') @@ -13,7 +13,7 @@ export default { extend: {} }, plugins: [ - forms, + forms, skeleton({ themes: { preset: ['skeleton'] diff --git a/frontend/vite.config.js b/frontend/vite.config.js index c2e3de7..4c62442 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -3,7 +3,5 @@ import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; export default defineConfig({ - plugins: [ - sveltekit(), - ] + plugins: [sveltekit()] });