mirror of
https://github.com/diced/zipline.git
synced 2025-04-11 23:31:17 -05:00
Update index.ts
randomize returnDomain if "x-zipline-domain" is a comma separated list - Updated returnDomain handling to support both single and comma-separated domain strings. - Implemented random selection from the list of domains.
This commit is contained in:
parent
7a93070958
commit
8adff1c789
1 changed files with 5 additions and 1 deletions
|
@ -62,7 +62,11 @@ export default fastifyPlugin(
|
|||
);
|
||||
|
||||
let maxViews: number | undefined;
|
||||
const returnDomain = req.headers['x-zipline-domain'];
|
||||
let returnDomain = req.headers['x-zipline-domain'];
|
||||
if (returnDomain) {
|
||||
const domainArray = returnDomain.split(",");
|
||||
returnDomain = domainArray[Math.floor(Math.random() * domainArray.length)].trim();
|
||||
}
|
||||
|
||||
const maxViewsHeader = req.headers['x-zipline-max-views'];
|
||||
if (maxViewsHeader) {
|
||||
|
|
Loading…
Add table
Reference in a new issue