Skip to content

Commit

Permalink
do not use auto track, use manual track
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Nicolle committed Mar 2, 2024
1 parent b36647e commit d8d1948
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- plausible

jobs:
deploy:
Expand Down
3 changes: 1 addition & 2 deletions client/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ const app = createApp(App)
.use(naive)
.use(i18n);

app.mount('#app');
plausible.enableAutoPageviews();
app.mount('#app');
24 changes: 18 additions & 6 deletions client/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';
import { api } from '../api';
import { trackPageview } from '../js/plausible';

const routes: Array<RouteRecordRaw> = [
{
Expand Down Expand Up @@ -117,13 +118,24 @@ const router = createRouter({
});

router.beforeEach(async (to, from) => {

try {
if (to.name) {
trackPageview({
url: to.name
});
}
} catch (e) {
console.error(e);
}

const isSignedin = await api.isSignedIn();
// if (
// !isSignedin &&
// to.meta.requiresAuth !== false
// ) {
// return { name: 'login', query: { redirect: to.name } };
// }
if (
!isSignedin &&
to.meta.requiresAuth !== false
) {
return { name: 'login', query: { redirect: to.name } };
}
});

export default router;
4 changes: 2 additions & 2 deletions nginx-proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
add_header Cross-Origin-Embedder-Policy require-corp;
}

location /plausible {
location = /plausible/api/event {
add_header X-Cache $upstream_cache_status;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
Expand All @@ -34,7 +34,7 @@
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_max_temp_file_size 0;
proxy_pass http://localhost:51000;
proxy_pass http://localhost:51000/api/event;
proxy_redirect off;
proxy_read_timeout 240s;
add_header Access-Control-Allow-Origin "http://motsflex.com";
Expand Down

0 comments on commit d8d1948

Please sign in to comment.