Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
thwbh committed Nov 8, 2024
1 parent e6f14da commit 20d2168
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<div align="center">
<img src="src/main/resources/META-INF/resources/static/images/kamifusen-logo.png">
</div>

---

![GitHub Release](https://img.shields.io/github/v/release/tohuwabohu-io/kamifusen) ![Coverage](https://raw.githubusercontent.com/tohuwabohu-io/kamifusen/badges/jacoco.svg)

# kamifusen

> A simple page hit counter written in kotlin.
Expand All @@ -6,6 +14,40 @@ This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>.

## First time setup
For development, a default user with username/password `admin` exists. You will be prompted to change your
password after your first login. For production, access the database and execute the given `insert.sql` in
`src/main/resources`.

## API Key creation
Issue a new API Key on: http://localhost:8080/users

The new Key will be visible only once. Copy and distribute it according to your needs. Do not use the same API Key across
multiple domains (or do, it's not like I can stop you).

## Registering pages
You need to add some JavaScript to your page if you want the hit counter to work. Use this snippet provided:

```html
<script language="JavaScript">
document.addEventListener('DOMContentLoaded', function () {
const url = new URL(window.location.href);
fetch('http://localhost:8080/public/visits/hit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <API-KEY>'
},
body: JSON.stringify({
path: url.pathname,
domain: url.hostname
})
});
})
</script>
```

## Running the application in dev mode

You can run your application in dev mode that enables live coding using:
Expand Down
2 changes: 1 addition & 1 deletion smoke-test.http
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###
POST localhost:8080/public/visits/hit
Authorization: Basic dG9odXdhYm9odTo1MDM2NGIzOC1mODI0LTRhODQtOGEzMS0wMWI3MjRmZjg3M2E=
Authorization: Basic <API-KEY>

/test/path-9
###

0 comments on commit 20d2168

Please sign in to comment.