Metabolizer Blog Pipeline - integrated CMS for SecuBox: - Gitea: Mirror GitHub repos, store blog content - Streamlit: CMS app with markdown editor and live preview - HexoJS: Static site generator (clean → generate → publish) - Webhooks: Auto-rebuild on git push - Portal: Static blog served at /blog/ Pipeline: Edit in Streamlit CMS → Push to Gitea → Build with Hexo → Publish Packages: - secubox-app-streamlit: Streamlit server with LXC container - luci-app-streamlit: LuCI dashboard for Streamlit apps - secubox-app-metabolizer: CMS pipeline orchestrator CMS Features: - Two-column markdown editor with live preview - YAML front matter editor - Post management (drafts, publish, unpublish) - Media library with image upload - Git sync and Hexo build controls - Cyberpunk theme styling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
222 lines
4.0 KiB
JavaScript
222 lines
4.0 KiB
JavaScript
'use strict';
|
|
'require rpc';
|
|
'require baseclass';
|
|
|
|
/**
|
|
* Streamlit Platform API Module
|
|
* RPCD interface for Streamlit Platform
|
|
*/
|
|
|
|
var callGetStatus = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'get_status',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callGetConfig = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'get_config',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callSaveConfig = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'save_config',
|
|
params: ['http_port', 'http_host', 'data_path', 'memory_limit', 'enabled', 'active_app', 'headless', 'browser_gather_usage_stats', 'theme_base', 'theme_primary_color'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callStart = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'start',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callStop = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'stop',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callRestart = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'restart',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callInstall = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'install',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callUninstall = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'uninstall',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callUpdate = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'update',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callGetLogs = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'get_logs',
|
|
params: ['lines'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callListApps = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'list_apps',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callGetApp = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'get_app',
|
|
params: ['name'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callAddApp = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'add_app',
|
|
params: ['name', 'path'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callRemoveApp = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'remove_app',
|
|
params: ['name'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callSetActiveApp = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'set_active_app',
|
|
params: ['name'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callUploadApp = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'upload_app',
|
|
params: ['name', 'content'],
|
|
expect: { result: {} }
|
|
});
|
|
|
|
var callGetInstallProgress = rpc.declare({
|
|
object: 'luci.streamlit',
|
|
method: 'get_install_progress',
|
|
expect: { result: {} }
|
|
});
|
|
|
|
return baseclass.extend({
|
|
getStatus: function() {
|
|
return callGetStatus();
|
|
},
|
|
|
|
getConfig: function() {
|
|
return callGetConfig();
|
|
},
|
|
|
|
saveConfig: function(config) {
|
|
return callSaveConfig(
|
|
config.http_port,
|
|
config.http_host,
|
|
config.data_path,
|
|
config.memory_limit,
|
|
config.enabled,
|
|
config.active_app,
|
|
config.headless,
|
|
config.browser_gather_usage_stats,
|
|
config.theme_base,
|
|
config.theme_primary_color
|
|
);
|
|
},
|
|
|
|
start: function() {
|
|
return callStart();
|
|
},
|
|
|
|
stop: function() {
|
|
return callStop();
|
|
},
|
|
|
|
restart: function() {
|
|
return callRestart();
|
|
},
|
|
|
|
install: function() {
|
|
return callInstall();
|
|
},
|
|
|
|
uninstall: function() {
|
|
return callUninstall();
|
|
},
|
|
|
|
update: function() {
|
|
return callUpdate();
|
|
},
|
|
|
|
getLogs: function(lines) {
|
|
return callGetLogs(lines || 100).then(function(res) {
|
|
return res.logs || [];
|
|
});
|
|
},
|
|
|
|
listApps: function() {
|
|
return callListApps().then(function(res) {
|
|
return {
|
|
apps: res.apps || [],
|
|
active_app: res.active_app || 'hello',
|
|
apps_path: res.apps_path || '/srv/streamlit/apps'
|
|
};
|
|
});
|
|
},
|
|
|
|
getApp: function(name) {
|
|
return callGetApp(name);
|
|
},
|
|
|
|
addApp: function(name, path) {
|
|
return callAddApp(name, path);
|
|
},
|
|
|
|
removeApp: function(name) {
|
|
return callRemoveApp(name);
|
|
},
|
|
|
|
setActiveApp: function(name) {
|
|
return callSetActiveApp(name);
|
|
},
|
|
|
|
uploadApp: function(name, content) {
|
|
return callUploadApp(name, content);
|
|
},
|
|
|
|
getInstallProgress: function() {
|
|
return callGetInstallProgress();
|
|
},
|
|
|
|
getDashboardData: function() {
|
|
var self = this;
|
|
return Promise.all([
|
|
self.getStatus(),
|
|
self.listApps(),
|
|
self.getLogs(50)
|
|
]).then(function(results) {
|
|
return {
|
|
status: results[0] || {},
|
|
apps: results[1] || {},
|
|
logs: results[2] || []
|
|
};
|
|
});
|
|
}
|
|
});
|