File Manager & Git¶
Overview¶
The built-in file manager provides browser-based access to website files with syntax-highlighted editing, upload/download, archive management, and integrated Git operations.
All file manager operations require the websites_management permission. The username query parameter specifies which website's files to access.
Listing Files¶
Response:
{
"data": [
{
"name": "public_html",
"type": "dir",
"size": 4096,
"permissions": "0755",
"modified": "2024-01-15T10:00:00Z"
}
]
}
Reading a File¶
Writing a File¶
POST /api/filemanager/write?username=example
{
"path": "/public_html/index.php",
"content": "<?php echo 'Hello'; ?>"
}
Uploading Files¶
POST /api/filemanager/upload?username=example&path=/public_html/
Content-Type: multipart/form-data
# Form field: file (binary)
Downloading a File¶
Creating a Directory¶
Deleting Files/Directories¶
POST /api/filemanager/delete
{
"username": "example",
"paths": ["/public_html/old-file.php", "/public_html/temp/"]
}
Renaming / Moving¶
# Rename
POST /api/filemanager/rename
{
"username": "example",
"old_path": "/public_html/old.php",
"new_path": "/public_html/new.php"
}
# Move (multiple files)
POST /api/filemanager/move
{
"username": "example",
"paths": ["/public_html/file1.php"],
"destination": "/public_html/backup/"
}
Copying Files¶
POST /api/filemanager/copy
{
"username": "example",
"paths": ["/public_html/config.php"],
"destination": "/public_html/backup/"
}
Permissions (chmod)¶
POST /api/filemanager/chmod
{
"username": "example",
"path": "/public_html/",
"mode": "0755",
"recursive": true
}
Archive: Compress & Extract¶
# Compress to zip/tar.gz
POST /api/filemanager/compress
{
"username": "example",
"paths": ["/public_html/"],
"destination": "/backups/site.tar.gz",
"format": "tar.gz"
}
# Extract archive
POST /api/filemanager/extract
{
"username": "example",
"path": "/backups/site.tar.gz",
"destination": "/public_html/"
}
Downloading from URL¶
POST /api/filemanager/download-url
{
"username": "example",
"url": "https://example.com/file.zip",
"path": "/public_html/"
}
File History (Versioning)¶
StarkOne tracks changes to files in the file manager:
# Get history for a file
GET /api/filemanager/history?username=example&path=/public_html/index.php
# Get all history
GET /api/filemanager/history/all?username=example
# Download historical version
GET /api/filemanager/history/download?username=example&path=...&revision=...
# View historical content
GET /api/filemanager/history/content?username=example&path=...&revision=...
# Restore a previous version
POST /api/filemanager/history/restore
{
"username": "example",
"path": "/public_html/index.php",
"revision": "abc123"
}
# Clear history
POST /api/filemanager/history/clear
{ "username": "example" }
Locking Files¶
Prevent concurrent edits:
POST /api/filemanager/lock
{ "username": "example", "path": "/public_html/index.php" }
POST /api/filemanager/unlock
{ "username": "example", "path": "/public_html/index.php" }
Searching Files¶
Or via website endpoint:
Git Integration¶
The file manager includes full Git support per website.
Status¶
Returns current branch, staged/unstaged changes, untracked files.
Diff¶
Pull¶
Commit¶
POST /api/filemanager/git/commit
{
"username": "example",
"path": "/public_html",
"message": "Fix header layout",
"files": ["index.php", "style.css"] # optional, commits all if omitted
}
Push¶
Clone a Repository¶
POST /api/filemanager/git/clone
{
"username": "example",
"path": "/public_html",
"url": "https://github.com/org/repo.git",
"branch": "main"
}
Init Repository¶
Add Remote¶
POST /api/filemanager/git/remote
{
"username": "example",
"path": "/public_html",
"url": "https://github.com/org/repo.git",
"name": "origin"
}