delicate but ok import

master
Bel LaPointe 2022-02-10 11:40:39 -07:00
parent b11c07e55a
commit ac5f86687c
4 changed files with 23 additions and 14 deletions

View File

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
test_path() { test_path() {
cache path abc | tr '/' '\n' | tail -n 1 | grep -q $(echo -n abc | base64) cache path abc | tr '/' '\n' | tail -n 1 | grep -q .
} }
test_get_put_get() { test_get_put_get() {

View File

@ -12,12 +12,15 @@ gitlab() (
local project="$(_url_to_project_root "$url" | head -n 1)" local project="$(_url_to_project_root "$url" | head -n 1)"
project="$(urlencode "$project")" project="$(urlencode "$project")"
local root="$(_url_to_project_root "$url" | tail -n 1)" local root="$(_url_to_project_root "$url" | tail -n 1)"
blob="$(urlencode "$blob")"
if [ -n "$root" ]; then if [ -n "$root" ]; then
blob="$(urlencode "$root/$blob")" blob="${root%/}/${blob#/}"
blob="${blob#/}"
blob="${blob%/}"
fi fi
blob="$(urlencode "$blob")"
local path="api/v4/projects/$project/repository/files/$blob/raw" local path="api/v4/projects/$project/repository/files/$blob/raw"
log _gcurl "https://gitlab-app.eng.qops.net/$path (blob=$blob, project=$project)"
_gcurl "https://gitlab-app.eng.qops.net/$path" _gcurl "https://gitlab-app.eng.qops.net/$path"
} }

View File

@ -112,17 +112,19 @@ crawl_with() {
base64 | md5sum | cut -c 1-10 | awk '{print $1}' | tr -d '\n' base64 | md5sum | cut -c 1-10 | awk '{print $1}' | tr -d '\n'
} }
local i="$1" local i="$1"
export TITLE="$( local full_title="$(
echo "$i" | base64 --decode echo "$i" | base64 --decode | grep . || echo "${crawlable_source##*/}"
)" )"
TITLE="${TITLE##*/}" full_title="${full_title%/}"
full_title="${full_title#/}"
export TITLE="${full_title##*/}"
export CONTENT="$( export CONTENT="$(
$backend get "$crawlable_source" "$i" $backend get "$crawlable_source" "$i"
)" )"
export ID="$( export ID="$(
local sum="$pid/" local sum="$pid/"
local title_so_far="" local title_so_far=""
for subtitle in $(echo "$i" | base64 --decode | tr '/' '\n' | while read -r subtitle; do echo "$subtitle" | base64; done); do for subtitle in $(echo $full_title | tr '/' '\n' | while read -r subtitle; do echo "$subtitle" | base64; done); do
local subtitle="$(echo "$subtitle" | base64 --decode)" local subtitle="$(echo "$subtitle" | base64 --decode)"
if [ -n "$title_so_far" ]; then if [ -n "$title_so_far" ]; then
local mkdir_p_title="${title_so_far%/}" local mkdir_p_title="${title_so_far%/}"
@ -138,9 +140,13 @@ crawl_with() {
log " $ID ($TITLE): ${#CONTENT}" log " $ID ($TITLE): ${#CONTENT}"
push_crawled "$PID/$ID" "$TITLE" "$CONTENT" push_crawled "$PID/$ID" "$TITLE" "$CONTENT"
} }
for i in $(seq 0 $(("${#expanded[@]}"-1))); do if [ "${#expanded[@]}" -gt 0 ]; then
one "${expanded[i]}" for i in $(seq 0 $(("${#expanded[@]}"-1))); do
done one "${expanded[i]}"
done
else
one ""
fi
} }
push_crawled() { push_crawled() {

View File

@ -126,7 +126,7 @@
throw `failed to push file ${id}: ${status}: ${body}` throw `failed to push file ${id}: ${status}: ${body}`
} }
drawTree() drawTree()
drawFile(id) //drawFile(id)
document.getElementById("saveFeedback").innerHTML = "success!" document.getElementById("saveFeedback").innerHTML = "success!"
if (saveFeedbackInterval) { if (saveFeedbackInterval) {
clearInterval(saveFeedbackInterval) clearInterval(saveFeedbackInterval)
@ -283,11 +283,11 @@
<article id="article" style="display: none"> <article id="article" style="display: none">
<div> <div>
<h1 style="display: flex; flex-direction: row;"> <h1 style="display: flex; flex-direction: row;">
<input type="submit" value="DELETE" onclick="deleteFile(); return false;" style="margin-left: 5%; margin-right: 5%"/> <input type="submit" value="SAVE" onclick="pushFile(); return false;" style="margin-left: 5%; margin-right: 5%"/>
<span id="titlePath"> <span id="titlePath">
</span> </span>
<span id="title" contenteditable style="flex-grow: 1;"></span> <span id="title" contenteditable style="flex-grow: 1;"></span>
<input type="submit" value="SAVE" onclick="pushFile(); return false;"/> <input type="submit" value="DELETE" onclick="deleteFile(); return false;"/>
</h1> </h1>
</div> </div>
<div id="saveFeedback" style="min-height: 1.2em; text-align: right;"> <div id="saveFeedback" style="min-height: 1.2em; text-align: right;">
@ -323,7 +323,7 @@
link: ["[](", ")"], link: ["[](", ")"],
}, },
lineNumbers: true, lineNumbers: true,
lineWrapping: true, lineWrapping: false,
uploadImage: true, uploadImage: true,
imageUploadEndpoint: "/api/v0/media", // POST wants {data: {filePath: "/..."}} imageUploadEndpoint: "/api/v0/media", // POST wants {data: {filePath: "/..."}}
imagePathAbsolute: false, imagePathAbsolute: false,