mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-04 00:00:51 -04:00
WIP
This commit is contained in:
@@ -43,7 +43,7 @@ struct Filter
|
||||
key = json["key"].as_s
|
||||
type = FilterType.from_string json["type"].as_s
|
||||
_value = json["value"]
|
||||
value = _value.as_s? || _value.as_i32? || _value.as_i64? ||
|
||||
value = _value.as_s? || _value.as_i? || _value.as_i64? ||
|
||||
_value.as_f32? || nil
|
||||
self.new key, value, type
|
||||
end
|
||||
@@ -82,6 +82,6 @@ struct SubscriptionList
|
||||
end
|
||||
|
||||
def save
|
||||
File.write @path, @ary.to_json
|
||||
File.write @path, @ary.to_pretty_json
|
||||
end
|
||||
end
|
||||
|
||||
@@ -633,7 +633,9 @@ struct APIRouter
|
||||
post "/api/admin/plugin/subscribe" do |env|
|
||||
begin
|
||||
plugin_id = env.params.json["plugin"].as String
|
||||
filters = Array(Filter).from_json env.params.json["filters"].to_s
|
||||
filters = JSON.parse(env.params.json["filters"].to_s).as_a.map do |f|
|
||||
Filter.from_json f.to_json
|
||||
end
|
||||
name = env.params.json["name"].as String
|
||||
|
||||
sub = Subscription.new plugin_id, name
|
||||
@@ -651,6 +653,7 @@ struct APIRouter
|
||||
"success" => false,
|
||||
"error" => e.message,
|
||||
}.to_json
|
||||
raise e
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -133,6 +133,8 @@
|
||||
</template>
|
||||
<button class="uk-button uk-button-primary" @click.prevent="applyFilters()">Apply</button>
|
||||
<button class="uk-button uk-button-default" @click.prevent="clearFilters()">Clear</button>
|
||||
<span class="uk-divider-vertical uk-margin-left uk-margin-right"></span>
|
||||
<button class="uk-button uk-button-default" @click.prevent="subscribe()" :disable="subscribing">Subscribe</button>
|
||||
</form>
|
||||
|
||||
<p class="uk-text-meta" x-show="chapters && chapters.length > chaptersLimit" x-text="`The manga has ${chapters ? chapters.length : 0} chapters, but Mango can only list up to ${chaptersLimit}. Please use the filters to narrow down your search.`"></p>
|
||||
|
||||
Reference in New Issue
Block a user