feeds-fun 1.14.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -24,30 +24,44 @@
|
|
|
24
24
|
|
|
25
25
|
<div v-else-if="foundFeeds === null"></div>
|
|
26
26
|
|
|
27
|
-
<
|
|
27
|
+
<div
|
|
28
28
|
v-else-if="foundFeeds.length === 0"
|
|
29
|
-
class="ffun-info-attention"
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
class="ffun-info-attention">
|
|
30
|
+
<p
|
|
31
|
+
class="ffun-info-error"
|
|
32
|
+
v-for="message in messages">
|
|
33
|
+
{{ message.message }}
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<p v-if="messages.length === 0"> No feeds found. </p>
|
|
37
|
+
</div>
|
|
32
38
|
|
|
33
39
|
<div
|
|
34
40
|
v-for="feed in foundFeeds"
|
|
35
41
|
:key="feed.url">
|
|
36
42
|
<feed-info :feed="feed" />
|
|
37
43
|
|
|
38
|
-
<button
|
|
39
|
-
class="ffun-form-button"
|
|
40
|
-
v-if="!addedFeeds[feed.url]"
|
|
41
|
-
:disabled="disableInputs"
|
|
42
|
-
@click.prevent="addFeed(feed.url)">
|
|
43
|
-
Add
|
|
44
|
-
</button>
|
|
45
|
-
|
|
46
44
|
<p
|
|
47
|
-
v-
|
|
48
|
-
class="ffun-info-good"
|
|
49
|
-
|
|
50
|
-
>
|
|
45
|
+
v-if="feed.isLinked"
|
|
46
|
+
class="ffun-info-good">
|
|
47
|
+
You are already subscribed to this feed.
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
<template v-else>
|
|
51
|
+
<button
|
|
52
|
+
class="ffun-form-button"
|
|
53
|
+
v-if="!addedFeeds[feed.url]"
|
|
54
|
+
:disabled="disableInputs"
|
|
55
|
+
@click.prevent="addFeed(feed.url)">
|
|
56
|
+
Add
|
|
57
|
+
</button>
|
|
58
|
+
|
|
59
|
+
<p
|
|
60
|
+
v-else
|
|
61
|
+
class="ffun-info-good"
|
|
62
|
+
>Feed added</p
|
|
63
|
+
>
|
|
64
|
+
</template>
|
|
51
65
|
</div>
|
|
52
66
|
</div>
|
|
53
67
|
</template>
|
|
@@ -74,17 +88,22 @@
|
|
|
74
88
|
|
|
75
89
|
const addedFeeds = ref<{[key: string]: boolean}>({});
|
|
76
90
|
|
|
91
|
+
let messages = ref<t.ApiMessage[]>([]);
|
|
92
|
+
|
|
77
93
|
const foundFeeds = computedAsync(async () => {
|
|
78
94
|
if (searhedUrl.value === "") {
|
|
79
95
|
return null;
|
|
80
96
|
}
|
|
81
97
|
|
|
82
98
|
searching.value = true;
|
|
99
|
+
messages.value = [];
|
|
83
100
|
|
|
84
101
|
let feeds: t.FeedInfo[] = [];
|
|
85
102
|
|
|
86
103
|
try {
|
|
87
|
-
|
|
104
|
+
const answer = await api.discoverFeeds({url: searhedUrl.value});
|
|
105
|
+
feeds = answer.feeds;
|
|
106
|
+
messages.value = answer.messages;
|
|
88
107
|
} catch (e) {
|
|
89
108
|
console.error(e);
|
|
90
109
|
}
|
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
import * as api from "@/logic/api";
|
|
44
44
|
import {computedAsync} from "@vueuse/core";
|
|
45
45
|
import {useEntriesStore} from "@/stores/entries";
|
|
46
|
+
import {useGlobalSettingsStore} from "@/stores/globalSettings";
|
|
47
|
+
|
|
48
|
+
const globalSettings = useGlobalSettingsStore();
|
|
46
49
|
|
|
47
50
|
const opmlFile = ref<File | null>(null);
|
|
48
51
|
|
|
@@ -76,6 +79,10 @@
|
|
|
76
79
|
try {
|
|
77
80
|
await api.addOPML({content: content});
|
|
78
81
|
|
|
82
|
+
// loading an OPML file is pretty rare and significantly changes the list of feeds
|
|
83
|
+
// => we can force data to be reloaded
|
|
84
|
+
globalSettings.updateDataVersion();
|
|
85
|
+
|
|
79
86
|
loading.value = false;
|
|
80
87
|
loaded.value = true;
|
|
81
88
|
error.value = false;
|
package/src/logic/api.ts
CHANGED
|
@@ -167,13 +167,19 @@ export async function discoverFeeds({url}: {url: string}) {
|
|
|
167
167
|
const response = await post({url: API_DISCOVER_FEEDS, data: {url: url}});
|
|
168
168
|
|
|
169
169
|
const feeds = [];
|
|
170
|
+
const messages = [];
|
|
170
171
|
|
|
171
172
|
for (let rawFeed of response.feeds) {
|
|
172
173
|
const feed = t.feedInfoFromJSON(rawFeed);
|
|
173
174
|
feeds.push(feed);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
|
|
177
|
+
for (let rawMessage of response.messages) {
|
|
178
|
+
const message = t.apiMessageFromJSON(rawMessage);
|
|
179
|
+
messages.push(message);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {feeds, messages};
|
|
177
183
|
}
|
|
178
184
|
|
|
179
185
|
export async function addFeed({url}: {url: string}) {
|
package/src/logic/types.ts
CHANGED
|
@@ -287,24 +287,28 @@ export type FeedInfo = {
|
|
|
287
287
|
readonly title: string;
|
|
288
288
|
readonly description: string;
|
|
289
289
|
readonly entries: EntryInfo[];
|
|
290
|
+
readonly isLinked: boolean;
|
|
290
291
|
};
|
|
291
292
|
|
|
292
293
|
export function feedInfoFromJSON({
|
|
293
294
|
url,
|
|
294
295
|
title,
|
|
295
296
|
description,
|
|
296
|
-
entries
|
|
297
|
+
entries,
|
|
298
|
+
isLinked
|
|
297
299
|
}: {
|
|
298
300
|
url: string;
|
|
299
301
|
title: string;
|
|
300
302
|
description: string;
|
|
301
303
|
entries: any[];
|
|
304
|
+
isLinked: boolean;
|
|
302
305
|
}): FeedInfo {
|
|
303
306
|
return {
|
|
304
307
|
url: toURL(url),
|
|
305
308
|
title,
|
|
306
309
|
description,
|
|
307
|
-
entries: entries.map(entryInfoFromJSON)
|
|
310
|
+
entries: entries.map(entryInfoFromJSON),
|
|
311
|
+
isLinked
|
|
308
312
|
};
|
|
309
313
|
}
|
|
310
314
|
|
|
@@ -478,3 +482,19 @@ export function collectionFeedInfoFromJSON({
|
|
|
478
482
|
id: toFeedId(id)
|
|
479
483
|
});
|
|
480
484
|
}
|
|
485
|
+
|
|
486
|
+
export class ApiMessage {
|
|
487
|
+
readonly type: string;
|
|
488
|
+
readonly code: string;
|
|
489
|
+
readonly message: string;
|
|
490
|
+
|
|
491
|
+
constructor({type, code, message}: {type: string; code: string; message: string}) {
|
|
492
|
+
this.type = type;
|
|
493
|
+
this.code = code;
|
|
494
|
+
this.message = message;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export function apiMessageFromJSON({type, code, message}: {type: string; code: string; message: string}): ApiMessage {
|
|
499
|
+
return new ApiMessage({type, code, message});
|
|
500
|
+
}
|
|
@@ -10,16 +10,26 @@
|
|
|
10
10
|
|
|
11
11
|
<h2>Lood feeds from an OPML file</h2>
|
|
12
12
|
|
|
13
|
+
<div class="ffun-info-good">
|
|
14
|
+
<p>
|
|
15
|
+
<a
|
|
16
|
+
href="https://en.wikipedia.org/wiki/OPML"
|
|
17
|
+
target="_blank"
|
|
18
|
+
>OPML</a
|
|
19
|
+
>
|
|
20
|
+
is a widely-used format for transferring news feed lists between platforms.
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p
|
|
24
|
+
>Export your feeds from your old reader in OPML format and import them into our reader to seamlessly
|
|
25
|
+
transition!</p
|
|
26
|
+
>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
13
29
|
<opml-upload />
|
|
14
30
|
|
|
15
31
|
<h2>Search for a feed</h2>
|
|
16
32
|
|
|
17
|
-
<div class="ffun-info-attention">
|
|
18
|
-
<p> The discovery feature is experimental and might not work on all websites. </p>
|
|
19
|
-
|
|
20
|
-
<p> If we can’t find a feed for a site, try finding the feed's URL manually, then enter it in the form. </p>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
33
|
<discovery-form />
|
|
24
34
|
</side-panel-layout>
|
|
25
35
|
</template>
|