add basic analytics (pageviews + extension downloads)

This commit is contained in:
beerpiss 2024-01-12 09:48:26 +07:00
parent 8dba20feb0
commit d30ab1a293
2 changed files with 58 additions and 14 deletions

View File

@ -36,6 +36,8 @@
integrity="sha384-mPO6U7t0sNHfI1UIWNf5U6FDzprqWgAMKfOGW86JVGCKoU/7HPdy6DwBaWOsi4eV" integrity="sha384-mPO6U7t0sNHfI1UIWNf5U6FDzprqWgAMKfOGW86JVGCKoU/7HPdy6DwBaWOsi4eV"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="extensions.js"></script> <script src="extensions.js"></script>
<script data-goatcounter="https://keiyoushi.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
</head> </head>
<body> <body>
@ -47,49 +49,83 @@
</div> </div>
<div class="sources" x-data="extensionList"> <div class="sources" x-data="extensionList">
<h1 class="sources__title">Extensions</h1> <h1 class="sources__title">Extensions</h1>
<template x-if="loading === LoadingStatus.Loading"> <template x-if="loading === LoadingStatus.Loading">
<sl-spinner class="sources__status" style="font-size:3rem"></sl-spinner> <sl-spinner class="sources__status" style="font-size:3rem"></sl-spinner>
</template> </template>
<template x-if="loading === LoadingStatus.Error"> <template x-if="loading === LoadingStatus.Error">
<div class="sources__status">Could not load extension list.</div> <div class="sources__status">Could not load extension list.</div>
</template> </template>
<template x-if="loading === LoadingStatus.Loaded"> <template x-if="loading === LoadingStatus.Loaded">
<div> <div>
<div class="source-search" x-effect="updateFilteredList"> <div class="source-search" x-effect="updateFilteredList">
<div class="source-search__nsfw-wrapper"> <div class="source-search__nsfw-wrapper">
<span class="source-search__nsfw-label">Display mode: </span> <span class="source-search__nsfw-label">Display mode: </span>
<sl-radio-group size="small" name="nsfw" value="all" @sl-change="nsfw = $event.target.value"> <sl-radio-group size="small"
name="nsfw"
value="all"
@sl-change="nsfw = $event.target.value">
<sl-radio-button value="all">Show all</sl-radio-button> <sl-radio-button value="all">Show all</sl-radio-button>
<sl-radio-button value="nsfw">NSFW</sl-radio-button> <sl-radio-button value="nsfw">NSFW</sl-radio-button>
<sl-radio-button value="safe">SFW</sl-radio-button> <sl-radio-button value="safe">SFW</sl-radio-button>
</sl-radio-group> </sl-radio-group>
</div> </div>
<sl-input class="source-search__title" placeholder="Search by name or ID..."
x-model="query"></sl-input> <sl-input class="source-search__title"
<sl-select class="source-search__language" multiple clearable placeholder="Filter by languages" placeholder="Search by name or ID..."
x-model="query">
</sl-input>
<sl-select class="source-search__language"
multiple clearable
placeholder="Filter by languages"
@sl-change="selectedLanguages = event.target.value"> @sl-change="selectedLanguages = event.target.value">
<template x-for="(language, index) in languages" :key="index"> <template x-for="(language, index) in languages" :key="index">
<sl-option :value="language" x-text="languageName(language)"></sl-option> <sl-option :value="language" x-text="languageName(language)"></sl-option>
</template> </template>
</sl-select> </sl-select>
</div> </div>
<template x-for="extension in filtered" :key="extension.pkg"> <template x-for="extension in filtered" :key="extension.pkg">
<div class="source" :id="extension.pkg.replace('eu.kanade.tachiyomi.extension.', '')"> <div class="source"
:id="extension.pkg.replace('eu.kanade.tachiyomi.extension.', '')">
<a :href="`#${extension.pkg.replace('eu.kanade.tachiyomi.extension.', '')}`" <a :href="`#${extension.pkg.replace('eu.kanade.tachiyomi.extension.', '')}`"
class="source__anchor">#</a> <img class="source__icon" :alt="`Icon for ${extension.name}`" class="source__anchor">
:src="`${$store.repoUrl}/icon/${extension.pkg}.png`" loading="lazy" width="42" height="42"> #
</a>
<img class="source__icon"
:alt="`Icon for ${extension.name}`"
:src="`${$store.repoUrl}/icon/${extension.pkg}.png`"
loading="lazy"
width="42"
height="42">
<div class="source__info"> <div class="source__info">
<div class="source__name"> <div class="source__name">
<span x-text="extension.name.split(': ')[1]"></span> <span class="source__version" <span x-text="extension.name.split(': ')[1]"></span>
<span class="source__version"
x-text="`v${extension.version}`"></span> x-text="`v${extension.version}`"></span>
<sl-tag x-cloak size="small" variant="danger"
class="content-rating content-rating--nsfw" <sl-tag class="content-rating content-rating--nsfw"
x-show="extension.nsfw === 1">18+</sl-tag> size="small" variant="danger"
x-cloak x-show="extension.nsfw === 1">
18+
</sl-tag>
</div> </div>
<div class="source__version" x-text="simpleLanguageName(extension.lang)"></div> <div class="source__version" x-text="simpleLanguageName(extension.lang)"></div>
</div> </div>
<sl-button pill size="small" download class="download-button" <sl-button class="download-button"
:href="`${$store.repoUrl}/apk/${extension.apk}`"><sl-icon name="download"></sl-icon></sl-button> pill
size="small"
download
:href="`${$store.repoUrl}/apk/${extension.apk}`"
@click="window.goatcounter?.count({ path: `/apk/${extension.apk}` })">
<sl-icon name="download"></sl-icon>
</sl-button>
</div> </div>
</template> </template>
</div> </div>

View File

@ -31,6 +31,8 @@
src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/shoelace-autoloader.js" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.5.2/cdn/shoelace-autoloader.js"
integrity="sha384-ILzDiPYY4je5i95gGzpVe0e88rFqVnoz3i7HPBsRbtEHxfkA7wR8E+PwjCgt1Bin" integrity="sha384-ILzDiPYY4je5i95gGzpVe0e88rFqVnoz3i7HPBsRbtEHxfkA7wR8E+PwjCgt1Bin"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script data-goatcounter="https://keiyoushi.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
</head> </head>
<body> <body>
<header class="header"> <header class="header">
@ -51,7 +53,13 @@
<li>TachiyomiSY Preview r539+</li> <li>TachiyomiSY Preview r539+</li>
</ul> </ul>
<sl-button style="display: flex; justify-content: center;" variant="primary" href="tachiyomi://add-repo?url=https://raw.githubusercontent.com/keiyoushi/extensions/repo/index.min.json">Add to Tachiyomi</sl-button> <sl-button
style="display: flex; justify-content: center;"
variant="primary"
href="tachiyomi://add-repo?url=https://raw.githubusercontent.com/keiyoushi/extensions/repo/index.min.json"
onclick="window.goatcounter?.count({ path: location.pathname + '#add-to-tachiyomi' })">
Add to Tachiyomi
</sl-button>
</div> </div>
<div> <div>