refactor: rename project from dgray.io to kashilo.com
This commit is contained in:
@@ -11,14 +11,14 @@ import { setPersist, getPersist } from './directus/client.js'
|
||||
import { cryptoService } from './crypto.js'
|
||||
import { i18n } from '../i18n.js'
|
||||
|
||||
const AUTH_DOMAIN = 'dgray.io'
|
||||
const AUTH_DOMAIN = 'kashilo.com'
|
||||
|
||||
class AuthService {
|
||||
constructor() {
|
||||
this.currentUser = null
|
||||
this.listeners = new Set()
|
||||
this.hashCache = new Map()
|
||||
if (localStorage.getItem('dgray_remember') === '1') {
|
||||
if (localStorage.getItem('kashilo_remember') === '1') {
|
||||
setPersist(true)
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class AuthService {
|
||||
|
||||
this.currentUser = null
|
||||
this.clearStoredUuid()
|
||||
localStorage.removeItem('dgray_remember')
|
||||
localStorage.removeItem('kashilo_remember')
|
||||
setPersist(false)
|
||||
cryptoService.lock()
|
||||
this.resetPreferencesToDefaults()
|
||||
@@ -159,7 +159,7 @@ class AuthService {
|
||||
const keysToRemove = []
|
||||
for (let i = 0; i < localStorage.length; i++) {
|
||||
const key = localStorage.key(i)
|
||||
if (key && key.startsWith('dgray_')) keysToRemove.push(key)
|
||||
if (key && key.startsWith('kashilo_')) keysToRemove.push(key)
|
||||
}
|
||||
keysToRemove.forEach(k => localStorage.removeItem(k))
|
||||
|
||||
@@ -169,7 +169,7 @@ class AuthService {
|
||||
|
||||
for (let i = sessionStorage.length - 1; i >= 0; i--) {
|
||||
const key = sessionStorage.key(i)
|
||||
if (key && key.startsWith('dgray_')) sessionStorage.removeItem(key)
|
||||
if (key && key.startsWith('kashilo_')) sessionStorage.removeItem(key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class AuthService {
|
||||
const defaultCurrency = 'USD'
|
||||
const defaultLocale = 'en'
|
||||
|
||||
localStorage.setItem('dgray_currency', defaultCurrency)
|
||||
localStorage.setItem('kashilo_currency', defaultCurrency)
|
||||
localStorage.setItem('locale', defaultLocale)
|
||||
|
||||
window.dispatchEvent(new CustomEvent('currency-changed', { detail: { currency: defaultCurrency } }))
|
||||
@@ -223,7 +223,7 @@ class AuthService {
|
||||
|
||||
if (this.currentUser.preferred_currency) {
|
||||
const currency = this.currentUser.preferred_currency
|
||||
localStorage.setItem('dgray_currency', currency)
|
||||
localStorage.setItem('kashilo_currency', currency)
|
||||
window.dispatchEvent(new CustomEvent('currency-changed', { detail: { currency } }))
|
||||
}
|
||||
if (this.currentUser.preferred_locale) {
|
||||
@@ -261,7 +261,7 @@ class AuthService {
|
||||
*/
|
||||
storeUuid(uuid) {
|
||||
const storage = getPersist() ? localStorage : sessionStorage
|
||||
storage.setItem('dgray_uuid', uuid)
|
||||
storage.setItem('kashilo_uuid', uuid)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,28 +269,28 @@ class AuthService {
|
||||
* @returns {string|null}
|
||||
*/
|
||||
getStoredUuid() {
|
||||
return sessionStorage.getItem('dgray_uuid') || localStorage.getItem('dgray_uuid')
|
||||
return sessionStorage.getItem('kashilo_uuid') || localStorage.getItem('kashilo_uuid')
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears stored UUID
|
||||
*/
|
||||
clearStoredUuid() {
|
||||
sessionStorage.removeItem('dgray_uuid')
|
||||
localStorage.removeItem('dgray_uuid')
|
||||
sessionStorage.removeItem('kashilo_uuid')
|
||||
localStorage.removeItem('kashilo_uuid')
|
||||
}
|
||||
|
||||
setRememberMe(value) {
|
||||
setPersist(value)
|
||||
if (value) {
|
||||
localStorage.setItem('dgray_remember', '1')
|
||||
localStorage.setItem('kashilo_remember', '1')
|
||||
} else {
|
||||
localStorage.removeItem('dgray_remember')
|
||||
localStorage.removeItem('kashilo_remember')
|
||||
}
|
||||
}
|
||||
|
||||
getRememberMe() {
|
||||
return localStorage.getItem('dgray_remember') === '1'
|
||||
return localStorage.getItem('kashilo_remember') === '1'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { i18n } from '../i18n.js'
|
||||
|
||||
const POW_SERVER = 'https://pow.dgray.io'
|
||||
const POW_SERVER = 'https://pow.kashilo.com'
|
||||
|
||||
let modalScriptLoaded = false
|
||||
let modalScriptLoading = null
|
||||
@@ -131,7 +131,7 @@ export async function pollUntilDone(invoiceId, options = {}) {
|
||||
*/
|
||||
export function getPendingInvoice(listingId) {
|
||||
try {
|
||||
const data = localStorage.getItem(`dgray_invoice_${listingId}`)
|
||||
const data = localStorage.getItem(`kashilo_invoice_${listingId}`)
|
||||
return data ? JSON.parse(data) : null
|
||||
} catch (e) {
|
||||
return null
|
||||
@@ -145,7 +145,7 @@ export function getPendingInvoice(listingId) {
|
||||
*/
|
||||
export function savePendingInvoice(listingId, invoiceId) {
|
||||
try {
|
||||
localStorage.setItem(`dgray_invoice_${listingId}`, JSON.stringify({
|
||||
localStorage.setItem(`kashilo_invoice_${listingId}`, JSON.stringify({
|
||||
invoiceId,
|
||||
createdAt: Date.now()
|
||||
}))
|
||||
@@ -159,7 +159,7 @@ export function savePendingInvoice(listingId, invoiceId) {
|
||||
* @param {string} listingId
|
||||
*/
|
||||
export function clearPendingInvoice(listingId) {
|
||||
localStorage.removeItem(`dgray_invoice_${listingId}`)
|
||||
localStorage.removeItem(`kashilo_invoice_${listingId}`)
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -10,8 +10,8 @@ class CategoriesService {
|
||||
this.cache = null
|
||||
this.cacheTimestamp = 0
|
||||
this.cacheTimeout = 24 * 60 * 60 * 1000 // 24 hours
|
||||
this.storageKey = 'dgray_categories'
|
||||
this.storageTimestampKey = 'dgray_categories_ts'
|
||||
this.storageKey = 'kashilo_categories'
|
||||
this.storageTimestampKey = 'kashilo_categories_ts'
|
||||
this._pending = null
|
||||
this._loadFromStorage()
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
* derived from the user's UUID via PBKDF2.
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = 'dgray_keypair'
|
||||
const SALT_KEY = 'dgray_keypair_salt'
|
||||
const LISTING_KEYS_STORAGE = 'dgray_listing_keys'
|
||||
const STORAGE_KEY = 'kashilo_keypair'
|
||||
const SALT_KEY = 'kashilo_keypair_salt'
|
||||
const LISTING_KEYS_STORAGE = 'kashilo_listing_keys'
|
||||
|
||||
class CryptoService {
|
||||
constructor() {
|
||||
|
||||
@@ -195,7 +195,7 @@ export function convertFiat(amount, fromCurrency, toCurrency, rates) {
|
||||
* @returns {string} Currency code (default: 'USD')
|
||||
*/
|
||||
export function getDisplayCurrency() {
|
||||
return localStorage.getItem('dgray_currency') || 'USD'
|
||||
return localStorage.getItem('kashilo_currency') || 'USD'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Directus API Service for dgray.io — Facade
|
||||
* Directus API Service for kashilo.com — Facade
|
||||
* Re-exports modular sub-services as a single backward-compatible singleton.
|
||||
* @module services/directus
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const DIRECTUS_URL = 'https://api.dgray.io'
|
||||
const DIRECTUS_URL = 'https://api.kashilo.com'
|
||||
|
||||
let _persist = false
|
||||
|
||||
@@ -51,14 +51,14 @@ class DirectusClient {
|
||||
// ── Token Management ──
|
||||
|
||||
loadTokens() {
|
||||
const stored = sessionStorage.getItem('dgray_auth') || localStorage.getItem('dgray_auth')
|
||||
const stored = sessionStorage.getItem('kashilo_auth') || localStorage.getItem('kashilo_auth')
|
||||
if (stored) {
|
||||
try {
|
||||
const { accessToken, refreshToken, expiry } = JSON.parse(stored)
|
||||
this.accessToken = accessToken
|
||||
this.refreshToken = refreshToken
|
||||
this.tokenExpiry = expiry
|
||||
if (localStorage.getItem('dgray_auth')) {
|
||||
if (localStorage.getItem('kashilo_auth')) {
|
||||
_persist = true
|
||||
}
|
||||
this.scheduleTokenRefresh()
|
||||
@@ -73,7 +73,7 @@ class DirectusClient {
|
||||
this.refreshToken = refreshToken
|
||||
this.tokenExpiry = Date.now() + (expiresIn * 1000)
|
||||
|
||||
_storage().setItem('dgray_auth', JSON.stringify({
|
||||
_storage().setItem('kashilo_auth', JSON.stringify({
|
||||
accessToken: this.accessToken,
|
||||
refreshToken: this.refreshToken,
|
||||
expiry: this.tokenExpiry
|
||||
@@ -86,8 +86,8 @@ class DirectusClient {
|
||||
this.accessToken = null
|
||||
this.refreshToken = null
|
||||
this.tokenExpiry = null
|
||||
sessionStorage.removeItem('dgray_auth')
|
||||
localStorage.removeItem('dgray_auth')
|
||||
sessionStorage.removeItem('kashilo_auth')
|
||||
localStorage.removeItem('kashilo_auth')
|
||||
|
||||
if (this.refreshTimeout) {
|
||||
clearTimeout(this.refreshTimeout)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { directus } from './directus.js'
|
||||
import { auth } from './auth.js'
|
||||
|
||||
const ANON_KEY = 'dgray_favorites'
|
||||
const ANON_KEY = 'kashilo_favorites'
|
||||
|
||||
class FavoritesService {
|
||||
constructor() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Stores seller contact keys on first use, warns on key changes
|
||||
*/
|
||||
|
||||
const PINNED_KEYS_STORAGE = 'dgray_pinned_keys'
|
||||
const PINNED_KEYS_STORAGE = 'kashilo_pinned_keys'
|
||||
|
||||
class KeyPinningService {
|
||||
constructor() {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// Client must find nonce where SHA256(challenge + nonce) has N leading zeros
|
||||
// Server-first: tries /pow/challenge endpoint, falls back to local generation
|
||||
|
||||
const POW_SERVER = 'https://pow.dgray.io'
|
||||
const POW_SERVER = 'https://pow.kashilo.com'
|
||||
const DIFFICULTY = 4
|
||||
const SERVER_TIMEOUT_MS = 1500
|
||||
|
||||
const LOCAL_HMAC_KEY = 'dgray-pow-local-v1'
|
||||
const LOCAL_HMAC_KEY = 'kashilo-pow-local-v1'
|
||||
|
||||
async function hmacSign(message) {
|
||||
const enc = new TextEncoder()
|
||||
|
||||
Reference in New Issue
Block a user