Merge branch 'develop' into iceshrimp_mastodon

This commit is contained in:
naskya 2024-06-17 23:50:39 +09:00
commit ee933524e4
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
17 changed files with 641 additions and 579 deletions

18
Cargo.lock generated
View file

@ -239,9 +239,9 @@ dependencies = [
[[package]]
name = "backtrace"
version = "0.3.72"
version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11"
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
dependencies = [
"addr2line",
"cc",
@ -290,12 +290,11 @@ checksum = "1dbe4bb73fd931c4d1aaf53b35d1286c8a948ad00ec92c8e3c856f15fd027f43"
[[package]]
name = "bb8"
version = "0.8.3"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df7c2093d15d6a1d33b1f972e1c5ea3177748742b97a5f392aa83a65262c6780"
checksum = "b10cf871f3ff2ce56432fddc2615ac7acc3aa22ca321f8fea800846fbb32f188"
dependencies = [
"async-trait",
"futures-channel",
"futures-util",
"tokio",
]
@ -2028,9 +2027,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.35.0"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e"
checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434"
dependencies = [
"memchr",
]
@ -3143,11 +3142,10 @@ dependencies = [
[[package]]
name = "sqlformat"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c"
checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f"
dependencies = [
"itertools",
"nom",
"unicode_categories",
]

View file

@ -13,7 +13,7 @@ napi-build = "2.1.3"
argon2 = { version = "0.5.3", default-features = false }
async-trait = { version = "0.1.80", default-features = false }
basen = { version = "0.1.0", default-features = false }
bb8 = { version = "0.8.3", default-features = false }
bb8 = { version = "0.8.5", default-features = false }
bcrypt = { version = "0.15.1", default-features = false }
chrono = { version = "0.4.38", default-features = false }
convert_case = { version = "0.6.0", default-features = false }

View file

@ -17,8 +17,7 @@ ENV PATH="/root/.cargo/bin:${PATH}"
COPY packages/macro-rs packages/macro-rs/
COPY packages/backend-rs/src/lib.rs packages/backend-rs/src/
COPY packages/backend-rs/Cargo.toml packages/backend-rs/Cargo.toml
COPY Cargo.toml Cargo.toml
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.lock ./
# Configure pnpm, and install backend-rs dependencies
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm --filter backend-rs install

View file

@ -15,6 +15,10 @@ Critical security updates are indicated by the :warning: icon.
- The new Mastodon API uses a new format to manage Mastodon sessions in the database, whereas old implementation uses Misskey sessions. All previous client app and token registrations will not work with the new API. All clients need to be re-registered and all users need to re-authenticate.
- All IDs (of statuses/notes, notifications, users, etc.) will be using the alphanumerical format, aligning with the Firefish/Misskey API. The old numerical IDs will not work when queried against the new API.
## [v20240613](https://firefish.dev/firefish/firefish/-/merge_requests/11003/commits)
This update contains code refactoring and dependency updates, with no major user-facing changes.
## [v20240607](https://firefish.dev/firefish/firefish/-/merge_requests/10978/commits)
- Add the ability to share posts via QR code

View file

@ -1,6 +1,6 @@
{
"name": "firefish",
"version": "20240607",
"version": "20240613",
"repository": {
"type": "git",
"url": "https://firefish.dev/firefish/firefish.git"
@ -26,9 +26,10 @@
"lint:rs": "cargo clippy --fix --allow-dirty --allow-staged && cargo fmt --all --",
"debug": "pnpm run build:debug && pnpm run start",
"mocha": "pnpm --filter backend run mocha",
"test": "pnpm run test:ts && pnpm run test:rs",
"test": "pnpm run test:rs && pnpm run test:rs:miri && pnpm run test:ts",
"test:ts": "pnpm run mocha",
"test:rs": "cargo test --doc && cargo nextest run",
"test:rs:miri": "MIRIFLAGS='-Zmiri-disable-isolation' cargo +nightly miri nextest run -j$(nproc --all)",
"format": "pnpm run format:ts; pnpm run format:rs",
"format:ts": "pnpm -r --parallel run format",
"format:rs": "cargo fmt --all --",

View file

@ -18,8 +18,8 @@ pub async fn elaborate_impl(
file_ids: &[String],
text: Option<String>,
cw: Option<String>,
renote_id: &Option<String>,
reply_id: &Option<String>,
renote_id: Option<&String>,
reply_id: Option<&String>,
include_parent: bool,
) -> Result<Vec<String>, DbErr> {
let db = db_conn().await?;
@ -123,8 +123,8 @@ macro_rules! elaborate {
&$note_like.file_ids,
$note_like.text.clone(),
$note_like.cw.clone(),
&$note_like.renote_id,
&$note_like.reply_id,
$note_like.renote_id.as_ref(),
$note_like.reply_id.as_ref(),
$include_parent,
)
};

View file

@ -57,14 +57,15 @@ pub(super) async fn check_hit_antenna(
return Ok(false);
}
} else if antenna.src == AntennaSrc::Instances {
let is_from_one_of_specified_servers = antenna.instances.iter().any(|host| {
host.to_ascii_lowercase()
== note_author
.host
.clone()
.unwrap_or_else(|| CONFIG.host.clone())
.to_ascii_lowercase()
});
let note_author_host = note_author
.host
.clone()
.unwrap_or_else(|| CONFIG.host.clone())
.to_ascii_lowercase();
let is_from_one_of_specified_servers = antenna
.instances
.iter()
.any(|host| host.to_ascii_lowercase() == note_author_host);
if !is_from_one_of_specified_servers {
return Ok(false);
@ -116,7 +117,10 @@ pub(super) async fn check_hit_antenna(
return Ok(false);
}
if [NoteVisibility::Home, NoteVisibility::Followers].contains(&note.visibility) {
if matches!(
note.visibility,
NoteVisibility::Home | NoteVisibility::Followers
) {
let following_user_ids: Vec<String> =
if let Some(ids) = cache::get_one(cache::Category::Follow, &antenna.user_id).await? {
ids

View file

@ -27,11 +27,11 @@ fn init_id_generator(length: u8, fingerprint: &str) {
/// It automatically calls [init_id_generator], if the generator has not been initialized.
fn create_id(datetime: &NaiveDateTime) -> String {
if GENERATOR.get().is_none() {
let length = match &CONFIG.cuid {
Some(cuid) => cmp::min(cmp::max(cuid.length.unwrap_or(16), 16), 24),
let length = match CONFIG.cuid.as_ref() {
Some(cuid) => cuid.length.unwrap_or(16).clamp(16, 24),
None => 16,
};
let fingerprint = match &CONFIG.cuid {
let fingerprint = match CONFIG.cuid.as_ref() {
Some(cuid) => cuid.fingerprint.as_deref().unwrap_or_default(),
None => "",
};

View file

@ -22,9 +22,9 @@
"@swc/core-android-arm64": "1.3.11"
},
"dependencies": {
"@bull-board/api": "5.20.1",
"@bull-board/koa": "5.20.1",
"@bull-board/ui": "5.20.1",
"@bull-board/api": "5.20.2",
"@bull-board/koa": "5.20.2",
"@bull-board/ui": "5.20.2",
"@discordapp/twemoji": "15.0.3",
"@koa/cors": "5.0.0",
"@koa/multer": "3.0.2",
@ -38,7 +38,7 @@
"archiver": "7.0.1",
"async-lock": "1.4.0",
"async-mutex": "0.5.0",
"aws-sdk": "2.1639.0",
"aws-sdk": "2.1642.0",
"axios": "1.7.2",
"backend-rs": "workspace:*",
"blurhash": "2.0.5",
@ -123,7 +123,7 @@
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.5.28",
"@swc/core": "1.6.1",
"@types/adm-zip": "0.5.5",
"@types/async-lock": "1.4.0",
"@types/color-convert": "2.0.3",
@ -169,7 +169,7 @@
"@types/websocket": "1.0.10",
"@types/ws": "8.5.10",
"cross-env": "7.0.3",
"eslint": "9.4.0",
"eslint": "9.5.0",
"mocha": "10.4.0",
"pug": "3.0.3",
"strict-event-emitter-types": "2.0.0",
@ -177,9 +177,9 @@
"ts-loader": "9.5.1",
"ts-node": "10.9.2",
"tsconfig-paths": "4.2.0",
"type-fest": "4.20.0",
"type-fest": "4.20.1",
"typescript": "5.4.5",
"webpack": "5.92.0",
"ws": "8.17.0"
"ws": "8.17.1"
}
}

View file

@ -34,7 +34,7 @@
"@types/tinycolor2": "1.4.6",
"@types/uuid": "9.0.8",
"@vitejs/plugin-vue": "5.0.5",
"@vue/runtime-core": "3.4.27",
"@vue/runtime-core": "3.4.29",
"autobind-decorator": "2.4.0",
"autosize": "6.0.1",
"broadcast-channel": "7.0.0",
@ -84,9 +84,9 @@
"typescript": "5.4.5",
"unicode-emoji-json": "0.6.0",
"uuid": "10.0.0",
"vite": "5.2.13",
"vite": "5.3.1",
"vite-plugin-compression": "0.5.1",
"vue": "3.4.27",
"vue": "3.4.29",
"vue-draggable-plus": "0.5.0",
"vue-plyr": "7.0.0",
"vue-prism-editor": "2.0.0-alpha.2",

View file

@ -78,8 +78,8 @@ const bg = {
function getInstanceIcon(instance): string {
return (
getProxiedImageUrlNullable(instance.iconUrl, "preview") ??
getProxiedImageUrlNullable(instance.faviconUrl, "preview") ??
getProxiedImageUrlNullable(instance.iconUrl, "preview") ??
"/client-assets/dummy.png"
);
}

View file

@ -328,13 +328,21 @@ export default defineComponent({
}
case "fg": {
let color = token.props.args.color;
if (!/^[0-9a-f]{3,6}$/i.test(color.toString())) color = "f00";
if (
color == null ||
!/^[0-9a-f]{3,6}$/i.test(color.toString())
)
color = "f00";
style = `color: #${color};`;
break;
}
case "bg": {
let color = token.props.args.color;
if (!/^[0-9a-f]{3,6}$/i.test(color.toString())) color = "f00";
if (
color == null ||
!/^[0-9a-f]{3,6}$/i.test(color.toString())
)
color = "f00";
style = `background-color: #${color};`;
break;
}

View file

@ -31,7 +31,7 @@
<swiper-slide>
<div class="_formRoot">
<div class="fnfelxur">
<img :src="faviconUrl" alt="" class="icon" />
<img :src="iconUrl" alt="" class="icon" />
<span class="name">{{
instance.name || `(${i18n.ts.unknown})`
}}</span>
@ -310,7 +310,7 @@ const instance = ref<AugmentedInstance | null>(null);
const suspended = ref(false);
const isBlocked = ref(false);
const isSilenced = ref(false);
const faviconUrl = ref<string | null>(null);
const iconUrl = ref<string | null>(null);
const usersPagination = {
endpoint: isAdmin ? ("admin/show-users" as const) : ("users" as const),
@ -332,9 +332,9 @@ async function fetch() {
suspended.value = instance.value.isSuspended;
isBlocked.value = instance.value.isBlocked;
isSilenced.value = instance.value.isSilenced;
faviconUrl.value =
getProxiedImageUrlNullable(instance.value.faviconUrl, "preview") ??
getProxiedImageUrlNullable(instance.value.iconUrl, "preview");
iconUrl.value =
getProxiedImageUrlNullable(instance.value.iconUrl, "preview") ??
getProxiedImageUrlNullable(instance.value.faviconUrl, "preview");
}
async function toggleBlock() {

View file

@ -1,14 +1,23 @@
import { ColdDeviceStorage } from "@/store";
const ctx = new AudioContext();
const cache = new Map<string, HTMLAudioElement>();
let ctx: AudioContext | null;
try {
ctx = new AudioContext();
} catch {
ctx = null;
}
const cache = new Map<string, AudioBuffer>();
export async function getAudio(
file: string,
useCache = true,
): HTMLAudioElement {
): Promise<AudioBuffer | null> {
if (useCache && cache.has(file)) {
return cache.get(file);
return cache.get(file) ?? null;
}
if (ctx == null) {
return null;
}
const response = await fetch(`/static-assets/sounds/${file}.mp3`);
@ -39,7 +48,7 @@ export function play(type: string) {
export async function playFile(file: string, volume: number) {
const masterVolume = ColdDeviceStorage.get("sound_masterVolume");
if (masterVolume === 0 || volume === 0) {
if (ctx == null || masterVolume === 0 || volume === 0) {
return;
}

View file

@ -22,7 +22,7 @@
},
"devDependencies": {
"@swc/cli": "0.3.12",
"@swc/core": "1.5.28",
"@swc/core": "1.6.1",
"@swc/types": "0.1.8",
"@types/jest": "29.5.12",
"@types/node": "20.14.2",
@ -30,9 +30,9 @@
"jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.5.0",
"mock-socket": "9.3.1",
"ts-jest": "29.1.4",
"ts-jest": "29.1.5",
"ts-node": "10.9.2",
"tsd": "0.31.0",
"tsd": "0.31.1",
"typescript": "5.4.5"
},
"files": [

View file

@ -11,7 +11,7 @@
"devDependencies": {
"firefish-js": "workspace:*",
"idb-keyval": "6.2.1",
"vite": "5.2.13",
"vite": "5.3.1",
"vite-plugin-compression": "0.5.1"
}
}

File diff suppressed because it is too large Load diff