mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-29 18:56:36 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96303ded2b | ||
|
|
d06257ec9b | ||
|
|
19ef4833e9 |
@@ -1,3 +1,10 @@
|
|||||||
|
## [](https://github.com/stonith404/pocket-id/compare/v0.28.0...v) (2025-02-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't return error page if version info fetching failed ([d06257e](https://github.com/stonith404/pocket-id/commit/d06257ec9b5e46e25e40c174b4bef02dca0a1ea3))
|
||||||
|
|
||||||
## [](https://github.com/stonith404/pocket-id/compare/v0.27.2...v) (2025-02-03)
|
## [](https://github.com/stonith404/pocket-id/compare/v0.27.2...v) (2025-02-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ With [caddy-security](https://github.com/greenpau/caddy-security) you can easily
|
|||||||
|
|
||||||
#### 1. Create a new OIDC client in Pocket ID.
|
#### 1. Create a new OIDC client in Pocket ID.
|
||||||
|
|
||||||
Create a new OIDC client in Pocket ID by navigating to `https://<your-domain>/settings/admin/oidc-clients`. Now enter `https://<domain-of-proxied-service>/auth/oauth2/generic/authorization-code-callback` as the callback URL. After adding the client, you will obtain the client ID and client secret, which you will need in the next step.
|
Create a new OIDC client in Pocket ID by navigating to `https://<your-domain>/settings/admin/oidc-clients`. Now enter `https://<domain-of-proxied-service>/caddy-security/oauth2/generic/authorization-code-callback` as the callback URL. After adding the client, you will obtain the client ID and client secret, which you will need in the next step.
|
||||||
|
|
||||||
#### 2. Install caddy-security
|
#### 2. Install caddy-security
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ caddy add-package github.com/greenpau/caddy-security
|
|||||||
}
|
}
|
||||||
|
|
||||||
authorization policy mypolicy {
|
authorization policy mypolicy {
|
||||||
set auth url /auth/oauth2/generic
|
set auth url /caddy-security/oauth2/generic
|
||||||
allow roles user
|
allow roles user
|
||||||
inject headers with claims
|
inject headers with claims
|
||||||
}
|
}
|
||||||
@@ -75,8 +75,7 @@ caddy add-package github.com/greenpau/caddy-security
|
|||||||
|
|
||||||
https://<domain-of-your-service> {
|
https://<domain-of-your-service> {
|
||||||
@auth {
|
@auth {
|
||||||
path /auth/oauth2/generic
|
path /caddy-security/*
|
||||||
path /auth/oauth2/generic/authorization-code-callback
|
|
||||||
}
|
}
|
||||||
|
|
||||||
route @auth {
|
route @auth {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pocket-id-frontend",
|
"name": "pocket-id-frontend",
|
||||||
"version": "0.28.0",
|
"version": "0.28.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { version as currentVersion } from '$app/environment';
|
import { version as currentVersion } from '$app/environment';
|
||||||
import type { AllAppConfig, AppConfigRawResponse } from '$lib/types/application-configuration';
|
import type { AllAppConfig, AppConfigRawResponse } from '$lib/types/application-configuration';
|
||||||
import axios from 'axios';
|
import axios, { AxiosError } from 'axios';
|
||||||
import APIService from './api-service';
|
import APIService from './api-service';
|
||||||
|
|
||||||
export default class AppConfigService extends APIService {
|
export default class AppConfigService extends APIService {
|
||||||
@@ -56,12 +56,23 @@ export default class AppConfigService extends APIService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getVersionInformation() {
|
async getVersionInformation() {
|
||||||
const response = (
|
const response = await axios
|
||||||
await axios.get('https://api.github.com/repos/stonith404/pocket-id/releases/latest')
|
.get('https://api.github.com/repos/stonith404/pocket-id/releases/latest')
|
||||||
).data;
|
.then((res) => res.data)
|
||||||
|
.catch((e) => {
|
||||||
|
console.error(
|
||||||
|
'Failed to fetch version information',
|
||||||
|
e instanceof AxiosError && e.response ? e.response.data.message : e
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
const newestVersion = response.tag_name.replace('v', '');
|
let newestVersion: string | null = null;
|
||||||
const isUpToDate = newestVersion === currentVersion;
|
let isUpToDate: boolean | null = null;
|
||||||
|
if (response) {
|
||||||
|
newestVersion = response.tag_name.replace('v', '');
|
||||||
|
isUpToDate = newestVersion === currentVersion;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isUpToDate,
|
isUpToDate,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export type AppConfigRawResponse = {
|
|||||||
}[];
|
}[];
|
||||||
|
|
||||||
export type AppVersionInformation = {
|
export type AppVersionInformation = {
|
||||||
isUpToDate: boolean;
|
isUpToDate: boolean | null;
|
||||||
newestVersion: string;
|
newestVersion: string | null;
|
||||||
currentVersion: string;
|
currentVersion: string
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ export const load: LayoutServerLoad = async () => {
|
|||||||
|
|
||||||
if (!versionInformation || cacheExpired) {
|
if (!versionInformation || cacheExpired) {
|
||||||
versionInformation = await appConfigService.getVersionInformation();
|
versionInformation = await appConfigService.getVersionInformation();
|
||||||
|
if (versionInformation.newestVersion == null) {
|
||||||
|
console.error('Failed to fetch version information. Trying again in 3 hours.');
|
||||||
|
}
|
||||||
versionInformationLastUpdated = Date.now();
|
versionInformationLastUpdated = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
{label}
|
{label}
|
||||||
</a>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
{#if $userStore?.isAdmin && !versionInformation.isUpToDate}
|
{#if $userStore?.isAdmin && versionInformation.isUpToDate === false}
|
||||||
<a
|
<a
|
||||||
href="https://github.com/stonith404/pocket-id/releases/latest"
|
href="https://github.com/stonith404/pocket-id/releases/latest"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|||||||
Reference in New Issue
Block a user