mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
add proper version
This commit is contained in:
parent
de27cf2a63
commit
0f7fc1e960
3 changed files with 14 additions and 4 deletions
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
mod backend_proto;
|
mod backend_proto;
|
||||||
|
|
||||||
|
pub fn version() -> &'static str {
|
||||||
|
include_str!("../../meta/version").trim()
|
||||||
|
}
|
||||||
|
|
||||||
pub mod backend;
|
pub mod backend;
|
||||||
pub mod cloze;
|
pub mod cloze;
|
||||||
pub mod err;
|
pub mod err;
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::media::files::{
|
||||||
add_file_from_ankiweb, data_for_file, normalize_filename, remove_files, AddedFile,
|
add_file_from_ankiweb, data_for_file, normalize_filename, remove_files, AddedFile,
|
||||||
};
|
};
|
||||||
use crate::media::{register_changes, MediaManager};
|
use crate::media::{register_changes, MediaManager};
|
||||||
|
use crate::version;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
|
@ -19,8 +20,6 @@ use std::io::{Read, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::{io, time};
|
use std::{io, time};
|
||||||
|
|
||||||
// fixme: version string
|
|
||||||
|
|
||||||
static SYNC_MAX_FILES: usize = 25;
|
static SYNC_MAX_FILES: usize = 25;
|
||||||
static SYNC_MAX_BYTES: usize = (2.5 * 1024.0 * 1024.0) as usize;
|
static SYNC_MAX_BYTES: usize = (2.5 * 1024.0 * 1024.0) as usize;
|
||||||
|
|
||||||
|
@ -71,12 +70,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn sync_begin(&self, hkey: &str) -> Result<(String, i32)> {
|
async fn sync_begin(&self, hkey: &str) -> Result<(String, i32)> {
|
||||||
let url = format!("{}/begin", self.endpoint);
|
let url = format!("{}begin", self.endpoint);
|
||||||
|
|
||||||
let resp = self
|
let resp = self
|
||||||
.client
|
.client
|
||||||
.get(&url)
|
.get(&url)
|
||||||
.query(&[("k", hkey), ("v", "ankidesktop,2.1.19,mac")])
|
.query(&[("k", hkey), ("v", &version_string())])
|
||||||
.send()
|
.send()
|
||||||
.await?
|
.await?
|
||||||
.error_for_status()?;
|
.error_for_status()?;
|
||||||
|
@ -602,6 +601,10 @@ fn zip_files(media_folder: &Path, files: &[MediaEntry]) -> Result<Vec<u8>> {
|
||||||
Ok(w.into_inner())
|
Ok(w.into_inner())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn version_string() -> String {
|
||||||
|
format!("anki,{},{}", version(), std::env::consts::OS)
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct FinalizeRequest {
|
struct FinalizeRequest {
|
||||||
local: u32,
|
local: u32,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use anki::backend::{init_backend, Backend as RustBackend};
|
use anki::backend::{init_backend, Backend as RustBackend};
|
||||||
use log::error;
|
use log::error;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
Loading…
Reference in a new issue