mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
promo widget validity
This commit is contained in:
@@ -286,7 +286,14 @@ module.exports = {
|
||||
|
||||
premiumPromoWidget_meta: true,
|
||||
async premiumPromoWidget() {
|
||||
return getPromoWidgetData();
|
||||
const data = getPromoWidgetData();
|
||||
if (data?.state != 'data') {
|
||||
return null;
|
||||
}
|
||||
if (data.validTo && new Date().getTime() > new Date(data.validTo).getTime()) {
|
||||
return null;
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
// chatStream_meta: {
|
||||
|
||||
@@ -271,7 +271,13 @@ async function updatePremiumPromoWidget() {
|
||||
const tags = (await collectCloudFilesSearchTags()).join(',');
|
||||
|
||||
const resp = await axios.default.get(
|
||||
`${DBGATE_CLOUD_URL}/premium-promo-widget?identifier=${promoWidgetData?.identifier ?? 'nope'}&tags=${tags}`
|
||||
`${DBGATE_CLOUD_URL}/premium-promo-widget?identifier=${promoWidgetData?.identifier ?? 'empty'}&tags=${tags}`,
|
||||
{
|
||||
headers: {
|
||||
...(await getCloudInstanceHeaders()),
|
||||
'x-app-version': currentVersion.version,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (!resp.data || resp.data?.state == 'unchanged') {
|
||||
|
||||
Reference in New Issue
Block a user