mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-03 00:03:14 -04:00
Trigger subscription update from manager page
This commit is contained in:
@@ -61,7 +61,7 @@ class CLI < Clim
|
||||
Library.load_instance
|
||||
Library.default
|
||||
Plugin::Downloader.default
|
||||
Plugin::Updater.new
|
||||
Plugin::Updater.default
|
||||
|
||||
spawn do
|
||||
begin
|
||||
|
||||
@@ -153,6 +153,11 @@ class Plugin
|
||||
list.save
|
||||
end
|
||||
|
||||
def check_subscription(id : String)
|
||||
sub = list_subscriptions_raw.find &.id.== id
|
||||
Plugin::Updater.default.check_subscription self, sub.not_nil!
|
||||
end
|
||||
|
||||
def initialize(id : String)
|
||||
Plugin.build_info_ary
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require "../config"
|
||||
|
||||
class Plugin
|
||||
class Updater
|
||||
use_default
|
||||
|
||||
def initialize
|
||||
interval = Config.current.plugin_update_interval_hours
|
||||
return if interval <= 0
|
||||
|
||||
@@ -721,6 +721,23 @@ struct APIRouter
|
||||
end
|
||||
end
|
||||
|
||||
post "/api/admin/plugin/subscriptions/update" do |env|
|
||||
pid = env.params.query["plugin"].as String
|
||||
sid = env.params.query["subscription"].as String
|
||||
|
||||
Plugin.new(pid).check_subscription sid
|
||||
|
||||
send_json env, {
|
||||
"success" => true,
|
||||
}.to_json
|
||||
rescue e
|
||||
Logger.error e
|
||||
send_json env, {
|
||||
"success" => false,
|
||||
"error" => e.message,
|
||||
}.to_json
|
||||
end
|
||||
|
||||
Koa.describe "Lists the chapters in a title from a plugin"
|
||||
Koa.tags ["admin", "downloader"]
|
||||
Koa.query "plugin", schema: String
|
||||
|
||||
Reference in New Issue
Block a user