Compare commits
116 Commits
feat/pwa-b
...
v1.33.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd4204f0f5 | ||
|
|
8a5943f206 | ||
|
|
f32a9c20ef | ||
|
|
2dc0009675 | ||
|
|
3ad7faaf9b | ||
|
|
400639a94e | ||
|
|
ef3d428076 | ||
|
|
2c76b17919 | ||
|
|
e98d93db1a | ||
|
|
ba84a32c0d | ||
|
|
fe5e7cbf4b | ||
|
|
45ce57687a | ||
|
|
4b43747bcc | ||
|
|
714f244d6a | ||
|
|
acfaf7eb45 | ||
|
|
b83d8c8f5c | ||
|
|
dd5d2698a6 | ||
|
|
c5e59616fa | ||
|
|
fc79fdabf4 | ||
|
|
7dd683c3d8 | ||
|
|
4a5421a9ba | ||
|
|
24b9c00b2a | ||
|
|
5125abdbf0 | ||
|
|
724f8bb538 | ||
|
|
512f6e51e4 | ||
|
|
1b36dded3f | ||
|
|
77511bf199 | ||
|
|
26d77af3a4 | ||
|
|
2b111f1c34 | ||
|
|
a6392cb2db | ||
|
|
6d55b50e5e | ||
|
|
f7dc6256ba | ||
|
|
f1df1caea5 | ||
|
|
d23c120dc0 | ||
|
|
353efa39d0 | ||
|
|
21cdf7d113 | ||
|
|
f858f025fe | ||
|
|
c92bb134d4 | ||
|
|
7e0e2a92e3 | ||
|
|
e840489e57 | ||
|
|
800f4668ec | ||
|
|
f2c37babeb | ||
|
|
24095eac03 | ||
|
|
8c782e0c93 | ||
|
|
08ce7f24b8 | ||
|
|
67e794aca4 | ||
|
|
c9c429d027 | ||
|
|
31ac11f4eb | ||
|
|
f072a4e11d | ||
|
|
b24c23e549 | ||
|
|
e602e9f758 | ||
|
|
afd46ebee8 | ||
|
|
be47d1e56c | ||
|
|
0e612f01f1 | ||
|
|
cd9d9ae8d2 | ||
|
|
ea2765f8c7 | ||
|
|
448e7c3a7d | ||
|
|
6ab3cd77a7 | ||
|
|
3dfbb0e0a5 | ||
|
|
726f62b9b6 | ||
|
|
81c30347f6 | ||
|
|
a397893217 | ||
|
|
12c5bbd778 | ||
|
|
06261c1118 | ||
|
|
686fe6fdf8 | ||
|
|
c80a1fa261 | ||
|
|
6167011ee5 | ||
|
|
bc399d95a0 | ||
|
|
519dd17d37 | ||
|
|
0761593411 | ||
|
|
caa45415b1 | ||
|
|
ed297d9d6c | ||
|
|
c6486c3643 | ||
|
|
f9695068a8 | ||
|
|
fd90adba4d | ||
|
|
970aa612fe | ||
|
|
71169944dc | ||
|
|
d77f9eb44e | ||
|
|
22f2037ea6 | ||
|
|
2cdf755c20 | ||
|
|
f99ab47c01 | ||
|
|
7e4175ff21 | ||
|
|
4157432aa7 | ||
|
|
741b2c4e9f | ||
|
|
6dbe9ea814 | ||
|
|
96328ab5c6 | ||
|
|
c31709681a | ||
|
|
0a3d7c5915 | ||
|
|
912c63e562 | ||
|
|
077513151e | ||
|
|
191f39e8bd | ||
|
|
048b6c1d90 | ||
|
|
a6a065ac0b | ||
|
|
abb0b2d763 | ||
|
|
d2668d3f49 | ||
|
|
bee6eb288f | ||
|
|
3473aed27e | ||
|
|
a9144a2167 | ||
|
|
59822d6e42 | ||
|
|
0bd1bee1fa | ||
|
|
46326f9d16 | ||
|
|
54b96cc451 | ||
|
|
7d2a187865 | ||
|
|
17df5dd072 | ||
|
|
4b48a36ad3 | ||
|
|
16bd3e9fd5 | ||
|
|
6360c82898 | ||
|
|
f1df9eeb2f | ||
|
|
a3973791fb | ||
|
|
157ab80be1 | ||
|
|
ac0f95b773 | ||
|
|
45ebfb937e | ||
|
|
85325cda7f | ||
|
|
5fc02d0d94 | ||
|
|
16902f85fb | ||
|
|
17b5a0bf9c |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -9,6 +9,8 @@ jobs:
|
||||
semantic-release:
|
||||
name: Tag and release latest version
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
HUSKY: 0
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
1520
CHANGELOG.md
Normal file
1520
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "overseerr",
|
||||
"version": "0.1.0",
|
||||
"version": "1.33.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts",
|
||||
|
||||
21
public/sw.js
21
public/sw.js
@@ -109,25 +109,6 @@ self.addEventListener('push', (event) => {
|
||||
);
|
||||
}
|
||||
|
||||
//Set the badge with the amount of pending requests
|
||||
//Only update the badge if the payload confirms they are the admin
|
||||
if (
|
||||
(payload.notificationType === 'MEDIA_APPROVED' ||
|
||||
payload.notificationType === 'MEDIA_DECLINED') &&
|
||||
payload.isAdmin
|
||||
) {
|
||||
if ('setAppBadge' in navigator) {
|
||||
navigator.setAppBadge(payload.pendingRequestsCount);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (payload.notificationType === 'MEDIA_PENDING') {
|
||||
if ('setAppBadge' in navigator) {
|
||||
navigator.setAppBadge(payload.pendingRequestsCount);
|
||||
}
|
||||
}
|
||||
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(payload.subject, options)
|
||||
);
|
||||
@@ -147,7 +128,7 @@ self.addEventListener('notificationclick', (event) => {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (notificationData.actionUrl) {
|
||||
clients.openWindow(notificationData.actionUrl);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,6 @@ export interface NotificationPayload {
|
||||
request?: MediaRequest;
|
||||
issue?: Issue;
|
||||
comment?: IssueComment;
|
||||
pendingRequestsCount?: number;
|
||||
isAdmin?: boolean;
|
||||
}
|
||||
|
||||
export abstract class BaseAgent<T extends NotificationAgentConfig> {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { IssueType, IssueTypeName } from '@server/constants/issue';
|
||||
import { MediaRequestStatus, MediaType } from '@server/constants/media';
|
||||
import { MediaType } from '@server/constants/media';
|
||||
import { getRepository } from '@server/datasource';
|
||||
import MediaRequest from '@server/entity/MediaRequest';
|
||||
import { User } from '@server/entity/User';
|
||||
import { UserPushSubscription } from '@server/entity/UserPushSubscription';
|
||||
import type { NotificationAgentConfig } from '@server/lib/settings';
|
||||
@@ -20,8 +19,6 @@ interface PushNotificationPayload {
|
||||
actionUrl?: string;
|
||||
actionUrlTitle?: string;
|
||||
requestId?: number;
|
||||
pendingRequestsCount?: number;
|
||||
isAdmin?: boolean;
|
||||
}
|
||||
|
||||
class WebPushAgent
|
||||
@@ -132,8 +129,6 @@ class WebPushAgent
|
||||
requestId: payload.request?.id,
|
||||
actionUrl,
|
||||
actionUrlTitle,
|
||||
pendingRequestsCount: payload.pendingRequestsCount,
|
||||
isAdmin: payload.isAdmin,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -157,51 +152,6 @@ class WebPushAgent
|
||||
|
||||
const mainUser = await userRepository.findOne({ where: { id: 1 } });
|
||||
|
||||
const requestRepository = getRepository(MediaRequest);
|
||||
|
||||
const pendingRequests = await requestRepository.find({
|
||||
where: { status: MediaRequestStatus.PENDING },
|
||||
});
|
||||
|
||||
const webPushNotification = async (
|
||||
pushSub: UserPushSubscription,
|
||||
notificationPayload: Buffer
|
||||
) => {
|
||||
logger.debug('Sending web push notification', {
|
||||
label: 'Notifications',
|
||||
recipient: pushSub.user.displayName,
|
||||
type: Notification[type],
|
||||
subject: payload.subject,
|
||||
});
|
||||
|
||||
try {
|
||||
await webpush.sendNotification(
|
||||
{
|
||||
endpoint: pushSub.endpoint,
|
||||
keys: {
|
||||
auth: pushSub.auth,
|
||||
p256dh: pushSub.p256dh,
|
||||
},
|
||||
},
|
||||
notificationPayload
|
||||
);
|
||||
} catch (e) {
|
||||
logger.error(
|
||||
'Error sending web push notification; removing subscription',
|
||||
{
|
||||
label: 'Notifications',
|
||||
recipient: pushSub.user.displayName,
|
||||
type: Notification[type],
|
||||
subject: payload.subject,
|
||||
errorMessage: e.message,
|
||||
}
|
||||
);
|
||||
|
||||
// Failed to send notification so we need to remove the subscription
|
||||
userPushSubRepository.remove(pushSub);
|
||||
}
|
||||
};
|
||||
|
||||
if (
|
||||
payload.notifyUser &&
|
||||
// Check if user has webpush notifications enabled and fallback to true if undefined
|
||||
@@ -219,11 +169,7 @@ class WebPushAgent
|
||||
pushSubs.push(...notifySubs);
|
||||
}
|
||||
|
||||
if (
|
||||
payload.notifyAdmin ||
|
||||
type === Notification.MEDIA_APPROVED ||
|
||||
type === Notification.MEDIA_DECLINED
|
||||
) {
|
||||
if (payload.notifyAdmin) {
|
||||
const users = await userRepository.find();
|
||||
|
||||
const manageUsers = users.filter(
|
||||
@@ -246,42 +192,7 @@ class WebPushAgent
|
||||
})
|
||||
.getMany();
|
||||
|
||||
//We only want to send the custom notification when type is approved or declined
|
||||
//Otherwise, default to the normal notification
|
||||
if (
|
||||
type === Notification.MEDIA_APPROVED ||
|
||||
type === Notification.MEDIA_DECLINED
|
||||
) {
|
||||
if (mainUser && allSubs.length > 0) {
|
||||
webpush.setVapidDetails(
|
||||
`mailto:${mainUser.email}`,
|
||||
settings.vapidPublic,
|
||||
settings.vapidPrivate
|
||||
);
|
||||
|
||||
//Custom payload only for updating the app badge
|
||||
const notificationBadgePayload = Buffer.from(
|
||||
JSON.stringify(
|
||||
this.getNotificationPayload(type, {
|
||||
subject: payload.subject,
|
||||
notifySystem: false,
|
||||
notifyAdmin: true,
|
||||
isAdmin: true,
|
||||
pendingRequestsCount: pendingRequests.length,
|
||||
})
|
||||
),
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
allSubs.map(async (sub) => {
|
||||
webPushNotification(sub, notificationBadgePayload);
|
||||
})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
pushSubs.push(...allSubs);
|
||||
}
|
||||
pushSubs.push(...allSubs);
|
||||
}
|
||||
|
||||
if (mainUser && pushSubs.length > 0) {
|
||||
@@ -291,10 +202,6 @@ class WebPushAgent
|
||||
settings.vapidPrivate
|
||||
);
|
||||
|
||||
if (type === Notification.MEDIA_PENDING) {
|
||||
payload = { ...payload, pendingRequestsCount: pendingRequests.length };
|
||||
}
|
||||
|
||||
const notificationPayload = Buffer.from(
|
||||
JSON.stringify(this.getNotificationPayload(type, payload)),
|
||||
'utf-8'
|
||||
@@ -302,7 +209,39 @@ class WebPushAgent
|
||||
|
||||
await Promise.all(
|
||||
pushSubs.map(async (sub) => {
|
||||
webPushNotification(sub, notificationPayload);
|
||||
logger.debug('Sending web push notification', {
|
||||
label: 'Notifications',
|
||||
recipient: sub.user.displayName,
|
||||
type: Notification[type],
|
||||
subject: payload.subject,
|
||||
});
|
||||
|
||||
try {
|
||||
await webpush.sendNotification(
|
||||
{
|
||||
endpoint: sub.endpoint,
|
||||
keys: {
|
||||
auth: sub.auth,
|
||||
p256dh: sub.p256dh,
|
||||
},
|
||||
},
|
||||
notificationPayload
|
||||
);
|
||||
} catch (e) {
|
||||
logger.error(
|
||||
'Error sending web push notification; removing subscription',
|
||||
{
|
||||
label: 'Notifications',
|
||||
recipient: sub.user.displayName,
|
||||
type: Notification[type],
|
||||
subject: payload.subject,
|
||||
errorMessage: e.message,
|
||||
}
|
||||
);
|
||||
|
||||
// Failed to send notification so we need to remove the subscription
|
||||
userPushSubRepository.remove(sub);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import { LanguageContext } from '@app/context/LanguageContext';
|
||||
import { SettingsProvider } from '@app/context/SettingsContext';
|
||||
import { UserContext } from '@app/context/UserContext';
|
||||
import type { User } from '@app/hooks/useUser';
|
||||
import { Permission, useUser } from '@app/hooks/useUser';
|
||||
import '@app/styles/globals.css';
|
||||
import { polyfillIntl } from '@app/utils/polyfillIntl';
|
||||
import type { PublicSettingsResponse } from '@server/interfaces/api/settingsInterfaces';
|
||||
@@ -114,30 +113,6 @@ const CoreApp: Omit<NextAppComponentType, 'origGetInitialProps'> = ({
|
||||
loadLocaleData(currentLocale).then(setMessages);
|
||||
}, [currentLocale]);
|
||||
|
||||
const { hasPermission } = useUser();
|
||||
|
||||
useEffect(() => {
|
||||
const requestsCount = async () => {
|
||||
const response = await axios.get('/api/v1/request/count');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
//Set navigator to new variable with any type to prevent setAppBadge unknown error since it does actually exist on navigator
|
||||
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const newNavigator: any = navigator;
|
||||
|
||||
if ('setAppBadge' in navigator) {
|
||||
if (
|
||||
!router.pathname.match(/(login|setup|resetpassword)/) &&
|
||||
hasPermission(Permission.ADMIN)
|
||||
) {
|
||||
requestsCount().then((data) => newNavigator.setAppBadge(data.pending));
|
||||
} else {
|
||||
newNavigator.clearAppBadge();
|
||||
}
|
||||
}
|
||||
}, [hasPermission, router.pathname]);
|
||||
|
||||
if (router.pathname.match(/(login|setup|resetpassword)/)) {
|
||||
component = <Component {...pageProps} />;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user