ScrollHub is a web server application that provides git-based folder hosting with real-time collaboration features. It's built with Express.js and provides functionality for file management, version control, and live updates.
```javascript
class ScrollHub {
}
```
/createFolder.htm
- Create new folders/cloneFolder.htm
- Clone existing folders/writeFile.htm
- Write/update files/deleteFile.htm
- Delete files/uploadFile.htm
- File upload endpoint/rename.htm
- Rename files/mv.htm
- Move/rename folders/:repo.git/*
- Git repository access/revisions.htm/:folderName
- View commit history/diffs.htm/:folderName
- View file differences/revert.htm/:folderName
- Restore previous versions/.requests.htm
- SSE endpoint for real-time updates```javascript
const response = await fetch('/createFolder.htm', {
});
```
```javascript
const response = await fetch('/writeFile.htm', {
});
```
```javascript
const evtSource = new EventSource('/.requests.htm?folderName=my-project');
evtSource.onmessage = (event) => {
};
```
Required directories:
rootFolder
: Base directory for all hosted folderstemplatesFolder
: Directory containing folder templatestrashFolder
: Directory for deleted folders```javascript
{
}
```
The server implements comprehensive error handling:
Example error response:
```javascript
{
}
```
```
root/
โโโ folders/ # User folders
โ โโโ project1/
โ โโโ project2/
โโโ templates/ # Folder templates
โ โโโ blank_template/
โ โโโ other_templates/
โโโ trash/ # Deleted folders
```
- Must start with a lowercase letter
- Use appropriate file extensions
- Implement proper authentication if needed
- Automatic certificate generation for HTTPS
- File operations are asynchronous
- Request logging
Common issues and solutions:
- Issue: "Your IP has been temporarily throttled"
- Issue: "Editing 'xyz' files not yet supported"
- Issue: SSL certificate errors
- Issue: Git operation failures
When contributing to ScrollHub:
Major dependencies:
child_process
git-http-backend
compression
express-fileupload
ScrollHub is open source, public domain software.