mirror of
https://github.com/mivodev/mivodev.github.io.git
synced 2026-01-26 13:32:07 +07:00
feat: Add script to generate plugin registry and documentation, including initial Mivo Theme plugin data and its mirrored documentation.
This commit is contained in:
30
plugins/plugin-mivo-theme.md
Normal file
30
plugins/plugin-mivo-theme.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
layout: doc
|
||||||
|
title: "Mivo Theme Downloader"
|
||||||
|
description: "Allows downloading the Captive Portal theme with auto-configuration."
|
||||||
|
---
|
||||||
|
|
||||||
|
# Mivo Theme Downloader
|
||||||
|
|
||||||
|
**Category:** Hotspot Tools
|
||||||
|
**Author:** DyzulkDev
|
||||||
|
**Version:** 1.0.0
|
||||||
|
|
||||||
|
The **Mivo Theme Downloader** allows you to easily download and install the latest Captive Portal themes directly from the Mivo settings panel.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- **One-Click Download**: Fetch the latest themes from the official repository.
|
||||||
|
- **Auto-Extraction**: Automatically extracts and places theme files in the correct directory.
|
||||||
|
- **Updates**: Keeps your hotspot login page up to date with new designs.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
1. Download the plugin ZIP file.
|
||||||
|
2. Go to **Mivo > Settings > Plugins**.
|
||||||
|
3. Click **Upload Plugin** and select the ZIP file.
|
||||||
|
4. The plugin will appear in your installed list.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Navigate to the **Theme Manager** in the sidebar (under Hotspot Tools) to browse and download available themes.
|
||||||
|
|
||||||
|
---
|
||||||
|
*This documentation is automatically mirrored from the [source repository](https://github.com/mivodev/plugin-mivo-theme).*
|
||||||
@@ -3,10 +3,9 @@
|
|||||||
"id": "plugin-mivo-theme",
|
"id": "plugin-mivo-theme",
|
||||||
"name": "Mivo Theme Downloader",
|
"name": "Mivo Theme Downloader",
|
||||||
"description": "Allows downloading the Captive Portal theme with auto-configuration.",
|
"description": "Allows downloading the Captive Portal theme with auto-configuration.",
|
||||||
"version": "1.0.0",
|
|
||||||
"author": "DyzulkDev",
|
"author": "DyzulkDev",
|
||||||
|
"version": "1.0.0",
|
||||||
"category": "Hotspot Tools",
|
"category": "Hotspot Tools",
|
||||||
"scope": "Session",
|
|
||||||
"tags": [
|
"tags": [
|
||||||
"theme",
|
"theme",
|
||||||
"downloader",
|
"downloader",
|
||||||
@@ -15,23 +14,7 @@
|
|||||||
],
|
],
|
||||||
"repo": "https://github.com/mivodev/plugin-mivo-theme",
|
"repo": "https://github.com/mivodev/plugin-mivo-theme",
|
||||||
"download": "https://github.com/mivodev/plugin-mivo-theme/archive/refs/heads/main.zip",
|
"download": "https://github.com/mivodev/plugin-mivo-theme/archive/refs/heads/main.zip",
|
||||||
"readme": "https://raw.githubusercontent.com/mivodev/plugin-mivo-theme/main/README.md"
|
"readme": "/plugins/plugin-mivo-theme",
|
||||||
},
|
"updated_at": "2026-01-18T09:01:34Z"
|
||||||
{
|
|
||||||
"id": "plugin-backup-manager",
|
|
||||||
"name": "Backup Manager (Demo)",
|
|
||||||
"description": "Automated daily backups to Google Drive.",
|
|
||||||
"version": "2.1.0",
|
|
||||||
"author": "MivoTeam",
|
|
||||||
"category": "System Tools",
|
|
||||||
"scope": "Global",
|
|
||||||
"tags": [
|
|
||||||
"backup",
|
|
||||||
"security",
|
|
||||||
"cloud"
|
|
||||||
],
|
|
||||||
"repo": "#",
|
|
||||||
"download": "#",
|
|
||||||
"readme": "#"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -84,8 +84,8 @@ foreach ($repos as $repo) {
|
|||||||
'category' => $metadata['category'] ?? 'Uncategorized',
|
'category' => $metadata['category'] ?? 'Uncategorized',
|
||||||
'tags' => array_map('trim', explode(',', $metadata['tags'] ?? '')),
|
'tags' => array_map('trim', explode(',', $metadata['tags'] ?? '')),
|
||||||
'repo' => $repo['html_url'],
|
'repo' => $repo['html_url'],
|
||||||
'download' => $repo['html_url'] . '/archive/refs/heads/' . $repo['default_branch'] . '.zip', // Default to main/master zip
|
'download' => $repo['html_url'] . '/archive/refs/heads/' . $repo['default_branch'] . '.zip',
|
||||||
'readme' => $repo['html_url'] . '#readme', // Link to GitHub readme for now
|
'readme' => '/plugins/' . $repo['name'], // Link to local mirrored doc
|
||||||
'updated_at' => $repo['updated_at']
|
'updated_at' => $repo['updated_at']
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -100,4 +100,54 @@ foreach ($repos as $repo) {
|
|||||||
$json = json_encode($plugins, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
$json = json_encode($plugins, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
file_put_contents($outputFile, $json);
|
file_put_contents($outputFile, $json);
|
||||||
|
|
||||||
echo "Done! Generated " . count($plugins) . " plugins.\n";
|
echo "Done! Generated " . count($plugins) . " plugins in JSON.\n";
|
||||||
|
|
||||||
|
// 5. Generate Documentation Pages (Mirroring)
|
||||||
|
echo "Starting Documentation Mirroring...\n";
|
||||||
|
$docsDir = __DIR__ . '/../plugins'; // Target directory
|
||||||
|
|
||||||
|
foreach ($plugins as $plugin) {
|
||||||
|
echo "Mirroring docs for: " . $plugin['name'] . "\n";
|
||||||
|
|
||||||
|
// Fetch README
|
||||||
|
$readmeUrl = "https://raw.githubusercontent.com/$orgName/{$plugin['id']}/{$repo['default_branch']}/README.md";
|
||||||
|
$readmeContent = fetchUrl($readmeUrl, $githubToken);
|
||||||
|
|
||||||
|
if (!$readmeContent) {
|
||||||
|
// Try master/main if default branch fetch failed
|
||||||
|
$readmeContent = fetchUrl("https://raw.githubusercontent.com/$orgName/{$plugin['id']}/main/README.md", $githubToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($readmeContent) {
|
||||||
|
// Sanitize & Prepend Frontmatter
|
||||||
|
$title = $plugin['name'];
|
||||||
|
$desc = $plugin['description'];
|
||||||
|
|
||||||
|
// Remove the first # H1 if it matches the title (or any H1) to avoid duplication
|
||||||
|
// This removes the first line if it starts with #
|
||||||
|
$readmeContent = preg_replace('/^#\s+.+\n/', '', $readmeContent, 1);
|
||||||
|
$readmeContent = trim($readmeContent);
|
||||||
|
|
||||||
|
$mdContent = <<<EOT
|
||||||
|
---
|
||||||
|
layout: doc
|
||||||
|
title: "$title"
|
||||||
|
description: "$desc"
|
||||||
|
---
|
||||||
|
|
||||||
|
# $title
|
||||||
|
|
||||||
|
$readmeContent
|
||||||
|
|
||||||
|
---
|
||||||
|
*This documentation is automatically mirrored from the [source repository]({$plugin['repo']}).*
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
// Save to plugins/[id].md
|
||||||
|
file_put_contents("$docsDir/{$plugin['id']}.md", $mdContent);
|
||||||
|
echo " + Created: plugins/{$plugin['id']}.md\n";
|
||||||
|
} else {
|
||||||
|
echo " - Warning: README not found for {$plugin['id']}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user