From ce3318b047071bd94c5a560d8a4b856657886c23 Mon Sep 17 00:00:00 2001 From: bardicreels <180100244+bardicreels@users.noreply.github.com> Date: Sun, 10 Nov 2024 17:18:03 +0000 Subject: [PATCH 1/7] added git acp command (#18) --- readme.scroll | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/readme.scroll b/readme.scroll index 2dab6789..2bde01d8 100644 --- a/readme.scroll +++ b/readme.scroll @@ -24,6 +24,17 @@ Torify your site with an onion domain: https://www.torproject.org/about/history/ sudo apt update && sudo apt install -y tor && echo -e "HiddenServiceDir /var/lib/tor/hidden_service/\nHiddenServicePort 80 127.0.0.1:3000" | sudo tee -a /etc/tor/torrc && sudo systemctl restart tor && sudo cat /var/lib/tor/hidden_service/hostname + +#Development Environmet Steps + Add ''' +git config --global alias.acp '!git add . && git commit -m "local Update" && git push' +''' + +and use git acp to push to remote + +Make sure server side .gitignore includes all log and often changed files, to avoid local push conflicts. + + ScrollHub is public domain. footer.scroll From 55f617f7a785f97115822f56c438aa9dd6ba8e64 Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Sun, 10 Nov 2024 07:21:52 -1000 Subject: [PATCH 2/7] --- readme.scroll | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/readme.scroll b/readme.scroll index 2bde01d8..1ed62fa2 100644 --- a/readme.scroll +++ b/readme.scroll @@ -25,15 +25,24 @@ Torify your site with an onion domain: https://www.torproject.org/about/history/ sudo apt update && sudo apt install -y tor && echo -e "HiddenServiceDir /var/lib/tor/hidden_service/\nHiddenServicePort 80 127.0.0.1:3000" | sudo tee -a /etc/tor/torrc && sudo systemctl restart tor && sudo cat /var/lib/tor/hidden_service/hostname -#Development Environmet Steps - Add ''' -git config --global alias.acp '!git add . && git commit -m "local Update" && git push' -''' - -and use git acp to push to remote - -Make sure server side .gitignore includes all log and often changed files, to avoid local push conflicts. - +# Helpful Dev Environment Aliases + +code + # Scroll + alias sb="scroll build" + + # Npm + alias x="npm run" + + # ScrollHub + alias hub="hub start" + + # Git + alias gs="git status" + alias ga="git add ." + alias gc="git commit --allow-empty-message -m ''" + alias acp="git add . && git commit --allow-empty-message -m '' && git push" + # Make sure server side .gitignore includes all log and often changed files, to avoid local push conflicts. ScrollHub is public domain. From 5273370bdc38af34c8ad21a282545bf918ef8cd7 Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Sun, 10 Nov 2024 08:46:31 -1000 Subject: [PATCH 3/7] --- ScrollHub.js | 25 +++++++++++++++++-------- package.json | 2 +- releaseNotes.scroll | 3 +++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ScrollHub.js b/ScrollHub.js index 889d6e7d..fa0fd64f 100644 --- a/ScrollHub.js +++ b/ScrollHub.js @@ -936,17 +936,27 @@ ${prefix}${hash}
const { app } = this const checkWritePermissions = this.checkWritePermissions.bind(this) - app.get("/t/:folderName", checkWritePermissions, async (req, res) => { - await this.runCommand(req, res, "test") + app.get("/test/:folderName", checkWritePermissions, async (req, res) => { + await this.runScrollCommand(req, res, "test") }) - app.get("/b/:folderName", checkWritePermissions, async (req, res) => { - await this.runCommand(req, res, "build") + app.get("/build/:folderName", checkWritePermissions, async (req, res) => { + await this.runScrollCommand(req, res, "build") + this.updateFolderAndBuildList(this.getFolderName(req)) }) - app.get("/f/:folderName", checkWritePermissions, async (req, res) => { - await this.runCommand(req, res, "format") + app.get("/format/:folderName", checkWritePermissions, async (req, res) => { + await this.runScrollCommand(req, res, "format") + this.updateFolderAndBuildList(this.getFolderName(req)) }) + + app.get("/status/:folderName", checkWritePermissions, async (req, res) => { + await this.runCommand(req, res, "git status") + }) + } + + async runScrollCommand(req, res, command) { + await this.runCommand(req, res, `scroll list | scroll ${command}`) } async runCommand(req, res, command) { @@ -957,10 +967,9 @@ ${prefix}${hash}
try { const folderPath = path.join(rootFolder, folderName) - const { stdout } = await execAsync(`scroll list | scroll ${command}`, { cwd: folderPath }) + const { stdout } = await execAsync(command, { cwd: folderPath }) res.setHeader("Content-Type", "text/plain") res.send(stdout.toString()) - if (command !== "test") this.updateFolderAndBuildList(folderName) } catch (error) { console.error(`Error running '${command}' in '${folderName}':`, error) res.status(500).send(`An error occurred while running '${command}' in '${folderName}'`) diff --git a/package.json b/package.json index dc1acfdd..fe4a19fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrollhub", - "version": "0.26.0", + "version": "0.27.0", "description": "ScrollHub turns any server into a place where people can instantly launch unlimited new (ephemeral) website powered by Scroll.", "main": "server.js", "author": "Breck Yunits", diff --git a/releaseNotes.scroll b/releaseNotes.scroll index 970d04c5..c1ef1811 100644 --- a/releaseNotes.scroll +++ b/releaseNotes.scroll @@ -18,6 +18,9 @@ node_modules/scroll-cli/microlangs/changes.parsers thinColumns 1 +馃摝 0.27.0 11/10/2024 +馃帀 new /status/:folderName route to help debugging git sync issues + 馃摝 0.26.0 11/09/2024 馃彞 git fix From 45fba2dd19cca1acd48f16e1f83d1819c2e160af Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Sun, 10 Nov 2024 09:07:40 -1000 Subject: [PATCH 4/7] Add git info --- readme.scroll | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/readme.scroll b/readme.scroll index 1ed62fa2..6d711090 100644 --- a/readme.scroll +++ b/readme.scroll @@ -44,6 +44,18 @@ code alias acp="git add . && git commit --allow-empty-message -m '' && git push" # Make sure server side .gitignore includes all log and often changed files, to avoid local push conflicts. +# Git Troubleshooting + +ScrollHub uses git for versioning files. + +If developing locally, occasionally you may run into merge conflicts. + +To see the "git status" for a folder visit: https://hub.scroll.pub/status/[folderName] + +It is recommended to prevent force pushes on your server with `git config --system receive.denyNonFastForwards true`. + +**** + ScrollHub is public domain. footer.scroll From d4e9c28b00f06ed5355c4204abfc8345de9b921c Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Sun, 10 Nov 2024 10:10:40 -1000 Subject: [PATCH 5/7] --- ScrollHub.js | 3 +++ package.json | 2 +- releaseNotes.scroll | 3 +++ templates/blank_template/.gitignore | 4 +++- templates/blog_template/.gitignore | 6 ------ templates/gallery_template/.gitignore | 6 ------ templates/paper_template/.gitignore | 6 ------ templates/teaser_template/.gitignore | 6 ------ 8 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 templates/blog_template/.gitignore delete mode 100644 templates/gallery_template/.gitignore delete mode 100644 templates/paper_template/.gitignore delete mode 100644 templates/teaser_template/.gitignore diff --git a/ScrollHub.js b/ScrollHub.js index fa0fd64f..8db9583a 100644 --- a/ScrollHub.js +++ b/ScrollHub.js @@ -1223,6 +1223,7 @@ ${prefix}${hash}
ensureTemplatesInstalled() { const { rootFolder, templatesFolder } = this const templateDirs = fs.readdirSync(templatesFolder) + const standardGitIgnore = fs.readFileSync(path.join(templatesFolder, "blank_template", ".gitignore"), "utf8") for (const dir of templateDirs) { const sourcePath = path.join(templatesFolder, dir) @@ -1237,6 +1238,8 @@ ${prefix}${hash}
// Copy the template folder to the root folder execSync(`cp -R ${sourcePath} ${destPath};`, { cwd: rootFolder }) + fs.writeFileSync(path.join(destPath, ".gitignore"), standardGitIgnore, "utf8") + // Initialize Git repository execSync(`git init; git add .; git commit -m 'initial ${dir} template'`, { cwd: destPath }) this.buildFolderSync(dir) diff --git a/package.json b/package.json index fe4a19fa..455b87d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scrollhub", - "version": "0.27.0", + "version": "0.28.0", "description": "ScrollHub turns any server into a place where people can instantly launch unlimited new (ephemeral) website powered by Scroll.", "main": "server.js", "author": "Breck Yunits", diff --git a/releaseNotes.scroll b/releaseNotes.scroll index c1ef1811..45501612 100644 --- a/releaseNotes.scroll +++ b/releaseNotes.scroll @@ -18,6 +18,9 @@ node_modules/scroll-cli/microlangs/changes.parsers thinColumns 1 +馃摝 0.28.0 11/10/2024 +馃彞 temporary cleanup of git issues with templates + 馃摝 0.27.0 11/10/2024 馃帀 new /status/:folderName route to help debugging git sync issues diff --git a/templates/blank_template/.gitignore b/templates/blank_template/.gitignore index afa85ad1..bd1a52db 100644 --- a/templates/blank_template/.gitignore +++ b/templates/blank_template/.gitignore @@ -3,4 +3,6 @@ *.txt *.xml *.css -*.js \ No newline at end of file +*.js +*.csv +requests.scroll \ No newline at end of file diff --git a/templates/blog_template/.gitignore b/templates/blog_template/.gitignore deleted file mode 100644 index afa85ad1..00000000 --- a/templates/blog_template/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -*.html -*.txt -*.xml -*.css -*.js \ No newline at end of file diff --git a/templates/gallery_template/.gitignore b/templates/gallery_template/.gitignore deleted file mode 100644 index afa85ad1..00000000 --- a/templates/gallery_template/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -*.html -*.txt -*.xml -*.css -*.js \ No newline at end of file diff --git a/templates/paper_template/.gitignore b/templates/paper_template/.gitignore deleted file mode 100644 index afa85ad1..00000000 --- a/templates/paper_template/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -*.html -*.txt -*.xml -*.css -*.js \ No newline at end of file diff --git a/templates/teaser_template/.gitignore b/templates/teaser_template/.gitignore deleted file mode 100644 index afa85ad1..00000000 --- a/templates/teaser_template/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -*.html -*.txt -*.xml -*.css -*.js \ No newline at end of file From 1ad8859a65c8b9680979096169c57dff41a8111d Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Sun, 10 Nov 2024 14:54:58 -1000 Subject: [PATCH 6/7] Add edit shortcut links. Revision route cleanup --- ScrollHub.js | 20 ++++++++++++-------- docs.scroll | 4 ++-- scrollHubEditor.js | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ScrollHub.js b/ScrollHub.js index 8db9583a..4efbc602 100644 --- a/ScrollHub.js +++ b/ScrollHub.js @@ -392,7 +392,7 @@ class ScrollHub { initHistoryRoutes() { const { app, rootFolder, folderCache } = this const checkWritePermissions = this.checkWritePermissions.bind(this) - app.get("/history.htm/:folderName", async (req, res) => { + app.get("/revisions.htm/:folderName", async (req, res) => { const folderName = sanitizeFolderName(req.params.folderName) const folderPath = path.join(rootFolder, folderName) if (!folderCache[folderName]) return res.status(404).send("Folder not found") @@ -408,7 +408,7 @@ class ScrollHub { res.status(500).send("An error occurred while fetching the git log") } }) - app.get("/diff.htm/:folderName", async (req, res) => { + app.get("/diffs.htm/:folderName", async (req, res) => { const folderName = sanitizeFolderName(req.params.folderName) const folderPath = path.join(rootFolder, folderName) if (!folderCache[folderName]) return res.status(404).send("Folder not found") @@ -538,7 +538,7 @@ ${prefix}${hash}
await this.buildFolder(folderName) - res.redirect("/diff.htm/" + folderName) + res.redirect("/diffs.htm/" + folderName) this.updateFolderAndBuildList(folderName) } catch (error) { console.error(error) @@ -564,10 +564,6 @@ ${prefix}${hash}
const { app, rootFolder, folderCache } = this const checkWritePermissions = this.checkWritePermissions.bind(this) - app.get("/e/:folderName", async (req, res) => { - res.redirect("/edit.html?folderName=" + req.params.folderName) - }) - app.post("/create.htm", checkWritePermissions, async (req, res) => { try { const result = await this.createFolder(req.body.folderName) @@ -936,6 +932,14 @@ ${prefix}${hash}
const { app } = this const checkWritePermissions = this.checkWritePermissions.bind(this) + app.get("/edit/:folderName", async (req, res) => { + res.redirect("/edit.html?folderName=" + req.params.folderName) + }) + + app.get("/edit", async (req, res) => { + res.redirect("/edit.html") + }) + app.get("/test/:folderName", checkWritePermissions, async (req, res) => { await this.runScrollCommand(req, res, "test") }) @@ -1444,7 +1448,7 @@ Download folders as JSON | CSV | TSV table folders.csv compose links editzip select folder folderLink links revised hash files mb revisions - compose hashLink diff.htm/{folder} + compose hashLink diffs.htm/{folder} orderBy -revised rename revised lastRevised printTable diff --git a/docs.scroll b/docs.scroll index 58709efa..7d88d8dc 100644 --- a/docs.scroll +++ b/docs.scroll @@ -59,8 +59,8 @@ class ScrollHub { #### Git Integration - `/:repo.git/*` - Git repository access -- `/history.htm/:folderName` - View commit history -- `/diff.htm/:folderName` - View file differences +- `/revisions.htm/:folderName` - View commit history +- `/diffs.htm/:folderName` - View file differences - `/revert.htm/:folderName` - Restore previous versions #### Real-time Features diff --git a/scrollHubEditor.js b/scrollHubEditor.js index c5782b9e..d3d96bfe 100644 --- a/scrollHubEditor.js +++ b/scrollHubEditor.js @@ -368,7 +368,7 @@ class EditorApp { updateFooterLinks() { const { folderName } = this document.getElementById("gitClone").innerHTML = - `live traffichistorydownloadduplicaterenamedelete` + `live trafficrevisionsdownloadduplicaterenamedelete` } async renameFolder() { From 33de6ac51057d4043ee3cd158462ea0e541959a2 Mon Sep 17 00:00:00 2001 From: Breck Yunits Date: Mon, 11 Nov 2024 05:18:24 -1000 Subject: [PATCH 7/7] Put count param in default link to revisions --- scrollHubEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrollHubEditor.js b/scrollHubEditor.js index d3d96bfe..aa34282e 100644 --- a/scrollHubEditor.js +++ b/scrollHubEditor.js @@ -368,7 +368,7 @@ class EditorApp { updateFooterLinks() { const { folderName } = this document.getElementById("gitClone").innerHTML = - `live trafficrevisionsdownloadduplicaterenamedelete` + `live trafficrevisionsdownloadduplicaterenamedelete` } async renameFolder() {