Compare commits

..
16 Commits
Author SHA1 Message Date
nobswebdev c2933734ee Show empty lines in product and blog descriptions. 2026-11-25 21:57:19 +00:00
nobswebdev 1d512bf582 List Electrum passwords in the deployment guide in sample env order. 2026-11-25 21:18:43 +00:00
nobswebdev 9e33aab9f9 Use the promo shield as the CMS favicon. 2026-11-25 21:16:16 +00:00
nobswebdev 32b3a83cd6 Accept only true and false for migration env flag.
Boolean conversion treated every non-empty string as enabled, so a typo could pass validation.
2026-11-25 20:56:54 +00:00
nobswebdev 1e7edda6f2 Disable nginx access and error request logs.
Request lines were keeping client addresses and paths for as long as the container existed.
2026-11-25 20:42:19 +00:00
nobswebdev 8b56a9a5a9 Serve /cms without a slash redirect.
Nginx was turning that redirect into an onion URL on port 8080, which Tor does not publish.
2026-11-25 20:15:39 +00:00
nobswebdev e0e06eefa4 Enable CORS only in development.
Production serves the CMS and API on one origin, so the allowlist is only needed while they run on separate ports.
2026-11-25 19:20:02 +00:00
nobswebdev cccc8596e6 Pin nginx, Postgres, and pgAdmin image versions.
Stops floating tags from changing the runtime on the next pull.
2026-11-25 19:01:55 +00:00
nobswebdev 35feda1278 Wrap long unbroken text in chat and delivery content.
overflow-wrap: anywhere lets addresses and similar strings break inside the bubble instead of stretching the layout.
2026-11-24 23:26:15 +00:00
nobswebdev a6e60408d6 change default electrum testnet server 2026-11-24 21:28:08 +00:00
nobswebdev 6ebb8161b9 Add product sortOrder for admin-controlled storefront list order.
Storefront and CMS lists sort by sortOrder ascending with createdAt descending as tie-break; existing rows default to 0.
2026-11-22 02:26:41 +00:00
nobswebdev ba0af1afd9 Preserve product-list scroll when switching variants.
Append #product-card-{variantId} to index selection links so the browser restores the card after the full-page reload, matching add-to-cart.
2026-11-21 23:34:44 +00:00
nobswebdev 3577c9dc16 npm audit fix 2026-11-21 23:13:03 +00:00
nobswebdev bf422b8529 add Whonix development instruction 2026-11-20 15:50:20 +00:00
nobswebdevandCursor ff5fbb649f Pin Electrum daemon to the configured server only.
Prevents auto-connect from hopping onto random public peers that can leave the wallet stuck at server height 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 21:57:57 +00:00
nobswebdev 633099371d add missing log about postgres running in backup.sh 2026-11-15 00:53:51 +01:00
39 changed files with 1869 additions and 1532 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ BITCOIN_MIN_INCOMING_ATOMIC=7 # 0.00000007 BTC (~half a USD cent at that moment)
ELECTRUM_VERSION=4.8.1 ELECTRUM_VERSION=4.8.1
ELECTRUM_NETWORK=testnet4 ELECTRUM_NETWORK=testnet4
ELECTRUM_SERVER=testnet4-electrumx.wakiyamap.dev:51002:s ELECTRUM_SERVER=blackie.c3-soft.com:57010:s
ELECTRUM_DAEMON_HOST=electrum-daemon ELECTRUM_DAEMON_HOST=electrum-daemon
ELECTRUM_DAEMON_PORT=7777 ELECTRUM_DAEMON_PORT=7777
ELECTRUM_DAEMON_RPC_USER=electrum ELECTRUM_DAEMON_RPC_USER=electrum
+37
View File
@@ -53,6 +53,43 @@ npm run typeorm:revert-migration
npm run typeorm:create-migration --name=<migration_name> npm run typeorm:create-migration --name=<migration_name>
``` ```
### Development on Whonix
Bridge networking needs a one-time Workstation firewall allow for `nullcart0` + `docker0` (sudo required).
`/usr/bin/user-firewall-script`:
```bash
#!/bin/bash
# nullcart0: running compose stack
nft insert rule inet filter forward iifname "nullcart0" counter accept
nft insert rule inet filter forward oifname "nullcart0" counter accept
# docker0: image builds (apk/apt/npm)
nft insert rule inet filter forward iifname "docker0" counter accept
nft insert rule inet filter forward oifname "docker0" counter accept
```
`/lib/systemd/system/whonix-firewall.service.d/50_user.conf`:
```
[Service]
ExecStartPost=/usr/bin/user-firewall-script
```
```bash
sudo chmod +x /usr/bin/user-firewall-script
sudo systemctl daemon-reload
sudo whonix_firewall
```
```bash
# Build and start docker containers
docker compose --env-file .env.dev -f docker-compose.dev.yml -f docker-compose.dev.whonix.yml build --no-cache
docker compose --env-file .env.dev -f docker-compose.dev.yml -f docker-compose.dev.whonix.yml up --force-recreate
```
## Tests ## Tests
### Backend unit tests ### Backend unit tests
+1053 -1053
View File
File diff suppressed because it is too large Load Diff
+105
View File
@@ -0,0 +1,105 @@
import 'reflect-metadata';
import { validate } from './validate';
const validConfig = (overrides: Record<string, unknown> = {}): Record<string, unknown> => ({
NODE_ENV: 'development',
BACKEND_PORT: 3000,
POSTGRES_USER: 'postgres',
POSTGRES_PASSWORD: 'postgres',
POSTGRES_DB: 'nullcart',
POSTGRES_HOST: 'postgres',
POSTGRES_PORT: 5432,
POSTGRES_MIGRATIONS_RUN: 'false',
CORS_ORIGINS: 'http://localhost:5173',
JWT_SECRET: 'secret',
JWT_EXPIRES_IN_MS: 604800000,
CMS_PASSWORD: 'change-me',
SHOP_NAME: 'NullCart',
SHOP_FIAT_CURRENCY: 'USD',
MULTER_PRODUCT_THUMB_ALLOWED_MIMES: 'image/jpeg',
MULTER_PRODUCT_THUMB_MAX_FILE_BYTES: 1048576,
MULTER_BLOG_IMAGE_ALLOWED_MIMES: 'image/jpeg',
MULTER_BLOG_IMAGE_MAX_FILE_BYTES: 1048576,
MULTER_SHOP_LOGO_ALLOWED_MIMES: 'image/jpeg',
MULTER_SHOP_LOGO_MAX_FILE_BYTES: 1048576,
MULTER_SHOP_FAVICON_ALLOWED_MIMES: 'image/png',
MULTER_SHOP_FAVICON_MAX_FILE_BYTES: 262144,
VALIDATION_PRODUCT_TITLE_MAX_LENGTH: 100,
VALIDATION_BLOG_POST_TITLE_MAX_LENGTH: 200,
VALIDATION_CATEGORY_NAME_MAX_LENGTH: 50,
VALIDATION_DISCOUNT_CODE_MAX_LENGTH: 32,
VALIDATION_VARIANT_IMAGES_MAX: 10,
MULTER_DIGITAL_STOCK_ATTACHMENT_ALLOWED_MIMES: 'application/pdf',
MULTER_DIGITAL_STOCK_ATTACHMENT_MAX_FILE_BYTES: 5242880,
VALIDATION_DIGITAL_STOCK_ATTACHMENTS_MAX: 5,
VALIDATION_SHIPPING_NOTE_MIN_LENGTH: 20,
VALIDATION_SHIPPING_NOTE_MAX_LENGTH: 4000,
VALIDATION_ORDER_MESSAGE_MAX_LENGTH: 2000,
VALIDATION_BITCOIN_WITHDRAW_MAX_FEE_RATE_SAT_VBYTE: 500,
CAPTCHA_LENGTH: 5,
THROTTLE_TTL_MS: 60000,
THROTTLE_LIMIT: 120,
SIGNED_COOKIE_JWT_SECRET: 'secret',
SIGNED_COOKIE_FEEDBACK_NAME: 'storefront_feedback',
SIGNED_COOKIE_FEEDBACK_EXPIRES_IN_MS: 120000,
SIGNED_COOKIE_CART_NAME: 'storefront_cart',
SIGNED_COOKIE_CART_EXPIRES_IN_MS: 2592000000,
SIGNED_COOKIE_CAPTCHA_NAME: 'storefront_captcha',
SIGNED_COOKIE_CAPTCHA_EXPIRES_IN_MS: 300000,
SIGNED_COOKIE_DISCOUNT_NAME: 'storefront_discount',
SIGNED_COOKIE_DISCOUNT_EXPIRES_IN_MS: 2592000000,
SIGNED_COOKIE_ERROR_NAME: 'storefront_error',
SIGNED_COOKIE_ERROR_EXPIRES_IN_MS: 120000,
SIGNED_COOKIE_CHECKOUT_SESSION_NAME: 'storefront_checkout_session',
SIGNED_COOKIE_ORDER_AUTH_NAME: 'storefront_order_auth',
SIGNED_COOKIE_ORDER_AUTH_EXPIRES_IN_MS: 604800000,
SIGNED_COOKIE_THEME_NAME: 'storefront_theme',
SIGNED_COOKIE_THEME_EXPIRES_IN_MS: 31536000000,
COINGECKO_API_BASE_URL: 'https://api.coingecko.com/api/v3',
COINPAPRIKA_API_BASE_URL: 'https://api.coinpaprika.com/v1',
COINPAPRIKA_RATE_FETCH_TIMEOUT_MS: 5000,
COINGECKO_RATE_FETCH_TIMEOUT_MS: 5000,
BASE64_ENCRYPTION_KEY: 'nyRya1KpYSQ+drpO132mkOEMUR+uq6K7tWvpMfppIME=',
MONERO_CONFIRMATION_TIERS:
'[{"upToTotalFiat":"30","minConfirmations":1},{"upToTotalFiat":"100","minConfirmations":3},{"minConfirmations":10}]',
BITCOIN_CONFIRMATION_TIERS:
'[{"upToTotalFiat":"200","minConfirmations":1},{"upToTotalFiat":"1000","minConfirmations":2},{"minConfirmations":6}]',
PAYMENT_METHODS_ENABLED: 'xmr,btc',
ORDER_CHECKOUT_VALIDITY_MS: 3600000,
ORDER_CHECKOUT_STATUS_REFRESH_SEC: 15,
ORDER_SHIPPING_PAYMENT_VALIDITY_MS: 259200000,
ORDER_DATA_RETENTION_DAYS: 30,
MONERO_MIN_INCOMING_ATOMIC: 10000000,
BITCOIN_MIN_INCOMING_ATOMIC: 7,
MONERO_DAEMON_ADDRESS: 'xmr-lux.boldsuck.org:38081',
MONERO_NETWORK: 'stagenet',
MONERO_WALLET_RPC_HOST: 'monero-wallet-rpc',
MONERO_WALLET_RPC_PORT: 18083,
MONERO_WALLET_RPC_USERNAME: 'monero',
MONERO_WALLET_RPC_PASSWORD: 'monero',
MONERO_WALLET_RPC_TIMEOUT_MS: 10000,
ELECTRUM_NETWORK: 'testnet4',
ELECTRUM_SERVER: 'blackie.c3-soft.com:57010:s',
ELECTRUM_DAEMON_HOST: 'electrum-daemon',
ELECTRUM_DAEMON_PORT: 7777,
ELECTRUM_DAEMON_RPC_USER: 'electrum',
ELECTRUM_DAEMON_RPC_PASSWORD: 'change-me',
ELECTRUM_DAEMON_RPC_TIMEOUT_MS: 10000,
ELECTRUM_WALLET_PASSWORD: 'change-me',
SIMPLEX_WS_URL: 'ws://simplex-cli:5225',
SIMPLEX_BOT_DISPLAY_NAME: 'NullCartBot',
...overrides
});
describe('validate', () => {
it('accepts true and false for POSTGRES_MIGRATIONS_RUN', () => {
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: 'true' }))).not.toThrow();
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: 'false' }))).not.toThrow();
});
it('rejects non-literal boolean env values', () => {
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: 'yes' }))).toThrow();
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: '1' }))).toThrow();
expect(() => validate(validConfig({ POSTGRES_MIGRATIONS_RUN: '' }))).toThrow();
});
});
+16 -3
View File
@@ -1,6 +1,18 @@
import { plainToClass } from 'class-transformer'; import { plainToClass } from 'class-transformer';
import { IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsString, Max, Min, validateSync } from 'class-validator'; import {
IsEnum,
IsIn,
IsNotEmpty,
IsNumber,
IsString,
Max,
Min,
ValidateIf,
validateSync
} from 'class-validator';
import { BOOLEAN_STRING_VALUES } from '../consts/booleanStringValues';
import { NodeEnv } from '../types/NodeEnv'; import { NodeEnv } from '../types/NodeEnv';
import type { BooleanStringValue } from '../types/BooleanStringValue';
import { ShopFiatCurrency } from '../types/ShopFiatCurrency'; import { ShopFiatCurrency } from '../types/ShopFiatCurrency';
import { IsBase64 } from '../validation/decorators/isBase64'; import { IsBase64 } from '../validation/decorators/isBase64';
import { IsConfirmationTiers } from '../validation/decorators/isConfirmationTiers'; import { IsConfirmationTiers } from '../validation/decorators/isConfirmationTiers';
@@ -38,9 +50,10 @@ class EnvironmentVariables {
POSTGRES_PORT: number; POSTGRES_PORT: number;
@IsNotEmpty() @IsNotEmpty()
@IsBoolean() @IsIn(BOOLEAN_STRING_VALUES)
POSTGRES_MIGRATIONS_RUN: boolean; POSTGRES_MIGRATIONS_RUN: BooleanStringValue;
@ValidateIf((config: EnvironmentVariables) => config.NODE_ENV === NodeEnv.Development)
@IsNotEmpty() @IsNotEmpty()
@IsString() @IsString()
CORS_ORIGINS: string; CORS_ORIGINS: string;
@@ -0,0 +1 @@
export const BOOLEAN_STRING_VALUES = ['true', 'false'] as const;
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddProductSortOrder1785000000000 implements MigrationInterface {
name = 'AddProductSortOrder1785000000000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "products" ADD "sortOrder" integer NOT NULL DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "products" DROP COLUMN "sortOrder"`);
}
}
+2
View File
@@ -106,10 +106,12 @@ async function bootstrap() {
] ]
}); });
if (nodeEnv === NodeEnv.Development) {
app.enableCors({ app.enableCors({
origin: corsOrigins, origin: corsOrigins,
credentials: true credentials: true
}); });
}
await app.listen(port); await app.listen(port);
} }
@@ -1,4 +1,4 @@
import { IsArray, IsBoolean, IsNotEmpty, IsString, IsUUID, MaxLength } from 'class-validator'; import { IsArray, IsBoolean, IsInt, IsNotEmpty, IsString, IsUUID, MaxLength, Min } from 'class-validator';
import { getAppConfig } from '../../../config'; import { getAppConfig } from '../../../config';
@@ -22,4 +22,9 @@ export class UpdateProductDto {
@IsArray() @IsArray()
@IsUUID('4', { each: true }) @IsUUID('4', { each: true })
categoryIds: string[]; categoryIds: string[];
@IsNotEmpty()
@IsInt()
@Min(0)
sortOrder: number;
} }
@@ -29,6 +29,9 @@ export class Product {
@Column({ type: 'text', default: '' }) @Column({ type: 'text', default: '' })
descriptionHtml: string; descriptionHtml: string;
@Column({ type: 'integer', default: 0 })
sortOrder: number;
@OneToMany(() => ProductVariant, variant => variant.product) @OneToMany(() => ProductVariant, variant => variant.product)
variants: ProductVariant[]; variants: ProductVariant[];
@@ -41,7 +41,7 @@ export class ProductsService {
const [products, total] = await this.productRepo.findAndCount({ const [products, total] = await this.productRepo.findAndCount({
where: trimmedSearch ? { title: ILike(`%${trimmedSearch}%`) } : {}, where: trimmedSearch ? { title: ILike(`%${trimmedSearch}%`) } : {},
order: { createdAt: 'DESC' }, order: { sortOrder: 'ASC', createdAt: 'DESC' },
skip: (page - 1) * limit, skip: (page - 1) * limit,
take: limit take: limit
}); });
@@ -56,6 +56,7 @@ export class ProductsService {
where: { id: In(productIds) }, where: { id: In(productIds) },
relations: ['categories', 'variants'], relations: ['categories', 'variants'],
order: { order: {
sortOrder: 'ASC',
createdAt: 'DESC', createdAt: 'DESC',
variants: { sortOrder: 'ASC', createdAt: 'ASC' } variants: { sortOrder: 'ASC', createdAt: 'ASC' }
} }
@@ -125,6 +126,7 @@ export class ProductsService {
where: { id: In(uniqueIds) }, where: { id: In(uniqueIds) },
relations: ['variants'], relations: ['variants'],
order: { order: {
sortOrder: 'ASC',
createdAt: 'DESC', createdAt: 'DESC',
variants: { sortOrder: 'ASC', createdAt: 'ASC' } variants: { sortOrder: 'ASC', createdAt: 'ASC' }
} }
@@ -164,7 +166,7 @@ export class ProductsService {
async update( async update(
id: string, id: string,
{ title, descriptionHtml, isDraft, categoryIds }: UpdateProductDto { title, descriptionHtml, isDraft, categoryIds, sortOrder }: UpdateProductDto
): Promise<ProductWithVariantsExtended> { ): Promise<ProductWithVariantsExtended> {
const existing = await this.productRepo.findOne({ const existing = await this.productRepo.findOne({
where: { id } where: { id }
@@ -177,6 +179,7 @@ export class ProductsService {
existing.title = title.trim(); existing.title = title.trim();
existing.isDraft = isDraft; existing.isDraft = isDraft;
existing.descriptionHtml = descriptionHtml; existing.descriptionHtml = descriptionHtml;
existing.sortOrder = sortOrder;
existing.categories = await this.categoriesService.findByIds(categoryIds); existing.categories = await this.categoriesService.findByIds(categoryIds);
await this.productRepo.save(existing); await this.productRepo.save(existing);
@@ -531,6 +531,14 @@ a:hover {
margin: 0; margin: 0;
} }
.sf-user-text {
max-width: 100%;
min-width: 0;
white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
}
.sf-info-box p + p, .sf-info-box p + p,
.sf-info-box p + .sf-info-box__title { .sf-info-box p + .sf-info-box__title {
margin-top: var(--sf-space-3); margin-top: var(--sf-space-3);
@@ -1237,6 +1245,11 @@ a:hover {
margin: 0 0 var(--sf-space-3); margin: 0 0 var(--sf-space-3);
} }
.sf-prose p:empty {
min-height: 1lh;
margin: 0;
}
.sf-payment-status { .sf-payment-status {
margin: 0 0 var(--sf-space-3); margin: 0 0 var(--sf-space-3);
font-size: 1.1rem; font-size: 1.1rem;
@@ -1448,8 +1461,11 @@ a:hover {
.sf-delivery-item__content { .sf-delivery-item__content {
margin: 0; margin: 0;
max-width: 100%;
min-width: 0;
font-size: 0.85rem; font-size: 0.85rem;
white-space: pre-wrap; white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word; word-break: break-word;
line-height: 1.45; line-height: 1.45;
} }
@@ -1510,6 +1526,8 @@ a:hover {
.sf-chat-bubble { .sf-chat-bubble {
position: relative; position: relative;
max-width: 100%;
min-width: 0;
border-radius: 0.875rem; border-radius: 0.875rem;
padding: var(--sf-space-3); padding: var(--sf-space-3);
line-height: 1.45; line-height: 1.45;
@@ -1525,7 +1543,11 @@ a:hover {
.sf-chat-bubble p { .sf-chat-bubble p {
margin: 0; margin: 0;
max-width: 100%;
min-width: 0;
white-space: pre-wrap; white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
} }
.sf-chat-meta { .sf-chat-meta {
@@ -9,7 +9,7 @@
</p> </p>
{{#if shippingNote}} {{#if shippingNote}}
<p class='sf-info-box__title'>Typical shipping costs</p> <p class='sf-info-box__title'>Typical shipping costs</p>
<p>{{shippingNote}}</p> <p class='sf-user-text'>{{shippingNote}}</p>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
@@ -1,4 +1,6 @@
import { DeliveryMode } from '../../product/types/DeliveryMode';
import type { CategoriesService } from '../../product/services/CategoriesService'; import type { CategoriesService } from '../../product/services/CategoriesService';
import type { StorefrontProduct } from '../types/StorefrontProduct';
import { StorefrontProductViewService } from './StorefrontProductViewService'; import { StorefrontProductViewService } from './StorefrontProductViewService';
describe('StorefrontProductViewService', () => { describe('StorefrontProductViewService', () => {
@@ -19,4 +21,46 @@ describe('StorefrontProductViewService', () => {
{ id: 'category-2', name: 'Physical', href: '/shop/categories/category-2' } { id: 'category-2', name: 'Physical', href: '/shop/categories/category-2' }
]); ]);
}); });
it('appends product-card anchors to index variant selection hrefs', () => {
const product: StorefrontProduct = {
id: 'product-1',
title: 'Widget',
deliveryMode: DeliveryMode.Auto,
descriptionHtml: null,
variants: [
{
id: 'variant-1',
productId: 'product-1',
productTitle: 'Widget',
title: 'Default',
price: 10,
deliveryMode: DeliveryMode.Auto,
stockAvailable: 1,
stockForSession: 1,
thumbnailUrl: null,
images: []
},
{
id: 'variant-2',
productId: 'product-1',
productTitle: 'Widget',
title: 'Alt',
price: 12,
deliveryMode: DeliveryMode.Auto,
stockAvailable: 1,
stockForSession: 1,
thumbnailUrl: null,
images: []
}
]
};
const [view] = service.toProductsIndexView([product], {});
expect(view.variants.map(variant => variant.selectionHref)).toEqual([
'/#product-card-variant-1',
'/?sel=product-1%3Avariant-2#product-card-variant-2'
]);
});
}); });
@@ -220,11 +220,15 @@ export class StorefrontProductViewService {
} }
private buildIndexUrl(basePath: string, product: StorefrontProduct, variantId: string): string { private buildIndexUrl(basePath: string, product: StorefrontProduct, variantId: string): string {
const anchor = `#product-card-${variantId}`;
if (variantId === product.variants[0].id) { if (variantId === product.variants[0].id) {
return basePath; return `${basePath}${anchor}`;
} }
return `${basePath}?${new URLSearchParams({ sel: `${product.id}:${variantId}` }).toString()}`; const params = new URLSearchParams({ sel: `${product.id}:${variantId}` });
return `${basePath}?${params.toString()}${anchor}`;
} }
async resolveProductBackLink(categoryId?: string): Promise<{ backHref: string; backLabel: string }> { async resolveProductBackLink(categoryId?: string): Promise<{ backHref: string; backLabel: string }> {
@@ -42,6 +42,19 @@ describe('StorefrontProductsService', () => {
); );
}); });
it('orders storefront products by sortOrder then createdAt desc', async () => {
await service.listStorefrontProducts(new Map(), undefined);
expect(productRepo.find).toHaveBeenCalledWith(
expect.objectContaining({
order: expect.objectContaining({
sortOrder: 'ASC',
createdAt: 'DESC'
})
})
);
});
it('returns an empty map when no variant ids are requested', async () => { it('returns an empty map when no variant ids are requested', async () => {
await expect(service.getStorefrontVariantsByIds([], new Map())).resolves.toEqual(new Map()); await expect(service.getStorefrontVariantsByIds([], new Map())).resolves.toEqual(new Map());
expect(variantRepo.find).not.toHaveBeenCalled(); expect(variantRepo.find).not.toHaveBeenCalled();
@@ -63,6 +63,7 @@ export class StorefrontProductsService {
where: categoryId ? { isDraft: false, categories: { id: categoryId } } : { isDraft: false }, where: categoryId ? { isDraft: false, categories: { id: categoryId } } : { isDraft: false },
relations: ['variants', 'variants.images'], relations: ['variants', 'variants.images'],
order: { order: {
sortOrder: 'ASC',
createdAt: 'DESC', createdAt: 'DESC',
variants: { variants: {
sortOrder: 'ASC', sortOrder: 'ASC',
@@ -87,7 +88,6 @@ export class StorefrontProductsService {
where: { id, isDraft: false }, where: { id, isDraft: false },
relations: ['variants', 'variants.images'], relations: ['variants', 'variants.images'],
order: { order: {
createdAt: 'DESC',
variants: { variants: {
sortOrder: 'ASC', sortOrder: 'ASC',
createdAt: 'ASC', createdAt: 'ASC',
+3
View File
@@ -0,0 +1,3 @@
import { BOOLEAN_STRING_VALUES } from '../consts/booleanStringValues';
export type BooleanStringValue = (typeof BOOLEAN_STRING_VALUES)[number];
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>cms</title> <title>cms</title>
</head> </head>
+474 -443
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -11,10 +11,10 @@
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.2", "@element-plus/icons-vue": "^2.3.2",
"@tiptap/extension-link": "^3.22.5", "@tiptap/extension-link": "^3.35.0",
"@tiptap/extension-placeholder": "^3.22.5", "@tiptap/extension-placeholder": "^3.35.0",
"@tiptap/starter-kit": "^3.22.5", "@tiptap/starter-kit": "^3.35.0",
"@tiptap/vue-3": "^3.22.5", "@tiptap/vue-3": "^3.35.0",
"axios": "^1.15.1", "axios": "^1.15.1",
"dayjs": "^1.11.19", "dayjs": "^1.11.19",
"decimal.js": "^10.6.0", "decimal.js": "^10.6.0",
Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.3 KiB

+5
View File
@@ -224,6 +224,7 @@ const scrollToBottom = async (): Promise<void> => {
border-radius: 14px; border-radius: 14px;
line-height: 1.45; line-height: 1.45;
max-width: min(100%, 560px); max-width: min(100%, 560px);
min-width: 0;
} }
.order-chat-message--buyer .order-chat-bubble { .order-chat-message--buyer .order-chat-bubble {
@@ -237,7 +238,11 @@ const scrollToBottom = async (): Promise<void> => {
} }
.order-chat-body { .order-chat-body {
max-width: 100%;
min-width: 0;
white-space: pre-wrap; white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
} }
.order-chat-delete { .order-chat-delete {
@@ -145,9 +145,11 @@ const downloadAttachment = async (
} }
.auto-delivery-item__content { .auto-delivery-item__content {
max-width: 100%;
min-width: 0;
font-size: var(--el-font-size-small); font-size: var(--el-font-size-small);
white-space: pre-wrap; white-space: pre-wrap;
overflow-wrap: break-word; overflow-wrap: anywhere;
word-break: break-word; word-break: break-word;
} }
+1
View File
@@ -211,6 +211,7 @@ onBeforeUnmount(() => {
.rich-text-editor-body :deep(.ProseMirror p) { .rich-text-editor-body :deep(.ProseMirror p) {
margin: 0.35em 0; margin: 0.35em 0;
min-height: 1lh;
} }
.rich-text-editor-body :deep(.ProseMirror h2) { .rich-text-editor-body :deep(.ProseMirror h2) {
+1
View File
@@ -7,6 +7,7 @@ export interface Product {
title: string; title: string;
deliveryMode: DeliveryMode; deliveryMode: DeliveryMode;
isDraft: boolean; isDraft: boolean;
sortOrder: number;
descriptionHtml: string; descriptionHtml: string;
variants?: ProductVariantExtended[]; variants?: ProductVariantExtended[];
categories?: Category[]; categories?: Category[];
@@ -1,6 +1,7 @@
export interface UpdateProductPayload { export interface UpdateProductPayload {
title: string; title: string;
isDraft: boolean; isDraft: boolean;
sortOrder: number;
descriptionHtml: string; descriptionHtml: string;
categoryIds: string[]; categoryIds: string[];
} }
+17 -1
View File
@@ -42,6 +42,15 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="Sort order" prop="sortOrder">
<el-input-number
v-model="productForm.sortOrder"
:min="0"
:step="1"
@update:model-value="productFormRef?.clearValidate('sortOrder')"
/>
</el-form-item>
<el-form-item label="Categories"> <el-form-item label="Categories">
<el-select <el-select
v-model="selectedCategoryIds" v-model="selectedCategoryIds"
@@ -161,7 +170,8 @@ const productFormRef = ref<FormInstance>();
const productForm = reactive({ const productForm = reactive({
title: '', title: '',
descriptionHtml: '', descriptionHtml: '',
isDraft: true isDraft: true,
sortOrder: 0
}); });
const productSaving = ref(false); const productSaving = ref(false);
@@ -175,6 +185,10 @@ const productRules: FormRules = {
message: `At most ${validationProductTitleMaxLength} characters`, message: `At most ${validationProductTitleMaxLength} characters`,
trigger: 'blur' trigger: 'blur'
} }
],
sortOrder: [
{ required: true, message: 'Sort order is required', trigger: 'change' },
{ type: 'integer', message: 'Sort order must be a whole number', trigger: 'change' }
] ]
}; };
@@ -200,6 +214,7 @@ onBeforeMount(async () => {
productForm.title = currentProduct.value.title; productForm.title = currentProduct.value.title;
productForm.descriptionHtml = currentProduct.value.descriptionHtml; productForm.descriptionHtml = currentProduct.value.descriptionHtml;
productForm.isDraft = currentProduct.value.isDraft; productForm.isDraft = currentProduct.value.isDraft;
productForm.sortOrder = currentProduct.value.sortOrder;
selectedCategoryIds.value = (currentProduct.value.categories ?? []).map(c => c.id); selectedCategoryIds.value = (currentProduct.value.categories ?? []).map(c => c.id);
} }
} catch { } catch {
@@ -236,6 +251,7 @@ const submitProduct = async (): Promise<void> => {
title: productForm.title.trim(), title: productForm.title.trim(),
descriptionHtml: productForm.descriptionHtml, descriptionHtml: productForm.descriptionHtml,
isDraft: productForm.isDraft, isDraft: productForm.isDraft,
sortOrder: productForm.sortOrder,
categoryIds: selectedCategoryIds.value categoryIds: selectedCategoryIds.value
}); });
+2
View File
@@ -35,6 +35,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="sortOrder" label="Order" width="80" />
<el-table-column label="Categories" min-width="160" show-overflow-tooltip> <el-table-column label="Categories" min-width="160" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
{{ formatProductCategories(row.categories) }} {{ formatProductCategories(row.categories) }}
+1 -2
View File
@@ -40,7 +40,6 @@ Edit `.env.prod`. Mandatory configuration:
| `POSTGRES_MIGRATIONS_RUN` | `true` | | `POSTGRES_MIGRATIONS_RUN` | `true` |
| `PGADMIN_DEFAULT_PASSWORD` | strong random password | | `PGADMIN_DEFAULT_PASSWORD` | strong random password |
| `NODE_ENV` | `production` | | `NODE_ENV` | `production` |
| `CORS_ORIGINS` | `https://your-domain.com` |
| `CLEARNET_DOMAIN` | `your-domain.com` | | `CLEARNET_DOMAIN` | `your-domain.com` |
| `JWT_SECRET` | strong random secret | | `JWT_SECRET` | strong random secret |
| `CMS_PASSWORD` | strong admin password | | `CMS_PASSWORD` | strong admin password |
@@ -56,8 +55,8 @@ Edit `.env.prod`. Mandatory configuration:
| `MONERO_WALLET_PASSWORD` | strong wallet password | | `MONERO_WALLET_PASSWORD` | strong wallet password |
| `ELECTRUM_NETWORK` | `mainnet` | | `ELECTRUM_NETWORK` | `mainnet` |
| `ELECTRUM_SERVER` | Electrum peer as `host:port:s` (SSL) or `host:port:t` (TCP), e.g. `electrum.blockstream.info:50002:s` | | `ELECTRUM_SERVER` | Electrum peer as `host:port:s` (SSL) or `host:port:t` (TCP), e.g. `electrum.blockstream.info:50002:s` |
| `ELECTRUM_WALLET_PASSWORD` | strong wallet password |
| `ELECTRUM_DAEMON_RPC_PASSWORD` | strong random password | | `ELECTRUM_DAEMON_RPC_PASSWORD` | strong random password |
| `ELECTRUM_WALLET_PASSWORD` | strong wallet password |
| `VITE_API_BASE_URL` | `/api` | | `VITE_API_BASE_URL` | `/api` |
| `VITE_SHOP_FIAT_CURRENCY` | same as `SHOP_FIAT_CURRENCY` | | `VITE_SHOP_FIAT_CURRENCY` | same as `SHOP_FIAT_CURRENCY` |
+2
View File
@@ -149,6 +149,8 @@ if ! compose exec -T postgres pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" >
exit 1 exit 1
fi fi
echo "PostgreSQL is running and accepting connections."
# Check if the script is running from an interactive terminal # Check if the script is running from an interactive terminal
if [[ ! -r /dev/tty ]]; then if [[ ! -r /dev/tty ]]; then
echo "Run this script from an interactive terminal (for example: ssh -t)." >&2 echo "Run this script from an interactive terminal (for example: ssh -t)." >&2
+9
View File
@@ -0,0 +1,9 @@
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.30.0.0/16
gateway: 172.30.0.1
driver_opts:
com.docker.network.bridge.name: nullcart0
+2 -2
View File
@@ -1,6 +1,6 @@
services: services:
postgres: postgres:
image: postgres:16 image: postgres:16.16
container_name: ${COMPOSE_PROJECT_NAME}_postgres container_name: ${COMPOSE_PROJECT_NAME}_postgres
restart: unless-stopped restart: unless-stopped
environment: environment:
@@ -16,7 +16,7 @@ services:
retries: 10 retries: 10
pgadmin: pgadmin:
image: dpage/pgadmin4 image: dpage/pgadmin4:9.19.0
container_name: ${COMPOSE_PROJECT_NAME}_pgadmin container_name: ${COMPOSE_PROJECT_NAME}_pgadmin
restart: unless-stopped restart: unless-stopped
environment: environment:
+2 -2
View File
@@ -1,6 +1,6 @@
services: services:
postgres: postgres:
image: postgres:16 image: postgres:16.16
container_name: ${COMPOSE_PROJECT_NAME}_postgres container_name: ${COMPOSE_PROJECT_NAME}_postgres
restart: unless-stopped restart: unless-stopped
environment: environment:
@@ -16,7 +16,7 @@ services:
retries: 10 retries: 10
pgadmin: pgadmin:
image: dpage/pgadmin4 image: dpage/pgadmin4:9.19.0
container_name: ${COMPOSE_PROJECT_NAME}_pgadmin container_name: ${COMPOSE_PROJECT_NAME}_pgadmin
restart: unless-stopped restart: unless-stopped
environment: environment:
+2
View File
@@ -34,6 +34,8 @@ run_electrum_offline setconfig rpcpassword "${ELECTRUM_DAEMON_RPC_PASSWORD}"
run_electrum_offline setconfig rpchost 0.0.0.0 run_electrum_offline setconfig rpchost 0.0.0.0
run_electrum_offline setconfig rpcport "${ELECTRUM_DAEMON_PORT}" run_electrum_offline setconfig rpcport "${ELECTRUM_DAEMON_PORT}"
run_electrum_offline setconfig server "${ELECTRUM_SERVER}" run_electrum_offline setconfig server "${ELECTRUM_SERVER}"
run_electrum_offline setconfig oneserver true
run_electrum_offline setconfig auto_connect false
trap 'run_electrum stop || true' SIGTERM SIGINT trap 'run_electrum stop || true' SIGTERM SIGINT
+2 -1
View File
@@ -57,12 +57,13 @@ ENV VITE_API_BASE_URL=$VITE_API_BASE_URL \
RUN npm run build RUN npm run build
FROM nginx:alpine FROM nginx:1.30.8-alpine3.24
RUN apk add --no-cache gettext RUN apk add --no-cache gettext
COPY --from=cms-builder /cms/dist /usr/share/nginx/html/cms COPY --from=cms-builder /cms/dist /usr/share/nginx/html/cms
COPY nginx/logging.conf /etc/nginx/conf.d/logging.conf
COPY nginx/conf.d/ /etc/nginx/templates/conf.d/ COPY nginx/conf.d/ /etc/nginx/templates/conf.d/
COPY nginx/snippets/ /etc/nginx/templates/snippets/ COPY nginx/snippets/ /etc/nginx/templates/snippets/
COPY nginx/docker-entrypoint.sh /docker-entrypoint.sh COPY nginx/docker-entrypoint.sh /docker-entrypoint.sh
+2
View File
@@ -0,0 +1,2 @@
access_log off;
error_log /dev/null;
@@ -31,13 +31,9 @@ location /api {
proxy_pass http://backend:${BACKEND_PORT}; proxy_pass http://backend:${BACKEND_PORT};
} }
location = /cms { location /cms {
return 301 /cms/;
}
location /cms/ {
root /usr/share/nginx/html; root /usr/share/nginx/html;
try_files $uri $uri/ /cms/index.html; try_files $uri /cms/index.html;
} }
location /pgadmin { location /pgadmin {