mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
security fix, simple-http-server fix
This commit is contained in:
parent
4fb5c42055
commit
a4ae083b60
4 changed files with 33 additions and 11 deletions
|
@ -97,6 +97,7 @@
|
|||
|
||||
zls # zig language server
|
||||
watchexec
|
||||
simple-http-server # to view the website locally
|
||||
]);
|
||||
|
||||
aliases = ''
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ rustPlatform, fetchFromGitHub }:
|
||||
{ rustPlatform, fetchFromGitHub, pkg-config, openssl }:
|
||||
|
||||
rustPlatform.buildRustPackage {
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "simple-http-server";
|
||||
version = "0.1.0"; # adjust version as needed
|
||||
|
||||
|
@ -8,9 +8,15 @@ rustPlatform.buildRustPackage {
|
|||
owner = "Anton-4";
|
||||
repo = "simple-http-server";
|
||||
rev = "f3089e5736a1e8abdb69ba9e7618fe5e518a2df0";
|
||||
sha256 = "sha256-Vcckv75hmJV7F9mqPtM3piSIZg9MvKI/oU7/tv4viy4=";
|
||||
};
|
||||
|
||||
cargoLock = {
|
||||
lockFile = "${src}/Cargo.lock";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
|
||||
buildInputs =
|
||||
[ openssl ];
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ bash ./www/build-dev-local.sh
|
|||
|
||||
Open http://0.0.0.0:8080 in your browser.
|
||||
|
||||
If you want to build the repl as well, check out crates/repl_wasm/README.md.
|
||||
|
||||
## After you've made a change locally
|
||||
|
||||
In the terminal where the web server is running:
|
||||
|
|
|
@ -351,18 +351,31 @@ function createHistoryEntry(inputText) {
|
|||
const historyIndex = repl.inputHistory.length;
|
||||
repl.inputHistory.push(inputText);
|
||||
|
||||
const firstLinePrefix = '<span class="input-line-prefix">» </span>';
|
||||
const otherLinePrefix = '<br><span class="input-line-prefix">… </span>';
|
||||
const inputLines = inputText.split("\n");
|
||||
if (inputLines[inputLines.length - 1] === "") {
|
||||
inputLines.pop();
|
||||
}
|
||||
const inputWithPrefixes = firstLinePrefix + inputLines.join(otherLinePrefix);
|
||||
|
||||
const inputElem = document.createElement("div");
|
||||
inputElem.innerHTML = inputWithPrefixes;
|
||||
inputElem.classList.add("input");
|
||||
|
||||
const inputLines = inputText.split("\n").filter(line => line !== ""); // Remove empty last line if present
|
||||
|
||||
inputLines.forEach((line, index) => {
|
||||
if (index > 0) {
|
||||
// Add line break for subsequent lines
|
||||
inputElem.appendChild(document.createElement("br"));
|
||||
const prefixSpan = document.createElement("span");
|
||||
prefixSpan.className = "input-line-prefix";
|
||||
prefixSpan.textContent = "… ";
|
||||
inputElem.appendChild(prefixSpan);
|
||||
} else {
|
||||
// First line prefix
|
||||
const prefixSpan = document.createElement("span");
|
||||
prefixSpan.className = "input-line-prefix";
|
||||
prefixSpan.textContent = "» ";
|
||||
inputElem.appendChild(prefixSpan);
|
||||
}
|
||||
|
||||
// Add the line text as plain text
|
||||
inputElem.appendChild(document.createTextNode(line));
|
||||
});
|
||||
|
||||
const historyItem = document.createElement("div");
|
||||
historyItem.appendChild(inputElem);
|
||||
historyItem.classList.add("history-item");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue