Skip to content

Commit e6eccf9

Browse files
authored
Merge pull request #11 from fastly/remove-demo-content
Remove demo-supporting code and content
2 parents 31f58ea + 198da3e commit e6eccf9

File tree

4 files changed

+3
-74
lines changed

4 files changed

+3
-74
lines changed

src/config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,7 @@ function fetchConfig() {
5656
// how many visitors should be let in at a time?
5757
//
5858
// default 5
59-
automaticQuantity: 5,
60-
61-
// for demonstration purposes only, how many visitors should be
62-
// added to the queue ahead of a new visitor
63-
//
64-
// default 15, set to 1 for normal behaviour
65-
demoPadding: 15,
59+
automaticQuantity: 5
6660
},
6761
};
6862
}

src/index.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ const textDecoder = new TextDecoder();
2727
const adminView = textDecoder.decode(includeBytes('src/views/admin.html'));
2828
const queueView = textDecoder.decode(includeBytes('src/views/queue.html'));
2929

30-
// For demo purposes
31-
const demoManifest = textDecoder.decode(includeBytes('src/static/demo-manifest.md'));
32-
const DEMO_THUMBNAIL = includeBytes('src/static/demo-thumb.png');
33-
3430
// The name of the backend serving the content that is being protected by the queue.
3531
const CONTENT_BACKEND = "protected_content";
3632

@@ -54,22 +50,6 @@ async function handleRequest(event) {
5450
const { request, client } = event;
5551
const url = new URL(request.url);
5652

57-
// Metadata foe developer.fastly.com.
58-
// Feel free to delete this.
59-
if (url.pathname == "/.well-known/fastly/demo-manifest") {
60-
return new Response(demoManifest, {
61-
status: 200,
62-
headers: {
63-
"Content-Type": "text/markdown",
64-
},
65-
});
66-
} else if (url.pathname == "/demo-thumb.png") {
67-
return new Response(DEMO_THUMBNAIL, {
68-
status: 200,
69-
headers: { 'content-type': 'image/png' }
70-
});
71-
}
72-
7353
// Allow requests to assets that are not protected by the queue.
7454
if (ALLOWED_PATHS.includes(url.pathname)) {
7555
let resp = await handleAuthorizedRequest(request);
@@ -124,11 +104,10 @@ async function handleRequest(event) {
124104
if (payload && isValid) {
125105
visitorPosition = payload.position;
126106
} else {
127-
// Add a new visitor to the end of the queue.
128-
// If demo padding is set in the config, the queue will grow by that amount.
107+
// Add 1 new visitor to the end of the queue.
129108
visitorPosition = await incrementQueueLength(
130109
redis,
131-
config.queue.demoPadding ? config.queue.demoPadding : 1
110+
1
132111
);
133112

134113
// Sign a JWT with the visitor's position.

src/static/demo-manifest.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/static/demo-thumb.png

-1.04 MB
Binary file not shown.

0 commit comments

Comments
 (0)