Skip to content

Commit

Permalink
Merge pull request #45 from leozqin/interval
Browse files Browse the repository at this point in the history
Add support for changing refresh interval
  • Loading branch information
leozqin authored May 26, 2024
2 parents 471dccb + 0ebac69 commit 7ca7fa2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 25 deletions.
4 changes: 3 additions & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
bk = PrecisBackend(db=storage_handler)
rss = PrecisRSS(db=storage_handler)

p_settings: GlobalSettings = storage_handler.get_settings()

@repeat_every(seconds=60 * 5, logger=logger)

@repeat_every(seconds=60 * p_settings.refresh_interval, logger=logger)
async def poll_feeds():
logger.info("Checking feeds for updates")
await rss.check_feeds()
Expand Down
2 changes: 1 addition & 1 deletion app/static/icons/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/static/output.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/templates/handler_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1 class="text-2xl justify-center flex my-5">
Schema
</h1>
<div class="mockup-code">
<pre><code>{{ schema }}</code></pre>
<pre><code>{{ schema }}</code></pre>
</div>
</section>
<section class="h-screen">
Expand Down Expand Up @@ -77,4 +77,4 @@ <h1 class="text-2xl justify-center flex my-5">
</section>
</body>

</html>
</html>
42 changes: 23 additions & 19 deletions app/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2 class="text-4xl lg:text-2xl my-5 justify-center flex">
</div>
<section class="h-screen">
<form method="post" action="/api/update_settings/">
<div class="form-control w-2/3 lg:w-1/3 mx-auto">
<div class="form-control w-4/5 lg:w-3/5 mx-auto">
<label class="label cursor-pointer gap-2">
<span class="label-text text-2xl lg:text-xl">Send Notifications</span>
<input name="send_notification" type="checkbox" class="toggle" {% if settings.send_notification %} checked {%
Expand Down Expand Up @@ -82,7 +82,8 @@ <h2 class="text-4xl lg:text-2xl my-5 justify-center flex">
Content Retrieval Handler
<select name="content" class="select select-bordered w-full max-w-xs my-5 text-2xl lg:text-xl">
{% for choice in content_handler_choices %}
<option {% if choice==settings.content_retrieval_handler_key %} selected {% endif %} class="text-2xl lg:text-xl">{{
<option {% if choice==settings.content_retrieval_handler_key %} selected {% endif %}
class="text-2xl lg:text-xl">{{
choice }}</option>
{% endfor %}
</select>
Expand All @@ -91,30 +92,33 @@ <h2 class="text-4xl lg:text-2xl my-5 justify-center flex">
Summarization Handler
<select name="summarization" class="select select-bordered w-full max-w-xs my-5 text-2xl lg:text-xl">
{% for choice in summarization_handler_choices %}
<option {% if choice==settings.summarization_handler_key %} selected {% endif %} class="text-2xl lg:text-xl">
<option {% if choice==settings.summarization_handler_key %} selected {% endif %}
class="text-2xl lg:text-xl">
{{ choice }}
</option>
{% endfor %}
</select>
</label>
</div>
<div>
<button type="submit"
class="btn btn-outline w-1/2 md:w-1/5 mx-auto flex justify-center my-5 text-3xl lg:text-xl">
Update Configuration
{% if update_status %} &#9989 {% endif %}
{% if update_exception %} &#10060 {% endif %}
</button>
{% if update_exception %}
<div role="alert" class="alert alert-error">
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>{{ update_exception }}</span>
<div class=" w-1/2 md:w-1/5 mx-auto flex justify-center my-5">
<div class="tooltip" data-tip="If you changed refresh interval you'll need to restart app to take effect">
<button type="submit"
class="btn btn-outline text-3xl lg:text-xl">
Update
{% if update_status %} &#9989 {% endif %}
{% if update_exception %} &#10060 {% endif %}
</button>
{% if update_exception %}
<div role="alert" class="alert alert-error">
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>{{ update_exception }}</span>
</div>
{% endif %}
</div>
{% endif %}
</div>
</form>
<div>
Expand Down
2 changes: 1 addition & 1 deletion assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7ca7fa2

Please sign in to comment.