refactor: split public/internal logic

This commit is contained in:
Felipe M 2022-08-15 12:08:59 +02:00
parent a53edf0aa6
commit 69243fce7f
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
8 changed files with 44 additions and 22 deletions

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -36,6 +36,9 @@ func (s *HttpServer) Setup(cfg *config.Config) {
c.Locals("branding_thanks_message", cfg.Branding.ThanksMessage)
c.Locals("branding_footer_extra", cfg.Branding.FooterExtraMessage)
c.Locals("calendar_cache_time", cfg.Routes.Calendar.CacheExpiration.String())
c.Locals("notion_integration_type", cfg.Notion.IntegrationType)
c.Locals("notion_oauth_id", cfg.Notion.OAuthID)
c.Locals("notion_oauth_secret", cfg.Notion.OAuthSecret)
return c.Next()
}).
Use(recover.New()).

View File

@ -0,0 +1,26 @@
<h3>1.</h3>
<p>
Give access to Notion2iCal to your Notion database by using the <kbd>Share</kbd> button
on the top right of your database and searching for <i>Notion2iCal</i>. Only read permissions
are required.
</p>
<p>
<img src="{{ static("/images/usage-internal.png") }}" srcset="{{ static("/images/usage-internal@2x.png") }} 2x" />
</p>
<h3>2.</h3>
<form action="/wizard" method="post">
<p>
<label for="database_url">After giving access, paste your Notion database URL here to setup your calendar.</label>
<input type="url" name="database_url" placeholder="https://notion.so/workspace/...">
</p>
<h3>3.</h3>
{% if error %}
<p><mark>ERROR: {{ error }}</mark></p>
{% endif %}
<button type="submit">Click here to setup your calendar</button>
</form>

View File

@ -0,0 +1,10 @@
<h3>1.</h3>
<p>First, you need to authenticate youself with Notion2iCal, you will authorize the application within your workspace and then you will select to which databases Notion2iCal can read individually.</p>
<p><img src="{{ static("/images/usage-public.png") }}" srcset="{{ static("/images/usage-public@2x.png") }} 2x" /><p>
<form action="https://api.notion.com/v1/oauth/authorize" method="get">
<input type="hidden" name="owner" value="user" />
<input type="hidden" name="response_type" value="code" />
<input type="hidden" name="client_id" value="{{ notion_oauth_id }}" />
<input type="hidden" name="redirect_url" value="http://localhost:8080" />
<button type="submit">Authorize Notion2iCal</button>
</form>

View File

@ -6,27 +6,10 @@
Online tool to convert a Notion database into an iCalendar subscription URL or downloadable ICS file.
</p>
<h2 id="how-it-works">How it works</h2>
<h3>1.</h3>
<p>
Give access to Notion2iCal to your Notion database by using the <kbd>Share</kbd> button
on the top right of your database and searching for <i>Notion2iCal</i>. Only read permissions
are required.
</p>
<p>
<img src="{{ static("/images/usage.png") }}" srcset="{{ static("/images/usage@2x.png") }} 2x" />
</p>
<form action="/wizard" method="post">
<h3>2.</h3>
<p>
<label>After giving access, paste your Notion database URL here to setup your calendar.</label>
<input type="url" name="database_url" placeholder="https://notion.so/workspace/...">
</p>
<h3>3.</h3>
{% if error %}
<p><mark>ERROR: {{ error }}</mark></p>
{% endif %}
<button type="submit">Click here to setup your calendar</button>
</form>
{% if notion_integration_type == "internal" %}
{% include "auth_internal.django" %}
{% else %}
{% include "auth_public.django" %}
{% endif %}
</div>
{% endblock %}