Skip to content

Commit c5c573b

Browse files
committed
feat: Ask for donations
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 77c7124 commit c5c573b

4 files changed

Lines changed: 104 additions & 1 deletion

File tree

lib/Service/UserSettingsService.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@
1515

1616
class UserSettingsService {
1717

18-
public const KEYS = ['hasSeenWhatsnew', 'viewMode', 'archive.enabled', 'archive.filePath', 'backup.enabled', 'backup.filePath', 'sorting', 'contextchat.enabled'];
18+
public const KEYS = [
19+
'hasSeenWhatsnew',
20+
'hasSeenSupportThisProject',
21+
'viewMode',
22+
'archive.enabled',
23+
'archive.filePath',
24+
'backup.enabled',
25+
'backup.filePath',
26+
'sorting',
27+
'contextchat.enabled'
28+
];
1929

2030
public function __construct(
2131
private ?string $userId,
@@ -42,6 +52,9 @@ public function get(string $key): string {
4252
if ($key === 'hasSeenWhatsnew') {
4353
$default = '0';
4454
}
55+
if ($key === 'hasSeenSupportThisProject') {
56+
$default = '0';
57+
}
4558
if ($key === 'viewMode') {
4659
$default = 'grid';
4760
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--
2+
- Copyright (c) 2026 Marcel Klehr <mklehr@gmx.net>
3+
-
4+
- This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
5+
-->
6+
7+
<template>
8+
<NcModal v-if="showModal"
9+
:name="t('bookmarks', `Support this project`)"
10+
@close="onClose">
11+
<div class="supportthisproject">
12+
<h3>💙 {{ t('bookmarks', 'Would you like to support this project?') }}</h3>
13+
<p>
14+
{{
15+
t(
16+
'bookmarks',
17+
"Hi! I'm Marcel, the developer of this free and open source bookmarks app. My work on this app is fuelled by a voluntary subscription model. If you think what I do is worthwhile, I would be happy if you could support my work with a one-time or recurring donation. Also, please consider giving the app a review on the Nextcloud app store. Thank you 💙 "
18+
)
19+
}}
20+
</p>
21+
<p>&nbsp;</p>
22+
<p>
23+
<a href="https://github.com/sponsors/marcelklehr">GitHub Sponsors</a>, <a href="https://www.patreon.com/marcelklehr">Patreon</a>,
24+
<a href="https://liberapay.com/marcelklehr/donate">Liberapay</a>, <a href="https://ko-fi.com/marcelklehr">Ko-Fi</a>,
25+
<a href="https://www.paypal.com/donate/?hosted_button_id=VESJWWBEZ9V6J">PayPal</a>
26+
</p>
27+
<p>
28+
<a href="https://apps.nextcloud.com/apps/bookmarks">{{
29+
t('bookmarks', 'Leave a rating on the Nextcloud App Store')
30+
}}</a>
31+
</p>
32+
</div>
33+
</NcModal>
34+
</template>
35+
<script>
36+
import { NcModal } from '@nextcloud/vue'
37+
import { actions } from '../store/index.js'
38+
39+
const ENABLED = true
40+
41+
export default {
42+
name: 'SupportThisProjectModal',
43+
components: {
44+
NcModal,
45+
},
46+
computed: {
47+
showModal() {
48+
return (
49+
ENABLED
50+
&& this.$store.state.settings.hasSeenSupportThisProject !== '0'
51+
&& parseInt(this.$store.state.settings.hasSeenSupportThisProject)
52+
< Date.now() - 1000 * 60 * 60 * 24 * 30 * 6
53+
)
54+
},
55+
},
56+
methods: {
57+
onClose() {
58+
this.$store.dispatch(actions.SET_SETTING, {
59+
key: 'hasSeenSupportThisProject',
60+
value: Date.now(),
61+
})
62+
},
63+
},
64+
}
65+
</script>
66+
<style>
67+
.supportthisproject {
68+
min-width: 300px;
69+
overflow-y: scroll;
70+
padding: 30px;
71+
}
72+
73+
.supportthisproject li {
74+
font-size: 1.2em;
75+
margin-bottom: 15px;
76+
}
77+
78+
.supportthisproject h3 {
79+
font-size: 2em;
80+
margin-bottom: 25px;
81+
}
82+
83+
.supportthisproject a {
84+
text-decoration: underline;
85+
}
86+
</style>

src/components/ViewPrivate.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<LoadingModal />
2424
<BookmarkContent />
2525
<WhatsnewModal />
26+
<SupportThisProjectModal />
2627
</NcContent>
2728
</template>
2829

@@ -41,6 +42,7 @@ import { actions, mutations } from '../store/index.js'
4142
import LoadingModal from './LoadingModal.vue'
4243
import BookmarkContent from './BookmarkContent.vue'
4344
import WhatsnewModal from './WhatsnewModal.vue'
45+
import SupportThisProjectModal from './SupportThisProjectModal.vue'
4446
import { getCurrentUser } from '@nextcloud/auth'
4547
4648
export default {
@@ -59,6 +61,7 @@ export default {
5961
MoveDialog,
6062
CopyDialog,
6163
WhatsnewModal,
64+
SupportThisProjectModal,
6265
},
6366
data() {
6467
return {

src/store/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default {
5353
backupPath: '',
5454
backupEnabled: '1',
5555
hasSeenWhatsnew: '',
56+
hasSeenSupportThisProject: 0,
5657
shareapi_allow_links: true,
5758
},
5859
bookmarks: [],

0 commit comments

Comments
 (0)