mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Capture pushState events.
This commit is contained in:
parent
58a1c63407
commit
eebf145efc
6 changed files with 81 additions and 48 deletions
|
|
@ -5,7 +5,7 @@ import { allowPost } from 'lib/middleware';
|
|||
export default async (req, res) => {
|
||||
await allowPost(req, res);
|
||||
|
||||
let result = { success: 0, time: Date.now() };
|
||||
let result = { success: 0 };
|
||||
|
||||
const {
|
||||
website_id,
|
||||
|
|
@ -23,6 +23,7 @@ export default async (req, res) => {
|
|||
|
||||
if (website) {
|
||||
const session = await getSession(session_id);
|
||||
const time = Date.now();
|
||||
|
||||
if (!session) {
|
||||
await createSession(website_id, session_id, {
|
||||
|
|
@ -40,7 +41,8 @@ export default async (req, res) => {
|
|||
success: 1,
|
||||
session_id,
|
||||
website_id,
|
||||
hash: hash(`${website_id}${session_id}${result.time}`),
|
||||
time,
|
||||
hash: hash(`${website_id}${session_id}${time}`),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
import React from 'react';
|
||||
import Layout from 'components/layout';
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<Layout>
|
||||
Hello.
|
||||
<br />
|
||||
<a href="/?q=abc">abc</a>
|
||||
<Link href="/?q=abc">
|
||||
<a>abc</a>
|
||||
</Link>
|
||||
<br />
|
||||
<a href="/?q=123">123</a>
|
||||
<Link href="/?q=123">
|
||||
<a>123</a>
|
||||
</Link>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue