Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] Restore ads with already implemented Cache-Control #148

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/routers/slise-ad-rules/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getAllSliseAdProvidersBySites,
getSelectorsByProviderId,
getSliseAdProvidersByDomain,
// getSliseAdProvidersForAllSites,
getSliseAdProvidersForAllSites,
removeProviders,
removeSliseAdProvidersBySites,
removeSliseAdProvidersForAllSites,
Expand Down Expand Up @@ -157,10 +157,9 @@ sliseAdProvidersRouter
.route('/all-sites')
.get(
withExceptionHandler(async (_req, res) => {
// const providers = await getSliseAdProvidersForAllSites();
const providers = await getSliseAdProvidersForAllSites();

// res.status(200).send(providers);
res.status(200).header('Cache-Control', 'public, max-age=300').send([]);
res.status(200).header('Cache-Control', 'public, max-age=300').send(providers);
})
)
.post(
Expand Down
8 changes: 3 additions & 5 deletions src/utils/express-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
};

export const addObjectStorageMethodsToRouter = <V extends any[]>(

Check warning on line 47 in src/utils/express-helpers.ts

View workflow job for this annotation

GitHub Actions / Checks if ts and lint works

Unexpected any. Specify a different type
router: Router,
path: string,
methods: ObjectStorageMethods<V>,
Expand All @@ -56,10 +56,9 @@
router.get(
path === '/' ? `/:${keyName}` : `${path}/:${keyName}`,
withExceptionHandler(async (req, res) => {
// const { [keyName]: key } = req.params;
const { [keyName]: key } = req.params;

// const value = await methods.getByKey(key);
const value = [];
const value = await methods.getByKey(key);

res.status(200).header('Cache-Control', 'public, max-age=300').send(value);
})
Expand All @@ -69,8 +68,7 @@
.route(path)
.get(
withExceptionHandler(async (_req, res) => {
// const values = await methods.getAllValues();
const values = {};
const values = await methods.getAllValues();

res.status(200).header('Cache-Control', 'public, max-age=300').send(values);
})
Expand Down
Loading