mirror of
https://github.com/hanxi/xiaomusic.git
synced 2025-12-06 14:52:50 +08:00
feat: 新增开关控制是否开始谷歌统计 see #473
This commit is contained in:
@@ -57,8 +57,11 @@ class Analytics:
|
||||
await self._send(event)
|
||||
|
||||
async def _send(self, event):
|
||||
asyncio.create_task(self.post_to_umami(event))
|
||||
await self.run_with_cancel(self._google_send, [event])
|
||||
if self.config.enable_analytics:
|
||||
asyncio.create_task(self.post_to_umami(event))
|
||||
await self.run_with_cancel(self._google_send, [event])
|
||||
else:
|
||||
self.log.info("analytics is disabled, skip sending event")
|
||||
|
||||
def _google_send(self, events):
|
||||
try:
|
||||
|
||||
@@ -191,6 +191,9 @@ class Config:
|
||||
enable_save_tag: bool = (
|
||||
os.getenv("XIAOMUSIC_ENABLE_SAVE_TAG", "false").lower() == "true"
|
||||
)
|
||||
enable_analytics: bool = (
|
||||
os.getenv("XIAOMUSIC_ENABLE_ANALYTICS", "true").lower() == "true"
|
||||
)
|
||||
get_ask_by_mina: bool = (
|
||||
os.getenv("XIAOMUSIC_GET_ASK_BY_MINA", "false").lower() == "true"
|
||||
)
|
||||
|
||||
7
xiaomusic/static/default/setting.html
vendored
7
xiaomusic/static/default/setting.html
vendored
@@ -260,6 +260,13 @@ var vConsole = new window.VConsole();
|
||||
<option value="false" selected>false</option>
|
||||
</select>
|
||||
|
||||
<label for="enable_analytics">开启谷歌数据统计(无敏感数据):</label>
|
||||
<select id="enable_analytics">
|
||||
<option value="true" selected>true</option>
|
||||
<option value="false">false</option>
|
||||
</select>
|
||||
|
||||
|
||||
<label for="music_list_url" class="setting-label">歌单地址:
|
||||
<button class="option-inline mini-button" id="get_music_list">
|
||||
<span class="material-icons">sync_alt</span>
|
||||
|
||||
Reference in New Issue
Block a user