Compare commits
No commits in common. "687c1ac5e8365b881b02f7db86d10396c3fe4394" and "ea4339b2dc20e630c859e1a87182f18b701ddc2e" have entirely different histories.
687c1ac5e8
...
ea4339b2dc
18
main.ts
18
main.ts
@ -25,8 +25,6 @@ import { serve } from "http/server.ts";
|
||||
import { user_command } from "./user.ts";
|
||||
import { key_out_cmd } from "./keyout.ts";
|
||||
import { prepareDocs } from "./src/store/doc.ts";
|
||||
import { connectDB } from "./src/user/db.ts";
|
||||
import * as users from "./src/user/user.ts";
|
||||
|
||||
const github_markdown = (await Deno.readTextFile(
|
||||
join(fromFileUrl(import.meta.url), "..", "static", "github-markdown.css"),
|
||||
@ -83,26 +81,12 @@ if (import.meta.main) {
|
||||
default: 8000,
|
||||
})
|
||||
.option("--auth", "Enable authentication.")
|
||||
.option("--db-path <path:string>", "The path to the database file.", {
|
||||
default: ":memory:",
|
||||
})
|
||||
.option("--id-password <idpassword:string>", "The password to use. (Not recommended). id:password format.")
|
||||
.arguments("[hostname:string]")
|
||||
.action(async ({ debug, port, auth, dbPath, idPassword }, hostname) => {
|
||||
.action(async ({ debug, port, auth }, hostname) => {
|
||||
hostname ??= "localhost";
|
||||
if (auth) {
|
||||
Deno.env.set("AUTH_REQUIRED", "true");
|
||||
}
|
||||
if (dbPath) {
|
||||
Deno.env.set("DB_PATH", dbPath);
|
||||
}
|
||||
if (idPassword) {
|
||||
Deno.env.set("AUTH_REQUIRED", "true");
|
||||
const db = connectDB();
|
||||
const [username, password] = idPassword.split(":");
|
||||
const new_user = await users.createUser(username, password);
|
||||
await users.addUser(db, new_user);
|
||||
}
|
||||
if (debug) {
|
||||
console.log("Debug mode enabled.");
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
import { HandlerContext, Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { Head } from "$fresh/runtime.ts";
|
||||
import {
|
||||
decodePath,
|
||||
encodePath,
|
||||
removePrefixFromPathname,
|
||||
} from "../../util/util.ts";
|
||||
import { asset, Head } from "$fresh/runtime.ts";
|
||||
import { encodePath, removePrefixFromPathname } from "../../util/util.ts";
|
||||
import { join } from "path/posix.ts";
|
||||
import DirList, { EntryInfo } from "../../islands/DirList.tsx";
|
||||
import FileViewer from "../../islands/FileViewer.tsx";
|
||||
@ -131,7 +127,7 @@ async function GET(req: Request, ctx: HandlerContext): Promise<Response> {
|
||||
}
|
||||
}
|
||||
const url = new URL(req.url);
|
||||
const path = removePrefixFromPathname(decodePath(url.pathname), "/dir");
|
||||
const path = removePrefixFromPathname(decodeURI(url.pathname), "/dir");
|
||||
if (url.searchParams.has("pretty")) {
|
||||
return await renderPage(req, path, ctx);
|
||||
} else {
|
||||
|
@ -1,41 +0,0 @@
|
||||
---
|
||||
title: Q&A
|
||||
tags: ["Q&A"]
|
||||
---
|
||||
|
||||
# Q&A
|
||||
|
||||
## Q1
|
||||
|
||||
What is the default branch name?
|
||||
|
||||
## A1
|
||||
|
||||
The default branch name is `master`. You can change it to any name you like. For
|
||||
example, you can change it to `main` by following the steps below:
|
||||
|
||||
```
|
||||
git branch -m master main
|
||||
git fetch origin
|
||||
git branch -u origin/main main
|
||||
git remote set-head origin -a
|
||||
```
|
||||
|
||||
## Q2
|
||||
|
||||
What is the defference between `git branch` and `git branch -a`?
|
||||
|
||||
## A2
|
||||
|
||||
`git branch` shows only local branches, while `git branch -a` shows both local
|
||||
and remote branches.
|
||||
|
||||
## Q3
|
||||
|
||||
Fast-forward merge is not possible. How can I merge the feature branch into the
|
||||
main branch?
|
||||
|
||||
## A3
|
||||
|
||||
You can use `--no-ff` option to force a merge commit even if the merge is a
|
||||
fast-forward.
|
@ -16,7 +16,3 @@ export function removePrefixFromPathname(
|
||||
export function encodePath(path: string): string {
|
||||
return path.split("/").map(encodeURIComponent).join("/");
|
||||
}
|
||||
|
||||
export function decodePath(path: string): string {
|
||||
return path.split("/").map(decodeURIComponent).join("/");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user