feat(oss图片): oss图片链接改用cdn加速链接
This commit is contained in:
parent
53885656ff
commit
6da368fcac
@ -119,7 +119,7 @@ const bgVapUrl = mp4Url('bg')
|
|||||||
生成的线上地址形如:
|
生成的线上地址形如:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/h5/Azizi/Activities/ActiveGame/bg.mp4
|
https://cdn.azizichat.com/h5/Azizi/Activities/ActiveGame/bg.mp4
|
||||||
```
|
```
|
||||||
|
|
||||||
开发环境会走:
|
开发环境会走:
|
||||||
@ -199,7 +199,7 @@ await preloadVapConfig(resolveProtectedAssetUrl(bgVapUrl))
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const rewardVapUrl =
|
const rewardVapUrl =
|
||||||
'https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/svgasource/manager-d824e59b-1a88-4d4f-aed3-01768ba20542.mp4'
|
'https://cdn.azizichat.com/svgasource/manager-d824e59b-1a88-4d4f-aed3-01768ba20542.mp4'
|
||||||
```
|
```
|
||||||
|
|
||||||
## 预加载建议
|
## 预加载建议
|
||||||
|
|||||||
@ -102,7 +102,7 @@ const shouldShowImage = computed(() => {
|
|||||||
// const isOSSImage = computed(() => {
|
// const isOSSImage = computed(() => {
|
||||||
// return (
|
// return (
|
||||||
// props.imgUrl.startsWith('/oss/h5/Azizi/') ||
|
// props.imgUrl.startsWith('/oss/h5/Azizi/') ||
|
||||||
// props.imgUrl.startsWith('https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/h5/Azizi/')
|
// props.imgUrl.startsWith('https://cdn.azizichat.com/h5/Azizi/')
|
||||||
// )
|
// )
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import { protectAssetUrl } from '@/utils/protectedAssets.js'
|
import { protectAssetUrl } from '@/utils/protectedAssets.js'
|
||||||
|
|
||||||
export const OSS_BASE_URL =
|
export const OSS_BASE_URL =
|
||||||
process.env.NODE_ENV === 'development'
|
process.env.NODE_ENV === 'development' ? '/oss/h5/Azizi/' : 'https://cdn.azizichat.com/h5/Azizi/'
|
||||||
? '/oss/h5/Azizi/'
|
|
||||||
: 'https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/h5/Azizi/'
|
|
||||||
|
|
||||||
function buildAssetUrl(imagePath, filename, extension) {
|
function buildAssetUrl(imagePath, filename, extension) {
|
||||||
return `${OSS_BASE_URL}${imagePath}${filename}.${extension}`
|
return `${OSS_BASE_URL}${imagePath}${filename}.${extension}`
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class ImageCacheManager {
|
|||||||
|
|
||||||
let cacheName
|
let cacheName
|
||||||
if (
|
if (
|
||||||
normalizedUrl.startsWith('https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/h5/Azizi/') ||
|
normalizedUrl.startsWith('https://cdn.azizichat.com/h5/Azizi/') ||
|
||||||
normalizedUrl.includes('/oss/h5/Azizi/')
|
normalizedUrl.includes('/oss/h5/Azizi/')
|
||||||
) {
|
) {
|
||||||
cacheName = this.imageCacheName
|
cacheName = this.imageCacheName
|
||||||
@ -309,9 +309,7 @@ class ImageCacheManager {
|
|||||||
|
|
||||||
const containsAssets = normalizedUrl.includes('/assets/')
|
const containsAssets = normalizedUrl.includes('/assets/')
|
||||||
const containsOssH5 = normalizedUrl.includes('/oss/h5/Azizi/')
|
const containsOssH5 = normalizedUrl.includes('/oss/h5/Azizi/')
|
||||||
const startsWithOss = normalizedUrl.startsWith(
|
const startsWithOss = normalizedUrl.startsWith('https://cdn.azizichat.com/h5/Azizi/')
|
||||||
'https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/h5/Azizi/',
|
|
||||||
)
|
|
||||||
|
|
||||||
// 只缓存三种类型的资源
|
// 只缓存三种类型的资源
|
||||||
return containsAssets || containsOssH5 || startsWithOss
|
return containsAssets || containsOssH5 || startsWithOss
|
||||||
|
|||||||
@ -9,7 +9,11 @@ const isEmptySourceValue = (value) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['', 'null', 'undefined'].includes(String(value || '').trim().toLowerCase())
|
return ['', 'null', 'undefined'].includes(
|
||||||
|
String(value || '')
|
||||||
|
.trim()
|
||||||
|
.toLowerCase(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getRewardRawSourceUrl = (reward = {}) => {
|
const getRewardRawSourceUrl = (reward = {}) => {
|
||||||
@ -52,7 +56,9 @@ export function useDailyRechargeRewardVap(options = {}) {
|
|||||||
|
|
||||||
if (resolvedUrl.startsWith('//')) {
|
if (resolvedUrl.startsWith('//')) {
|
||||||
const protocol =
|
const protocol =
|
||||||
typeof window !== 'undefined' && window.location?.protocol ? window.location.protocol : 'https:'
|
typeof window !== 'undefined' && window.location?.protocol
|
||||||
|
? window.location.protocol
|
||||||
|
: 'https:'
|
||||||
return `${protocol}${resolvedUrl}`
|
return `${protocol}${resolvedUrl}`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +77,7 @@ export function useDailyRechargeRewardVap(options = {}) {
|
|||||||
if (resolvedUrl.startsWith('/')) {
|
if (resolvedUrl.startsWith('/')) {
|
||||||
return process.env.NODE_ENV === 'development'
|
return process.env.NODE_ENV === 'development'
|
||||||
? `/oss${resolvedUrl}`
|
? `/oss${resolvedUrl}`
|
||||||
: `https://tkm-likei.oss-ap-southeast-1.aliyuncs.com${resolvedUrl}`
|
: `https://cdn.azizichat.com${resolvedUrl}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return `https://${resolvedUrl}`
|
return `https://${resolvedUrl}`
|
||||||
@ -82,7 +88,10 @@ export function useDailyRechargeRewardVap(options = {}) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return /^https?:\/\/.+\.mp4(?:[?#].*)?$/i.test(sourceUrl) || /^\/oss\/.+\.mp4(?:[?#].*)?$/i.test(sourceUrl)
|
return (
|
||||||
|
/^https?:\/\/.+\.mp4(?:[?#].*)?$/i.test(sourceUrl) ||
|
||||||
|
/^\/oss\/.+\.mp4(?:[?#].*)?$/i.test(sourceUrl)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getRewardVapSourceUrl = (reward = {}) => {
|
const getRewardVapSourceUrl = (reward = {}) => {
|
||||||
@ -227,7 +236,10 @@ export function useDailyRechargeRewardVap(options = {}) {
|
|||||||
const retryDelay = Math.min(500 + retryCount * 500, 2000)
|
const retryDelay = Math.min(500 + retryCount * 500, 2000)
|
||||||
const retryTimer = window.setTimeout(() => {
|
const retryTimer = window.setTimeout(() => {
|
||||||
rewardVapRetryTimers.delete(sourceUrl)
|
rewardVapRetryTimers.delete(sourceUrl)
|
||||||
if (getCurrentMainRewardVapSourceUrl() !== sourceUrl || failedRewardVapUrls.value.has(sourceUrl)) {
|
if (
|
||||||
|
getCurrentMainRewardVapSourceUrl() !== sourceUrl ||
|
||||||
|
failedRewardVapUrls.value.has(sourceUrl)
|
||||||
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -312,7 +312,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
cors: true,
|
cors: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/oss': {
|
'/oss': {
|
||||||
target: 'https://tkm-likei.oss-ap-southeast-1.aliyuncs.com',
|
target: 'https://cdn.azizichat.com',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: true,
|
secure: true,
|
||||||
rewrite: (path) => path.replace(/^\/oss/, ''),
|
rewrite: (path) => path.replace(/^\/oss/, ''),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user