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 {
}
```
/create.htm
- Create new folders/clone.htm
- Clone existing folders/write.htm
- Write/update files/delete.htm
- Delete files/upload.htm
- File upload endpoint/rename.htm
- Rename files/mv.htm
- Move/rename folders/:repo.git/*
- Git repository access/history.htm/:folderName
- View commit history/diff.htm/:folderName
- View file differences/revert.htm/:folderName
- Restore previous versions/requests.htm
- SSE endpoint for real-time updates```javascript
const response = await fetch('/create.htm', {
});
```
```javascript
const response = await fetch('/write.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.