mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-22 08:38:29 +02:00
Fix notification status code handling
This commit is contained in:
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@@ -86,17 +86,17 @@ jobs:
|
|||||||
- name: Run lint
|
- name: Run lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: npm run replace-version
|
|
||||||
env:
|
|
||||||
YAAK_VERSION: ${{ github.ref_name }}
|
|
||||||
|
|
||||||
- name: Checkout yaakapp/plugins
|
- name: Checkout yaakapp/plugins
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: yaakapp/plugins
|
repository: yaakapp/plugins
|
||||||
path: ${{ env.YAAK_PLUGINS_DIR }}
|
path: ${{ env.YAAK_PLUGINS_DIR }}
|
||||||
|
|
||||||
|
- name: Set version
|
||||||
|
run: npm run replace-version
|
||||||
|
env:
|
||||||
|
YAAK_VERSION: ${{ github.ref_name }}
|
||||||
|
|
||||||
- uses: tauri-apps/tauri-action@v0
|
- uses: tauri-apps/tauri-action@v0
|
||||||
env:
|
env:
|
||||||
YAAK_PLUGINS_DIR: ${{ env.YAAK_PLUGINS_DIR }}
|
YAAK_PLUGINS_DIR: ${{ env.YAAK_PLUGINS_DIR }}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use chrono::{DateTime, Duration, Utc};
|
use chrono::{DateTime, Duration, Utc};
|
||||||
use log::debug;
|
use log::{debug, info};
|
||||||
use reqwest::Method;
|
use reqwest::Method;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tauri::{AppHandle, Manager};
|
use tauri::{AppHandle, Manager};
|
||||||
@@ -70,10 +70,11 @@ impl YaakNotifier {
|
|||||||
("launches", num_launches.to_string()),
|
("launches", num_launches.to_string()),
|
||||||
]);
|
]);
|
||||||
let resp = req.send().await.map_err(|e| e.to_string())?;
|
let resp = req.send().await.map_err(|e| e.to_string())?;
|
||||||
if resp.status().to_string() != "200" {
|
if resp.status() != 200 {
|
||||||
|
debug!("Skipping notification status code {}", resp.status());
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let notification = resp
|
let notification = resp
|
||||||
.json::<YaakNotification>()
|
.json::<YaakNotification>()
|
||||||
.await
|
.await
|
||||||
@@ -83,7 +84,7 @@ impl YaakNotifier {
|
|||||||
.timestamp
|
.timestamp
|
||||||
.signed_duration_since(Utc::now());
|
.signed_duration_since(Utc::now());
|
||||||
let seen = get_kv(app).await?;
|
let seen = get_kv(app).await?;
|
||||||
if seen.contains(¬ification.id) || (age > Duration::days(1)) {
|
if seen.contains(¬ification.id) || (age > Duration::days(2)) {
|
||||||
debug!("Already seen notification {}", notification.id);
|
debug!("Already seen notification {}", notification.id);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"productName": "Yaak",
|
"productName": "Yaak",
|
||||||
"version": "0.0.0",
|
"version": "2024.7.0-beta.5",
|
||||||
"identifier": "app.yaak.desktop",
|
"identifier": "app.yaak.desktop",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeBuildCommand": "npm run build",
|
"beforeBuildCommand": "npm run build",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export function useNotificationToast() {
|
|||||||
label: string;
|
label: string;
|
||||||
};
|
};
|
||||||
}>('notification', ({ payload }) => {
|
}>('notification', ({ payload }) => {
|
||||||
|
console.log('Got notification event', payload);
|
||||||
const actionUrl = payload.action?.url;
|
const actionUrl = payload.action?.url;
|
||||||
const actionLabel = payload.action?.label;
|
const actionLabel = payload.action?.label;
|
||||||
toast.show({
|
toast.show({
|
||||||
|
|||||||
Reference in New Issue
Block a user