mirror of https://github.com/coder/code-server.git
parent
e99f8abc3c
commit
e20b79b5cc
|
@ -2,6 +2,7 @@ import { field, logger } from "@coder/logger";
|
||||||
import { ServerMessage, SharedProcessActiveMessage } from "@coder/protocol/src/proto";
|
import { ServerMessage, SharedProcessActiveMessage } from "@coder/protocol/src/proto";
|
||||||
import { Command, flags } from "@oclif/command";
|
import { Command, flags } from "@oclif/command";
|
||||||
import { fork, ForkOptions, ChildProcess } from "child_process";
|
import { fork, ForkOptions, ChildProcess } from "child_process";
|
||||||
|
import { randomFillSync } from "crypto";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as os from "os";
|
import * as os from "os";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
@ -136,13 +137,9 @@ export class Entry extends Command {
|
||||||
let password = flags["password"];
|
let password = flags["password"];
|
||||||
if (!password) {
|
if (!password) {
|
||||||
// Generate a random password
|
// Generate a random password
|
||||||
const passwordLength = 12;
|
const buffer = Buffer.alloc(12);
|
||||||
const possible = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
randomFillSync(buffer);
|
||||||
const chars = [];
|
password = buffer.toString("hex");
|
||||||
for (let i = 0; i < passwordLength; i++) {
|
|
||||||
chars.push(possible[Math.floor(Math.random() * possible.length)]);
|
|
||||||
}
|
|
||||||
password = chars.join("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasCustomHttps = certData && certKeyData;
|
const hasCustomHttps = certData && certKeyData;
|
||||||
|
|
Loading…
Reference in New Issue