Skip to content

Commit

Permalink
update serve.ts and config
Browse files Browse the repository at this point in the history
  • Loading branch information
RickCogley committed Nov 12, 2024
1 parent 5b790b6 commit 83ed47c
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 24 deletions.
2 changes: 1 addition & 1 deletion _config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ site.use(transformImages({
}));
site.use(brotli());

site.copy("assets", "assets");
site.copy("assets");
// site.copy("static/portfolio", "portfolio");
site.copy([".gif",".pdf",".docx",".pptx",".xlsx",".zip",".svg"]);
site.copyRemainingFiles();
Expand Down
2 changes: 1 addition & 1 deletion _site/feed.rss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>My RSS Feed</title>
<link>http://localhost:3000/</link>
<atom:link href="http://localhost:3000/feed.rss" rel="self" type="application/rss+xml"/>
<lastBuildDate>Tue, 12 Nov 2024 12:01:45 GMT</lastBuildDate>
<lastBuildDate>Tue, 12 Nov 2024 12:05:40 GMT</lastBuildDate>
<language>en</language>
<generator>Lume v2.4.2</generator>
<item>
Expand Down
2 changes: 1 addition & 1 deletion _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
<link href="https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400..900;1,400..900&amp;display=swap" rel="stylesheet" integrity="sha384-6f7MDYDuileeB5SvnG9kzrS320fz4W065DL7f21RSu4VE1Oq93N+wHvnrFQxBk9q" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/tachyons.min.css" integrity="sha384-HdwWLX4dk/rVys8SnenrDE/uk3Zk5VD9sqBD3/B4cWKBnmmaQ79BQgFXMHlJbVyQ" crossorigin="anonymous">
<link rel="stylesheet" href="/styles.css?cb=1731412906125">
<link rel="stylesheet" href="/styles.css?cb=1731413140709">
<link href="/assets/rick_cogley_mono.JPG" rel="icon" type="image/x-icon">
<link rel="apple-touch-icon" href="/assets/rick_cogley_mono.JPG">

Expand Down
Binary file modified _site/index.html.br
Binary file not shown.
Binary file modified _site/rick_cogley_jp_site.zip
Binary file not shown.
240 changes: 239 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions serve.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Server from "lume/core/server.ts";
import { basicAuth } from "lume/middlewares/basic_auth.ts";
//import { basicAuth } from "lume/middlewares/basic_auth.ts";
import precompress from "lume/middlewares/precompress.ts";
import expires from "lume/middlewares/expires.ts";
import csp from "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/csp/mod.ts";
Expand All @@ -12,25 +12,25 @@ const server = new Server({
});

// Set the var in your Deno Deploy project environment variables.
const myUSER_1_PASS = Deno.env.get("USER_1_PASS");
const middleware = basicAuth({
users: {
"guest": `${myUSER_1_PASS}`,
},
errorMessage: "401 Unauthorized, contact site owner for access.",
});

server.use((req, next) => {
if (isProtected(req)) {
return middleware(req, next);
}
return next(req);
});

function isProtected(req) {
const url = new URL(req.url);
return url.pathname.includes("/private/");
}
// const myUSER_1_PASS = Deno.env.get("USER_1_PASS");
// const middleware = basicAuth({
// users: {
// "guest": `${myUSER_1_PASS}`,
// },
// errorMessage: "401 Unauthorized, contact site owner for access.",
// });

// server.use((req, next) => {
// if (isProtected(req)) {
// return middleware(req, next);
// }
// return next(req);
// });

// function isProtected(req) {
// const url = new URL(req.url);
// return url.pathname.includes("/private/");
// }

// assumes you are precompressing, say with the brotli plugin
server.use(precompress());
Expand Down

0 comments on commit 83ed47c

Please sign in to comment.