chore: Fix formatting (prettier)

This commit is contained in:
ditatompel 2024-05-28 10:03:29 +07:00
parent 38320bc316
commit 8df90ef5e2
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
12 changed files with 114 additions and 149 deletions

View file

@ -6,13 +6,13 @@ Source code of [https://xmr.ditatompel.com](https://xmr.ditatompel.com), a websi
### Server & Prober requirements ### Server & Prober requirements
- Go >= 1.22 - Go >= 1.22
- Linux Machine (AMD64 or ARM64) - Linux Machine (AMD64 or ARM64)
### Server requirements ### Server requirements
- MySQL/MariaDB - 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). - [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 ## 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`. 3. Build the binary with `make build`.
4. Run the service with `./bin/xmr-nodes-server-linux-<YOUR_CPU_ARCH> serve`. 4. Run the service with `./bin/xmr-nodes-server-linux-<YOUR_CPU_ARCH> serve`.
To create admin user (for creating proberAPI key from Web-UI, execute `./bin/xmr-nodes-server-linux-<YOUR_CPU_ARCH> admin create`).
Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resources/init/xmr-nodes-server.service). Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resources/init/xmr-nodes-server.service).
### For initial prober setup: ### 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-<YOUR_CPU_ARCH> probe`. 4. Run the service with `./bin/xmr-nodes-client-linux-<YOUR_CPU_ARCH> 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). 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).

View file

@ -1,35 +1,3 @@
# UI # UI
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). 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).
## 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
```

View file

@ -1,6 +1,6 @@
export default { export default {
plugins: { plugins: {
tailwindcss: {}, tailwindcss: {},
autoprefixer: {}, autoprefixer: {}
}, }
} };

View file

@ -8,19 +8,18 @@ body {
@apply h-full; @apply h-full;
} }
p { p {
@apply mb-2; @apply mb-2;
} }
.link { .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 { a.external {
@apply link after:content-['_↗'] @apply link after:content-['_↗'];
} }
.section-container { .section-container {
@apply mx-auto w-full max-w-7xl p-4; @apply mx-auto w-full max-w-7xl p-4;
} }
.hero-gradient { .hero-gradient {
background-image: background-image: radial-gradient(at 0% 0%, rgba(242, 104, 34, 0.4) 0px, transparent 50%),
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%);
radial-gradient(at 98% 1%, rgba(var(--color-warning-900) / 0.33) 0px, transparent 50%);
} }

50
frontend/src/app.d.ts vendored
View file

@ -1,33 +1,33 @@
// See https://kit.svelte.dev/docs/types#app // See https://kit.svelte.dev/docs/types#app
// for information about these interfaces // for information about these interfaces
declare global { declare global {
namespace App { namespace App {
// interface Error {} // interface Error {}
// interface Locals {} // interface Locals {}
// interface PageData {} // interface PageData {}
// interface PageState {} // interface PageState {}
// interface Platform {} // interface Platform {}
} }
interface ImportMetaEnv { interface ImportMetaEnv {
VITE_API_URL: string; VITE_API_URL: string;
} }
interface MoneroNode { interface MoneroNode {
id: number; id: number;
hostname: string; hostname: string;
ip: string; ip: string;
port: number; port: number;
protocol: string; protocol: string;
is_tor: boolean; is_tor: boolean;
is_available: boolean; is_available: boolean;
nettype: string; nettype: string;
} }
interface ApiResponse { interface ApiResponse {
status: string; status: string;
message: string; message: string;
data: null | object | object[]; data: null | object | object[];
} }
} }
export {}; export {};

View file

@ -4,7 +4,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> <link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" /> <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
%sveltekit.head% %sveltekit.head%
</head> </head>
<body data-sveltekit-preload-data="false" data-theme="skeleton"> <body data-sveltekit-preload-data="false" data-theme="skeleton">

View file

@ -16,7 +16,7 @@
<input <input
class="input-variant-secondary input w-36 sm:w-64" class="input-variant-secondary input w-36 sm:w-64"
type="search" type="search"
name="tableGlobalSearch" name="tableGlobalSearch"
placeholder="Search..." placeholder="Search..."
bind:value bind:value
on:input={search} on:input={search}

View file

@ -1,2 +1,2 @@
export const prerender = true export const prerender = true;
export const trailingSlash = 'always'; export const trailingSlash = 'always';

View file

@ -9,9 +9,9 @@ export const loadData = async (state) => {
}; };
export const loadCountries = async () => { export const loadCountries = async () => {
const response = await fetch(apiUri('/api/v1/countries')); const response = await fetch(apiUri('/api/v1/countries'));
const json = await response.json(); const json = await response.json();
return json.data ?? []; return json.data ?? [];
}; };
const getParams = ({ pageNumber, rowsPerPage, sort, filters }) => { const getParams = ({ pageNumber, rowsPerPage, sort, filters }) => {

View file

@ -1,63 +1,66 @@
{ {
"name": "xmr.ditatompel.com", "name": "xmr.ditatompel.com",
"short_name": "xmr-remote-nodes", "short_name": "xmr-remote-nodes",
"start_url": "/", "start_url": "/",
"display": "standalone", "display": "standalone",
"background_color": "#272b31", "background_color": "#272b31",
"theme_color": "#272b31", "theme_color": "#272b31",
"description": "Monero Remote Nodes", "description": "Monero Remote Nodes",
"icons": [{ "icons": [
"src": "/img/icon/android-icon-36x36.png", {
"sizes": "36x36", "src": "/img/icon/android-icon-36x36.png",
"type": "image/png", "sizes": "36x36",
"purpose": "any", "type": "image/png",
"density": "0.75" "purpose": "any",
}, { "density": "0.75"
"src": "/img/icon/android-icon-48x48.png", },
"sizes": "48x48", {
"type": "image/png", "src": "/img/icon/android-icon-48x48.png",
"purpose": "any", "sizes": "48x48",
"density": "1.0" "type": "image/png",
}, "purpose": "any",
{ "density": "1.0"
"src": "/img/icon/android-icon-72x72.png", },
"sizes": "72x72", {
"type": "image/png", "src": "/img/icon/android-icon-72x72.png",
"purpose": "any", "sizes": "72x72",
"density": "1.5" "type": "image/png",
}, "purpose": "any",
{ "density": "1.5"
"src": "/img/icon/android-icon-96x96.png", },
"sizes": "96x96", {
"type": "image/png", "src": "/img/icon/android-icon-96x96.png",
"purpose": "any", "sizes": "96x96",
"density": "2.0" "type": "image/png",
}, "purpose": "any",
{ "density": "2.0"
"src": "/img/icon/android-icon-144x144.png", },
"sizes": "144x144", {
"type": "image/png", "src": "/img/icon/android-icon-144x144.png",
"purpose": "any", "sizes": "144x144",
"density": "3.0" "type": "image/png",
}, "purpose": "any",
{ "density": "3.0"
"src": "/img/icon/android-icon-192x192.png", },
"sizes": "192x192", {
"type": "image/png", "src": "/img/icon/android-icon-192x192.png",
"purpose": "any", "sizes": "192x192",
"density": "4.0" "type": "image/png",
}, "purpose": "any",
{ "density": "4.0"
"src": "/img/icon/android-icon-512x512.png", },
"sizes": "512x512", {
"type": "image/png", "src": "/img/icon/android-icon-512x512.png",
"purpose": "any", "sizes": "512x512",
"density": "4.0" "type": "image/png",
}, "purpose": "any",
{ "density": "4.0"
"src": "/img/icon/maskable-512x512.png", },
"sizes": "512x512", {
"type": "image/png", "src": "/img/icon/maskable-512x512.png",
"purpose": "maskable" "sizes": "512x512",
}] "type": "image/png",
"purpose": "maskable"
}
]
} }

View file

@ -4,7 +4,7 @@ import forms from '@tailwindcss/forms';
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
export default { export default {
darkMode: 'class', darkMode: 'class',
content: [ content: [
'./src/**/*.{html,js,svelte,ts}', './src/**/*.{html,js,svelte,ts}',
join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}') join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}')
@ -13,7 +13,7 @@ export default {
extend: {} extend: {}
}, },
plugins: [ plugins: [
forms, forms,
skeleton({ skeleton({
themes: { themes: {
preset: ['skeleton'] preset: ['skeleton']

View file

@ -3,7 +3,5 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [sveltekit()]
sveltekit(),
]
}); });