feeds-fun 1.21.5 → 1.22.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feeds-fun",
3
- "version": "1.21.5",
3
+ "version": "1.22.0",
4
4
  "author": "Aliaksei Yaletski (Tiendil) <a.eletsky@gmail.com> (https://tiendil.org/)",
5
5
  "description": "Frontend for the Feeds Fun — web-based news reader",
6
6
  "keywords": [
@@ -40,7 +40,6 @@
40
40
  "lodash": "^4.17.21",
41
41
  "pinia": "^2.2.6",
42
42
  "set-interval-async": "^3.0.3",
43
- "supertokens-web-js": "^0.5.0",
44
43
  "vanilla-cookieconsent": "^3.1.0",
45
44
  "vue": "^3.5.12",
46
45
  "vue-router": "^4.4.5"
package/src/App.vue CHANGED
@@ -21,8 +21,8 @@
21
21
  });
22
22
 
23
23
  watchEffect(async () => {
24
- if (utmStorage.value && globalState.isLoggedIn && Object.keys(utmStorage.value).length > 0) {
25
- await events.trackUtm(utmStorage.value);
24
+ if (utmStorage.value && globalState.loginConfirmed && Object.keys(utmStorage.value).length > 0) {
25
+ events.trackUtm(utmStorage.value);
26
26
  utmStorage.value = null;
27
27
  }
28
28
  });
@@ -140,9 +140,9 @@
140
140
  return utils.purifyBody({raw: entry.value.body, default_: "No description"});
141
141
  });
142
142
 
143
- async function newsLinkOpenedEvent() {
143
+ function newsLinkOpenedEvent() {
144
144
  asserts.defined(eventsView);
145
- await events.newsLinkOpened({entryId: entry.value.id, view: eventsView});
145
+ events.newsLinkOpened({entryId: entry.value.id, view: eventsView});
146
146
  }
147
147
 
148
148
  async function onTitleClick(event: MouseEvent) {
@@ -172,7 +172,7 @@
172
172
  }
173
173
  }
174
174
  } else {
175
- await newsLinkOpenedEvent();
175
+ newsLinkOpenedEvent();
176
176
  }
177
177
  }
178
178
 
@@ -74,7 +74,7 @@
74
74
  </a>
75
75
 
76
76
  <a
77
- v-if="!settings.isSingleUserMode"
77
+ v-if="!globalState.isSingleUserMode"
78
78
  href="#"
79
79
  class="ffun-normal-link"
80
80
  @click.prevent="cookieConsent.showCookieConsent()">
@@ -94,6 +94,7 @@
94
94
  import * as settings from "@/logic/settings";
95
95
  import * as asserts from "@/logic/asserts";
96
96
  import * as cookieConsent from "@/plugins/CookieConsent";
97
+ import {useGlobalState} from "@/stores/globalState";
97
98
 
98
99
  const router = useRouter();
99
100
 
@@ -101,6 +102,8 @@
101
102
 
102
103
  asserts.defined(eventsView);
103
104
 
105
+ const globalState = useGlobalState();
106
+
104
107
  const year = computed(() => {
105
108
  const date = new Date();
106
109
  return date.getFullYear();
@@ -1,12 +1,11 @@
1
1
  <template>
2
2
  <social-link
3
- v-if="showApi"
4
- kind="api"
3
+ kind="blog"
5
4
  mode="text"
6
5
  class="ffun-page-header-link" />
7
6
 
8
7
  <social-link
9
- kind="blog"
8
+ kind="roadmap"
10
9
  mode="text"
11
10
  class="ffun-page-header-link" />
12
11
 
@@ -33,7 +32,7 @@
33
32
  import * as settings from "@/logic/settings";
34
33
  import * as asserts from "@/logic/asserts";
35
34
 
36
- const properties = defineProps<{showApi: boolean}>();
35
+ const properties = defineProps<{}>();
37
36
 
38
37
  const eventsView = inject<events.EventsViewName>("eventsViewName");
39
38
 
@@ -24,7 +24,6 @@
24
24
  import {useRouter, RouterLink, RouterView} from "vue-router";
25
25
  import {useGlobalSettingsStore} from "@/stores/globalSettings";
26
26
  import {useGlobalState} from "@/stores/globalState";
27
- import {useSupertokens} from "@/stores/supertokens";
28
27
  import * as asserts from "@/logic/asserts";
29
28
  import * as events from "@/logic/events";
30
29
  import * as e from "@/logic/enums";
@@ -77,22 +77,22 @@
77
77
  return result;
78
78
  });
79
79
 
80
- async function onClick() {
80
+ function onClick() {
81
81
  asserts.defined(tagsStates);
82
82
  asserts.defined(eventsView);
83
83
 
84
84
  let changeInfo = tagsStates.value.onTagClicked({tag: properties.uid});
85
85
 
86
- await events.tagStateChanged({tag: properties.uid, view: eventsView, source: "tags_filter", ...changeInfo});
86
+ events.tagStateChanged({tag: properties.uid, view: eventsView, source: "tags_filter", ...changeInfo});
87
87
  }
88
88
 
89
- async function onRevers() {
89
+ function onRevers() {
90
90
  asserts.defined(tagsStates);
91
91
  asserts.defined(eventsView);
92
92
 
93
93
  let changeInfo = tagsStates.value.onTagReversed({tag: properties.uid});
94
94
 
95
- await events.tagStateChanged({tag: properties.uid, view: eventsView, source: "tags_filter", ...changeInfo});
95
+ events.tagStateChanged({tag: properties.uid, view: eventsView, source: "tags_filter", ...changeInfo});
96
96
  }
97
97
 
98
98
  const switchTooltip = computed(() => {
@@ -8,6 +8,27 @@
8
8
  @apply transition-colors duration-150;
9
9
  }
10
10
 
11
+ .ffun-main-auth-button {
12
+ @apply ffun-x-input-common border-0;
13
+ @apply text-xl;
14
+ @apply px-3 py-2;
15
+ @apply rounded-lg shadow-sm border focus:ring-0;
16
+
17
+ &.ffun-login {
18
+ @apply hover:border-slate-400;
19
+ }
20
+
21
+ &.ffun-register {
22
+ @apply bg-emerald-600 text-white;
23
+ @apply hover:border-emerald-700;
24
+ }
25
+
26
+ &.ffun-go-to-feeds {
27
+ @apply text-blue-700;
28
+ @apply border-blue-300 hover:border-blue-400;
29
+ }
30
+ }
31
+
11
32
  .ffun-form-button {
12
33
  @apply ffun-x-input-common font-semibold text-white;
13
34
  @apply px-4 py-2;
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <div class="ffun-side-panel-layout">
2
+ <div
3
+ v-if="showGUI"
4
+ class="ffun-side-panel-layout">
3
5
  <div
4
6
  v-if="showSidebar"
5
7
  class="ffun-side-panel">
@@ -57,7 +59,7 @@
57
59
 
58
60
  <page-header-home-button v-if="homeButton" />
59
61
 
60
- <template v-if="globalState.isLoggedIn">
62
+ <template v-if="globalState.loginConfirmed">
61
63
  <template
62
64
  v-for="[mode, props] of e.MainPanelModeProperties"
63
65
  :key="mode">
@@ -79,20 +81,20 @@
79
81
  </template>
80
82
  </template>
81
83
 
82
- <page-header-external-links :show-api="globalState.isLoggedIn" />
84
+ <page-header-external-links />
83
85
  </div>
84
86
 
85
87
  <div class="ffun-page-header-right-block">
86
88
  <a
87
- v-if="globalState.isLoggedIn && !settings.isSingleUserMode"
89
+ v-if="globalState.loginConfirmed && !globalState.isSingleUserMode"
88
90
  href="#"
89
91
  class="ffun-page-header-link"
90
- @click.prevent="logout()"
92
+ @click.prevent="globalState.logout()"
91
93
  >logout</a
92
94
  >
93
95
 
94
96
  <span
95
- v-if="settings.isSingleUserMode"
97
+ v-if="globalState.isSingleUserMode"
96
98
  href="#"
97
99
  class="ffun-page-header-link-disabled"
98
100
  >single-user mode</span
@@ -112,7 +114,7 @@
112
114
  </div>
113
115
  </div>
114
116
 
115
- <page-footer />
117
+ <page-footer v-if="showGUI" />
116
118
  </template>
117
119
 
118
120
  <script lang="ts" setup>
@@ -120,13 +122,12 @@
120
122
  import {useRouter} from "vue-router";
121
123
  import {useGlobalSettingsStore} from "@/stores/globalSettings";
122
124
  import {useGlobalState} from "@/stores/globalState";
123
- import {useSupertokens} from "@/stores/supertokens";
124
125
  import * as events from "@/logic/events";
125
126
  import * as e from "@/logic/enums";
127
+ import * as api from "@/logic/api";
126
128
  import * as settings from "@/logic/settings";
127
129
 
128
130
  const globalSettings = useGlobalSettingsStore();
129
- const supertokens = useSupertokens();
130
131
  const globalState = useGlobalState();
131
132
 
132
133
  const router = useRouter();
@@ -141,19 +142,6 @@
141
142
  }
142
143
  );
143
144
 
144
- async function logout() {
145
- if (settings.authMode === settings.AuthMode.SingleUser) {
146
- alert("You can't logout in single user mode");
147
- return;
148
- }
149
-
150
- await supertokens.logout();
151
-
152
- if (properties.loginRequired) {
153
- router.push({name: "main", params: {}});
154
- }
155
- }
156
-
157
145
  const hasSideFooter = computed(() => {
158
146
  return !!slots["side-footer"];
159
147
  });
@@ -166,17 +154,20 @@
166
154
  return globalSettings.showSidebar || !globalSettings.userSettingsPresent;
167
155
  });
168
156
 
157
+ const showGUI = computed(() => {
158
+ return globalState.loginConfirmed || !properties.loginRequired;
159
+ });
160
+
169
161
  watchEffect(() => {
170
162
  if (!properties.loginRequired) {
171
163
  return;
172
164
  }
173
165
 
174
- if (globalState.isLoggedIn === null) {
175
- return;
176
- }
177
-
178
- if (!globalState.isLoggedIn) {
179
- router.push({name: "main", params: {}});
166
+ if (globalState.logoutConfirmed) {
167
+ // Redirect to login page in case the user is not logged in.
168
+ // We redirect to login instead of the main page to be consisten
169
+ // with default API behavior on redirection in case of getting 401 status.
170
+ api.redirectToLogin();
180
171
  }
181
172
  });
182
173
  </script>