Stops demo and shop rows that share one API URL from colliding, and skips phone-like adminUrl values when resolving X-Abshode-Domain.
Co-authored-by: Cursor <cursoragent@cursor.com>
HMAC only matched tenant.domain, so k.montzar.ir / new.gholaktala.ir missed the row. Also return an empty store when catalog tables are missing.
Co-authored-by: Cursor <cursoragent@cursor.com>
Only resolve relative /uploads/ paths; rewriting legacy hosts to SuperAdmin broke logos that still live on nerkh.
Co-authored-by: Cursor <cursoragent@cursor.com>
Allow list/expiring helpers to map rows that omit store columns so nest build passes after prisma generate.
Co-authored-by: Cursor <cursoragent@cursor.com>
Store enablement is now a tenant settings row instead of a global runtime switch, and expiring/requests endpoints degrade to empty lists when store tables are missing.
Co-authored-by: Cursor <cursoragent@cursor.com>
Catalog prices, purchase requests, and setting-key activation live on SuperAdmin so module admins can buy add-ons. Also rewrite legacy nerkh logo hosts to the SuperAdmin upload origin.
Co-authored-by: Cursor <cursoragent@cursor.com>
Move @types/jalaali-js into dependencies and add a local module declaration so nest build works when installing without devDependencies.
Co-authored-by: Cursor <cursoragent@cursor.com>
Pre-check uniqueness and report which field conflicts with which existing version; strip primary domain from aliases.
Co-authored-by: Cursor <cursoragent@cursor.com>
Server/plugin/support charges used Gregorian Date#setMonth, so 3 months from 1405/06/01 became 1405/09/02. Now add N Jalali months minus one day (1405/08/30).
Merge stored bottom items from the shared catalog so selected menus are not reset to the four defaults.
Co-authored-by: Cursor <cursoragent@cursor.com>
Import preview listed sms_charge_* and service_charge_percentage, but
applyImport skipped every out-of-catalog key via isSystemProgramSettingKey,
so "all projects" never persisted and the modal returned every time.
Co-authored-by: Cursor <cursoragent@cursor.com>
Parse both INSERT column orders from deploy_settings_const.sql so
price_provider, zaarbox_api_url, main_product and similar keys are
in the template. Keep template values empty for tokens and per-project IDs.
Co-authored-by: Cursor <cursoragent@cursor.com>
Merge tenant values with the deploy template catalog so every system
setting (e.g. all montzar_* can_edit=0 keys) appears like khaneghi
advanced settings, not only rows already stored for the tenant.
Co-authored-by: Cursor <cursoragent@cursor.com>
Superadmin was seeding all deploy_settings_const INSERT keys including
can_edit=1 entries with wrong defaults (e.g. montzar_product_id=25).
Template/catalog now follow final can_edit=0 from SQL; editable keys are
purged from setting_templates and tenant settings on boot/seed.
Co-authored-by: Cursor <cursoragent@cursor.com>
Catalog keys from the SQL template write onto this tenant automatically; only extra keys need a per-key decision.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add sync-replica-data repair on deploy, a publisher-side replica watch
(60s + after tenant/settings writes), REFRESH PUBLICATION after migrate,
and Cache-Control no-store on program-settings and get_version.
Co-authored-by: Cursor <cursoragent@cursor.com>
Catalog keys are compiled into the API bundle so import no longer depends on an incomplete templates table or missing JSON on the server.
Co-authored-by: Cursor <cursoragent@cursor.com>
Import was posting to /admin/login without provider=user, so no token came back even with valid credentials.
Co-authored-by: Cursor <cursoragent@cursor.com>
Template defaults seed from deploy_settings_const; new tenants copy them, import decides per key, and /get_settings reads the per-tenant rows.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sold apps can read settings from /get_settings; Super Admin saves only changed keys so huge runtime logs are not sent in the body.
Co-authored-by: Cursor <cursoragent@cursor.com>
Cast stored JSON through asSettingsArray so tsc accepts the snapshot payload, and strip Prisma ?schema= from DATABASE_URL before psql.
Co-authored-by: Cursor <cursoragent@cursor.com>
Import can_edit=0 settings via the sold version's admin login + get_settings, for Super Admin program-settings UI.
Co-authored-by: Cursor <cursoragent@cursor.com>
When remoteApiToken is empty, sign SuperAdmin→product /super/settings
with the same SMS_REMOTE_SHARED_SECRET + domain headers used by SMS.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add Tenant.serverAccessBlocked, toggle API with appVersion bump and settings push, and expose stealth server_reachable in get_user.
Co-authored-by: Cursor <cursoragent@cursor.com>
Local Vite frontends can call production adm.montzar.ir get_user/get_version without running a local API.
Co-authored-by: Cursor <cursoragent@cursor.com>
Appearance/avatar/name/uiVariant updates auto-increment Tenant.appVersion so clients refetch get_user only after get_version changes.
Co-authored-by: Cursor <cursoragent@cursor.com>
When multiple tenants claim the same host via domains aliases, resolve the tenant whose primary domain matches first so branding edits apply to the expected version.
Co-authored-by: Cursor <cursoragent@cursor.com>
Serve PWA/APK web manifest per domain (name, theme colors, multi-size icons from avatar), exclude from api prefix, and proxy via nginx.
Co-authored-by: Cursor <cursoragent@cursor.com>