mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Add per-application API Keys
This commit is contained in:
parent
d1afe13a1c
commit
25cc0d2447
35 changed files with 940 additions and 71 deletions
|
@ -7,7 +7,7 @@ var templateCommonMap = map[string]string{
|
|||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .prevEntry }}
|
||||
<a href="{{ .prevEntryRoute }}{{ if .searchQuery }}?q={{ .searchQuery }}{{ end }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "pagination.previous" }}</a>
|
||||
<a href="{{ .prevEntryRoute }}{{ if .searchQuery }}?q={{ .searchQuery }}{{ end }}" title="{{ .prevEntry.Title }}" data-page="previous" rel="prev">{{ t "pagination.previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "pagination.previous" }}
|
||||
{{ end }}
|
||||
|
@ -15,13 +15,14 @@ var templateCommonMap = map[string]string{
|
|||
|
||||
<div class="pagination-next">
|
||||
{{ if .nextEntry }}
|
||||
<a href="{{ .nextEntryRoute }}{{ if .searchQuery }}?q={{ .searchQuery }}{{ end }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "pagination.next" }}</a>
|
||||
<a href="{{ .nextEntryRoute }}{{ if .searchQuery }}?q={{ .searchQuery }}{{ end }}" title="{{ .nextEntry.Title }}" data-page="next" rel="next">{{ t "pagination.next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "pagination.next" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}`,
|
||||
{{ end }}
|
||||
`,
|
||||
"feed_list": `{{ define "feed_list" }}
|
||||
<div class="items">
|
||||
{{ range .feeds }}
|
||||
|
@ -311,7 +312,7 @@ var templateCommonMap = map[string]string{
|
|||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .ShowPrev }}
|
||||
<a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ if .SearchQuery }}&q={{ .SearchQuery }}{{ end }}{{ else }}{{ if .SearchQuery }}?q={{ .SearchQuery }}{{ end }}{{ end }}" data-page="previous">{{ t "pagination.previous" }}</a>
|
||||
<a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ if .SearchQuery }}&q={{ .SearchQuery }}{{ end }}{{ else }}{{ if .SearchQuery }}?q={{ .SearchQuery }}{{ end }}{{ end }}" data-page="previous" rel="prev">{{ t "pagination.previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "pagination.previous" }}
|
||||
{{ end }}
|
||||
|
@ -319,7 +320,7 @@ var templateCommonMap = map[string]string{
|
|||
|
||||
<div class="pagination-next">
|
||||
{{ if .ShowNext }}
|
||||
<a href="{{ .Route }}?offset={{ .NextOffset }}{{ if .SearchQuery }}&q={{ .SearchQuery }}{{ end }}" data-page="next">{{ t "pagination.next" }}</a>
|
||||
<a href="{{ .Route }}?offset={{ .NextOffset }}{{ if .SearchQuery }}&q={{ .SearchQuery }}{{ end }}" data-page="next" rel="next">{{ t "pagination.next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "pagination.next" }}
|
||||
{{ end }}
|
||||
|
@ -335,6 +336,9 @@ var templateCommonMap = map[string]string{
|
|||
<li>
|
||||
<a href="{{ route "integrations" }}">{{ t "menu.integrations" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "apiKeys" }}">{{ t "menu.api_keys" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "menu.sessions" }}</a>
|
||||
</li>
|
||||
|
@ -342,9 +346,6 @@ var templateCommonMap = map[string]string{
|
|||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "menu.users" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "menu.add_user" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li>
|
||||
<a href="{{ route "about" }}">{{ t "menu.about" }}</a>
|
||||
|
@ -354,11 +355,11 @@ var templateCommonMap = map[string]string{
|
|||
}
|
||||
|
||||
var templateCommonMapChecksums = map[string]string{
|
||||
"entry_pagination": "4faa91e2eae150c5e4eab4d258e039dfdd413bab7602f0009360e6d52898e353",
|
||||
"entry_pagination": "cdca9cf12586e41e5355190b06d9168f57f77b85924d1e63b13524bc15abcbf6",
|
||||
"feed_list": "db406e7cb81292ce1d974d63f63270384a286848b2e74fe36bf711b4eb5717dd",
|
||||
"feed_menu": "318d8662dda5ca9dfc75b909c8461e79c86fb5082df1428f67aaf856f19f4b50",
|
||||
"item_meta": "d046305e8935ecd8643a94d28af384df29e40fc7ce334123cd057a6522bac23f",
|
||||
"layout": "a1f67b8908745ee4f9cee6f7bbbb0b242d4dcc101207ad4a9d67242b45683299",
|
||||
"pagination": "3386e90c6e1230311459e9a484629bc5d5bf39514a75ef2e73bbbc61142f7abb",
|
||||
"settings_menu": "78e5a487ede18610b23db74184dab023170f9e083cc0625bc2c874d1eea1a4ce",
|
||||
"pagination": "7b61288e86283c4cf0dc83bcbf8bf1c00c7cb29e60201c8c0b633b2450d2911f",
|
||||
"settings_menu": "e2b777630c0efdbc529800303c01d6744ed3af80ec505ac5a5b3f99c9b989156",
|
||||
}
|
||||
|
|
72
template/html/api_keys.html
Normal file
72
template/html/api_keys.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
{{ define "title"}}{{ t "page.api_keys.title" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "page.api_keys.title" }}</h1>
|
||||
{{ template "settings_menu" dict "user" .user }}
|
||||
</section>
|
||||
|
||||
{{ if .apiKeys }}
|
||||
{{ range .apiKeys }}
|
||||
<table>
|
||||
<tr>
|
||||
<th class="column-25">{{ t "page.api_keys.table.description" }}</th>
|
||||
<td>{{ .Description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.token" }}</th>
|
||||
<td>{{ .Token }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.last_used_at" }}</th>
|
||||
<td>
|
||||
{{ if .LastUsedAt }}
|
||||
<time datetime="{{ isodate .LastUsedAt }}" title="{{ isodate .LastUsedAt }}">{{ elapsed $.user.Timezone .LastUsedAt }}</time>
|
||||
{{ else }}
|
||||
{{ t "page.api_keys.never_used" }}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.created_at" }}</th>
|
||||
<td>
|
||||
<time datetime="{{ isodate .CreatedAt }}" title="{{ isodate .CreatedAt }}">{{ elapsed $.user.Timezone .CreatedAt }}</time>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.actions" }}</th>
|
||||
<td>
|
||||
<a href="#"
|
||||
data-confirm="true"
|
||||
data-label-question="{{ t "confirm.question" }}"
|
||||
data-label-yes="{{ t "confirm.yes" }}"
|
||||
data-label-no="{{ t "confirm.no" }}"
|
||||
data-label-loading="{{ t "confirm.loading" }}"
|
||||
data-url="{{ route "removeAPIKey" "keyID" .ID }}">{{ t "action.remove" }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<h3>{{ t "page.integration.miniflux_api" }}</h3>
|
||||
<div class="panel">
|
||||
<ul>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_endpoint" }} = <strong>{{ baseURL }}/v1/</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_username" }} = <strong>{{ .user.Username }}</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_password" }} = <strong>{{ t "page.integration.miniflux_api_password_value" }}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<a href="{{ route "createAPIKey" }}" class="button button-primary">{{ t "menu.create_api_key" }}</a>
|
||||
</p>
|
||||
|
||||
{{ end }}
|
|
@ -6,6 +6,9 @@
|
|||
<li>
|
||||
<a href="{{ route "integrations" }}">{{ t "menu.integrations" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "apiKeys" }}">{{ t "menu.api_keys" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "menu.sessions" }}</a>
|
||||
</li>
|
||||
|
@ -13,9 +16,6 @@
|
|||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "menu.users" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "menu.add_user" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li>
|
||||
<a href="{{ route "about" }}">{{ t "menu.about" }}</a>
|
||||
|
|
23
template/html/create_api_key.html
Normal file
23
template/html/create_api_key.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{ define "title"}}{{ t "page.new_api_key.title" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "page.new_api_key.title" }}</h1>
|
||||
{{ template "settings_menu" dict "user" .user }}
|
||||
</section>
|
||||
|
||||
<form action="{{ route "saveAPIKey" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-description">{{ t "form.api_key.label.description" }}</label>
|
||||
<input type="text" name="description" id="form-description" value="{{ .form.Description }}" required autofocus>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.save" }}</button> {{ t "action.or" }} <a href="{{ route "apiKeys" }}">{{ t "action.cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
|
@ -117,21 +117,6 @@
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<h3>{{ t "page.integration.miniflux_api" }}</h3>
|
||||
<div class="panel">
|
||||
<ul>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_endpoint" }} = <strong>{{ baseURL }}/v1/</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_username" }} = <strong>{{ .user.Username }}</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_password" }} = <strong>{{ t "page.integration.miniflux_api_password_value" }}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h3>{{ t "page.integration.bookmarklet" }}</h3>
|
||||
<div class="panel">
|
||||
<p>{{ t "page.integration.bookmarklet.help" }}</p>
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
</table>
|
||||
<br>
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
<a href="{{ route "createUser" }}" class="button button-primary">{{ t "menu.add_user" }}</a>
|
||||
</p>
|
||||
|
||||
{{ end }}
|
||||
|
|
|
@ -92,6 +92,79 @@ var templateViewsMap = map[string]string{
|
|||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"api_keys": `{{ define "title"}}{{ t "page.api_keys.title" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "page.api_keys.title" }}</h1>
|
||||
{{ template "settings_menu" dict "user" .user }}
|
||||
</section>
|
||||
|
||||
{{ if .apiKeys }}
|
||||
{{ range .apiKeys }}
|
||||
<table>
|
||||
<tr>
|
||||
<th class="column-25">{{ t "page.api_keys.table.description" }}</th>
|
||||
<td>{{ .Description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.token" }}</th>
|
||||
<td>{{ .Token }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.last_used_at" }}</th>
|
||||
<td>
|
||||
{{ if .LastUsedAt }}
|
||||
<time datetime="{{ isodate .LastUsedAt }}" title="{{ isodate .LastUsedAt }}">{{ elapsed $.user.Timezone .LastUsedAt }}</time>
|
||||
{{ else }}
|
||||
{{ t "page.api_keys.never_used" }}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.created_at" }}</th>
|
||||
<td>
|
||||
<time datetime="{{ isodate .CreatedAt }}" title="{{ isodate .CreatedAt }}">{{ elapsed $.user.Timezone .CreatedAt }}</time>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ t "page.api_keys.table.actions" }}</th>
|
||||
<td>
|
||||
<a href="#"
|
||||
data-confirm="true"
|
||||
data-label-question="{{ t "confirm.question" }}"
|
||||
data-label-yes="{{ t "confirm.yes" }}"
|
||||
data-label-no="{{ t "confirm.no" }}"
|
||||
data-label-loading="{{ t "confirm.loading" }}"
|
||||
data-url="{{ route "removeAPIKey" "keyID" .ID }}">{{ t "action.remove" }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<h3>{{ t "page.integration.miniflux_api" }}</h3>
|
||||
<div class="panel">
|
||||
<ul>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_endpoint" }} = <strong>{{ baseURL }}/v1/</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_username" }} = <strong>{{ .user.Username }}</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_password" }} = <strong>{{ t "page.integration.miniflux_api_password_value" }}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<a href="{{ route "createAPIKey" }}" class="button button-primary">{{ t "menu.create_api_key" }}</a>
|
||||
</p>
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"bookmark_entries": `{{ define "title"}}{{ t "page.starred.title" }} ({{ .total }}){{ end }}
|
||||
|
@ -317,6 +390,30 @@ var templateViewsMap = map[string]string{
|
|||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"create_api_key": `{{ define "title"}}{{ t "page.new_api_key.title" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "page.new_api_key.title" }}</h1>
|
||||
{{ template "settings_menu" dict "user" .user }}
|
||||
</section>
|
||||
|
||||
<form action="{{ route "saveAPIKey" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-description">{{ t "form.api_key.label.description" }}</label>
|
||||
<input type="text" name="description" id="form-description" value="{{ .form.Description }}" required autofocus>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.save" }}</button> {{ t "action.or" }} <a href="{{ route "apiKeys" }}">{{ t "action.cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"create_category": `{{ define "title"}}{{ t "page.new_category.title" }}{{ end }}
|
||||
|
||||
|
@ -992,21 +1089,6 @@ var templateViewsMap = map[string]string{
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<h3>{{ t "page.integration.miniflux_api" }}</h3>
|
||||
<div class="panel">
|
||||
<ul>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_endpoint" }} = <strong>{{ baseURL }}/v1/</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_username" }} = <strong>{{ .user.Username }}</strong>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "page.integration.miniflux_api_password" }} = <strong>{{ t "page.integration.miniflux_api_password_value" }}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h3>{{ t "page.integration.bookmarklet" }}</h3>
|
||||
<div class="panel">
|
||||
<p>{{ t "page.integration.bookmarklet.help" }}</p>
|
||||
|
@ -1302,8 +1384,13 @@ var templateViewsMap = map[string]string{
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
</table>
|
||||
<br>
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
<a href="{{ route "createUser" }}" class="button button-primary">{{ t "menu.add_user" }}</a>
|
||||
</p>
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
}
|
||||
|
@ -1311,11 +1398,13 @@ var templateViewsMap = map[string]string{
|
|||
var templateViewsMapChecksums = map[string]string{
|
||||
"about": "4035658497363d7af7f79be83190404eb21ec633fe8ec636bdfc219d9fc78cfc",
|
||||
"add_subscription": "0dbea93b6fc07423fa066122ad960c69616b829533371a2dbadec1e22d4f1ae0",
|
||||
"api_keys": "27d401b31a72881d5232486ba17eb47edaf5246eaedce81de88698c15ebb2284",
|
||||
"bookmark_entries": "65588da78665699dd3f287f68325e9777d511f1a57fee4131a5bb6d00bb68df8",
|
||||
"categories": "2c5dd0ed6355bd5acc393bbf6117d20458b5581aab82036008324f6bbbe2af75",
|
||||
"category_entries": "dee7b9cd60c6c46f01dd4289940679df31c1fce28ce4aa7249fa459023e1eeb4",
|
||||
"category_feeds": "527c2ffbc4fcec775071424ba1022ae003525dba53a28cc41f48fb7b30aa984b",
|
||||
"choose_subscription": "84c9730cadd78e6ee5a6b4c499aab33acddb4324ac01924d33387543eec4d702",
|
||||
"create_api_key": "5f74d4e92a6684927f5305096378c8be278159a5cd88ce652c7be3280a7d1685",
|
||||
"create_category": "6b22b5ce51abf4e225e23a79f81be09a7fb90acb265e93a8faf9446dff74018d",
|
||||
"create_user": "9b73a55233615e461d1f07d99ad1d4d3b54532588ab960097ba3e090c85aaf3a",
|
||||
"edit_category": "b1c0b38f1b714c5d884edcd61e5b5295a5f1c8b71c469b35391e4dcc97cc6d36",
|
||||
|
@ -1326,11 +1415,11 @@ var templateViewsMapChecksums = map[string]string{
|
|||
"feeds": "ec7d3fa96735bd8422ba69ef0927dcccddc1cc51327e0271f0312d3f881c64fd",
|
||||
"history_entries": "87e17d39de70eb3fdbc4000326283be610928758eae7924e4b08dcb446f3b6a9",
|
||||
"import": "1b59b3bd55c59fcbc6fbb346b414dcdd26d1b4e0c307e437bb58b3f92ef01ad1",
|
||||
"integrations": "6104ff6ff3ac3c1ae5e850c78250aab6e99e2342a337589f3848459fa333766a",
|
||||
"integrations": "30329452743b35c668278f519245fd9be05c1726856e0384ba542f7c307f2788",
|
||||
"login": "0657174d13229bb6d0bc470ccda06bb1f15c1af65c86b20b41ffa5c819eef0cc",
|
||||
"search_entries": "274950d03298c24f3942e209c0faed580a6d57be9cf76a6c236175a7e766ac6a",
|
||||
"sessions": "5d5c677bddbd027e0b0c9f7a0dd95b66d9d95b4e130959f31fb955b926c2201c",
|
||||
"settings": "56f7c06f24eef317353582b0191aa9a5985f46ed755accf97e723ceb4bba4469",
|
||||
"unread_entries": "e38f7ffce17dfad3151b08cd33771a2cefe8ca9db42df04fc98bd1d675dd6075",
|
||||
"users": "17d0b7c760557e20f888d83d6a1b0d4506dab071a593cc42080ec0dbf16adf9e",
|
||||
"users": "d7ff52efc582bbad10504f4a04fa3adcc12d15890e45dff51cac281e0c446e45",
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue