feat(admin): colleague accounting codes and reliable banner saves
Add per-provider Montzar account codes on the colleague transactions page, rename the menu label, and auto-persist banner uploads with https file URLs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+12
-6
@@ -57,12 +57,12 @@ export function getFileBaseUrl(): string {
|
||||
getConfigApp('file_base')
|
||||
|
||||
if (typeof fromConfig === 'string' && fromConfig.trim()) {
|
||||
return fromConfig.replace(/\/$/, '')
|
||||
return preferHttpsFileUrl(fromConfig.replace(/\/$/, ''))
|
||||
}
|
||||
|
||||
const storageBase = baseURLStorage || baseURL
|
||||
if (storageBase) {
|
||||
return storageBase.replace(/\/$/, '')
|
||||
return preferHttpsFileUrl(storageBase.replace(/\/$/, ''))
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -72,6 +72,12 @@ export function getFileBaseUrl(): string {
|
||||
return ''
|
||||
}
|
||||
|
||||
/** صفحهٔ ادمین https است؛ URLهای http پشت CDN در پیشنمایش بلاک میشوند. */
|
||||
export function preferHttpsFileUrl(url: string): string {
|
||||
if (/localhost|127\.0\.0\.1/i.test(url)) return url
|
||||
return url.replace(/^http:\/\//i, 'https://')
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns API paths like "storage/1405/02/27/file.jpg" into a full URL.
|
||||
*/
|
||||
@@ -81,14 +87,14 @@ export function toAbsoluteFileUrl(path?: string | null): string | undefined {
|
||||
const trimmed = path.trim()
|
||||
|
||||
if (/^https?:\/\//i.test(trimmed)) {
|
||||
return trimmed
|
||||
return preferHttpsFileUrl(trimmed)
|
||||
}
|
||||
|
||||
const storageMatch = trimmed.match(/(?:^|\/)storage\/(.+)$/i)
|
||||
if (storageMatch) {
|
||||
const base = getFileBaseUrl()
|
||||
if (base) {
|
||||
return `${base}/storage/${storageMatch[1]}`
|
||||
return preferHttpsFileUrl(`${base}/storage/${storageMatch[1]}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,10 +106,10 @@ export function toAbsoluteFileUrl(path?: string | null): string | undefined {
|
||||
if (!base) return undefined
|
||||
|
||||
if (trimmed.startsWith('/')) {
|
||||
return `${base}${trimmed}`
|
||||
return preferHttpsFileUrl(`${base}${trimmed}`)
|
||||
}
|
||||
|
||||
return `${base}/${trimmed.replace(/^\//, '')}`
|
||||
return preferHttpsFileUrl(`${base}/${trimmed.replace(/^\//, '')}`)
|
||||
}
|
||||
|
||||
function isBareFileName(value: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user