Give plugins SDK APIs for terminals, granted folders, and plugin services
Plugins can now do through the SDK what they did with direct native calls. The SDK checks plugin shutdown, so these APIs can move to an isolated plugin context later. - api.pty opens shell sessions. pty_open accepts an optional channel. A channel session sends its output as raw bytes to its own webview and sends no pty-data or pty-exit events. Without a channel, the events stay, so the released Terminal plugin keeps working. The host closes the open sessions of a plugin when the plugin stops. - api.files gives folder grants. The user selects the folder, the host keeps the grants of each plugin in its retained data, and the plugin uses an opaque grant ID. The host rejects names with folder parts, links, and files over the size limit. Sidecar JSON files replace the per-image settings commands. - api.services lets one plugin offer data to another plugin in the same window. The host copies arguments and results. - The folder methods of api.backgrounds are deprecated. They stay for released Background Slideshow versions. - The plugin reference lists the native calls of each plugin and the SDK member that replaces each call.
This commit is contained in:
@@ -12,6 +12,14 @@ fn main() {
|
||||
"backgrounds_read",
|
||||
"backgrounds_read_image_settings",
|
||||
"backgrounds_write_image_settings",
|
||||
"folders_choose",
|
||||
"folders_picture",
|
||||
"folders_grants",
|
||||
"folders_revoke",
|
||||
"folders_list",
|
||||
"folders_read",
|
||||
"folders_read_sidecar",
|
||||
"folders_write_sidecar",
|
||||
"spelling_suggestions",
|
||||
"spelling_menu_install",
|
||||
"spelling_menu_select",
|
||||
|
||||
@@ -96,6 +96,14 @@
|
||||
"allow-backgrounds-list",
|
||||
"allow-backgrounds-read",
|
||||
"allow-backgrounds-read-image-settings",
|
||||
"allow-backgrounds-write-image-settings"
|
||||
"allow-backgrounds-write-image-settings",
|
||||
"allow-folders-choose",
|
||||
"allow-folders-picture",
|
||||
"allow-folders-grants",
|
||||
"allow-folders-revoke",
|
||||
"allow-folders-list",
|
||||
"allow-folders-read",
|
||||
"allow-folders-read-sidecar",
|
||||
"allow-folders-write-sidecar"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -41,6 +41,14 @@
|
||||
"allow-backgrounds-list",
|
||||
"allow-backgrounds-read",
|
||||
"allow-backgrounds-read-image-settings",
|
||||
"allow-backgrounds-write-image-settings"
|
||||
"allow-backgrounds-write-image-settings",
|
||||
"allow-folders-choose",
|
||||
"allow-folders-picture",
|
||||
"allow-folders-grants",
|
||||
"allow-folders-revoke",
|
||||
"allow-folders-list",
|
||||
"allow-folders-read",
|
||||
"allow-folders-read-sidecar",
|
||||
"allow-folders-write-sidecar"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-choose"
|
||||
description = "Enables the folders_choose command without any pre-configured scope."
|
||||
commands.allow = ["folders_choose"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-choose"
|
||||
description = "Denies the folders_choose command without any pre-configured scope."
|
||||
commands.deny = ["folders_choose"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-grants"
|
||||
description = "Enables the folders_grants command without any pre-configured scope."
|
||||
commands.allow = ["folders_grants"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-grants"
|
||||
description = "Denies the folders_grants command without any pre-configured scope."
|
||||
commands.deny = ["folders_grants"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-list"
|
||||
description = "Enables the folders_list command without any pre-configured scope."
|
||||
commands.allow = ["folders_list"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-list"
|
||||
description = "Denies the folders_list command without any pre-configured scope."
|
||||
commands.deny = ["folders_list"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-picture"
|
||||
description = "Enables the folders_picture command without any pre-configured scope."
|
||||
commands.allow = ["folders_picture"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-picture"
|
||||
description = "Denies the folders_picture command without any pre-configured scope."
|
||||
commands.deny = ["folders_picture"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-read"
|
||||
description = "Enables the folders_read command without any pre-configured scope."
|
||||
commands.allow = ["folders_read"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-read"
|
||||
description = "Denies the folders_read command without any pre-configured scope."
|
||||
commands.deny = ["folders_read"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-read-sidecar"
|
||||
description = "Enables the folders_read_sidecar command without any pre-configured scope."
|
||||
commands.allow = ["folders_read_sidecar"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-read-sidecar"
|
||||
description = "Denies the folders_read_sidecar command without any pre-configured scope."
|
||||
commands.deny = ["folders_read_sidecar"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-revoke"
|
||||
description = "Enables the folders_revoke command without any pre-configured scope."
|
||||
commands.allow = ["folders_revoke"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-revoke"
|
||||
description = "Denies the folders_revoke command without any pre-configured scope."
|
||||
commands.deny = ["folders_revoke"]
|
||||
@@ -0,0 +1,11 @@
|
||||
# Automatically generated - DO NOT EDIT!
|
||||
|
||||
[[permission]]
|
||||
identifier = "allow-folders-write-sidecar"
|
||||
description = "Enables the folders_write_sidecar command without any pre-configured scope."
|
||||
commands.allow = ["folders_write_sidecar"]
|
||||
|
||||
[[permission]]
|
||||
identifier = "deny-folders-write-sidecar"
|
||||
description = "Denies the folders_write_sidecar command without any pre-configured scope."
|
||||
commands.deny = ["folders_write_sidecar"]
|
||||
@@ -0,0 +1,554 @@
|
||||
//! Folder grants for plugins.
|
||||
//!
|
||||
//! A plugin gets access to a folder outside the workspace only through a grant. The user makes a
|
||||
//! grant with the folder picker, or the host makes one for a `RuneStone <name>` folder in Pictures.
|
||||
//! Each plugin has its own grant list in its retained data (`plugin-data/<id>/folder-grants.json`).
|
||||
//! A grant gives access to the ordinary files directly in its folder. Names with folder parts,
|
||||
//! links, and files that resolve outside the folder are rejected. The plugin cannot supply a path.
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::fsutil::{self, is_link};
|
||||
use crate::plugins::PluginState;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fs;
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
use std::sync::Mutex;
|
||||
use tauri::{AppHandle, Manager, Window};
|
||||
use tauri_plugin_dialog::DialogExt;
|
||||
|
||||
const GRANTS_FILE: &str = "folder-grants.json";
|
||||
const GRANT_LIMIT: usize = 64;
|
||||
const READ_LIMIT: u64 = 64 * 1024 * 1024;
|
||||
const SIDECAR_LIMIT: u64 = 1024 * 1024;
|
||||
const LIST_LIMIT: usize = 10_000;
|
||||
|
||||
/// Serializes changes to grant files and sidecar files.
|
||||
static LOCK: Mutex<()> = Mutex::new(());
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
struct StoredGrant {
|
||||
id: String,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
struct GrantFile {
|
||||
schema: u32,
|
||||
grants: Vec<StoredGrant>,
|
||||
}
|
||||
|
||||
/// What a plugin receives: an opaque ID and the folder path for display.
|
||||
#[derive(Clone, Debug, Serialize, PartialEq)]
|
||||
pub struct FolderGrant {
|
||||
id: String,
|
||||
path: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, PartialEq)]
|
||||
pub struct FolderEntry {
|
||||
name: String,
|
||||
size: u64,
|
||||
}
|
||||
|
||||
impl From<&StoredGrant> for FolderGrant {
|
||||
fn from(grant: &StoredGrant) -> Self {
|
||||
Self {
|
||||
id: grant.id.clone(),
|
||||
path: grant.path.to_string_lossy().into_owned(),
|
||||
name: grant
|
||||
.path
|
||||
.file_name()
|
||||
.map(|name| name.to_string_lossy().into_owned())
|
||||
.unwrap_or_else(|| grant.path.to_string_lossy().into_owned()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The grant lists of all plugins, in the folder that holds the retained plugin data.
|
||||
struct Grants {
|
||||
data: PathBuf,
|
||||
}
|
||||
|
||||
impl Grants {
|
||||
fn plugin_folder(&self, plugin: &str, create: bool) -> Result<PathBuf> {
|
||||
if plugin.is_empty()
|
||||
|| plugin.len() > 128
|
||||
|| !plugin.bytes().all(|byte| byte.is_ascii_lowercase() || byte.is_ascii_digit() || byte == b'.' || byte == b'-')
|
||||
|| !fsutil::is_plain_component(plugin)
|
||||
{
|
||||
return Err("Invalid plugin ID.".into());
|
||||
}
|
||||
let folder = self.data.join(plugin);
|
||||
match fs::symlink_metadata(&folder) {
|
||||
Ok(metadata) if metadata.is_dir() && !is_link(&metadata) => Ok(folder),
|
||||
Ok(_) => Err("The plugin data folder must be an ordinary folder.".into()),
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound && create => {
|
||||
fs::create_dir(&folder)?;
|
||||
Ok(folder)
|
||||
}
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(folder),
|
||||
Err(error) => Err(error.into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn load(&self, plugin: &str) -> Result<Vec<StoredGrant>> {
|
||||
let path = self.plugin_folder(plugin, false)?.join(GRANTS_FILE);
|
||||
let metadata = match fs::symlink_metadata(&path) {
|
||||
Ok(metadata) => metadata,
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(Vec::new()),
|
||||
Err(error) => return Err(error.into()),
|
||||
};
|
||||
if !metadata.is_file() || is_link(&metadata) {
|
||||
return Err("The folder grant list must be an ordinary file.".into());
|
||||
}
|
||||
let Some(bytes) = fsutil::read_to_limit(fsutil::open_entry(&path)?, SIDECAR_LIMIT)? else {
|
||||
return Err("The folder grant list exceeds 1 MiB.".into());
|
||||
};
|
||||
let file: GrantFile = serde_json::from_slice(&bytes)?;
|
||||
if file.schema != 1 {
|
||||
return Err("Unknown folder grant list schema.".into());
|
||||
}
|
||||
Ok(file.grants)
|
||||
}
|
||||
|
||||
fn save(&self, plugin: &str, grants: Vec<StoredGrant>) -> Result<()> {
|
||||
let folder = self.plugin_folder(plugin, true)?;
|
||||
let bytes = serde_json::to_vec_pretty(&GrantFile { schema: 1, grants })?;
|
||||
let temp = folder.join(format!("{GRANTS_FILE}.{}.tmp", uuid::Uuid::new_v4()));
|
||||
Ok(fsutil::replace_file(&folder.join(GRANTS_FILE), &temp, &bytes)?)
|
||||
}
|
||||
|
||||
/// Grant `folder` to `plugin`. Return the existing grant when the plugin already has the folder.
|
||||
fn add(&self, plugin: &str, folder: &Path) -> Result<FolderGrant> {
|
||||
let path = granted_root(folder)?;
|
||||
let _lock = LOCK.lock()?;
|
||||
let mut grants = self.load(plugin)?;
|
||||
if let Some(existing) = grants.iter().find(|grant| grant.path == path) {
|
||||
return Ok(existing.into());
|
||||
}
|
||||
if grants.len() >= GRANT_LIMIT {
|
||||
return Err(format!("A plugin can keep at most {GRANT_LIMIT} folder grants. Remove a grant first.").into());
|
||||
}
|
||||
let grant = StoredGrant { id: uuid::Uuid::new_v4().to_string(), path };
|
||||
let result = FolderGrant::from(&grant);
|
||||
grants.push(grant);
|
||||
self.save(plugin, grants)?;
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn list(&self, plugin: &str) -> Result<Vec<FolderGrant>> {
|
||||
Ok(self.load(plugin)?.iter().map(FolderGrant::from).collect())
|
||||
}
|
||||
|
||||
fn revoke(&self, plugin: &str, id: &str) -> Result<bool> {
|
||||
let _lock = LOCK.lock()?;
|
||||
let mut grants = self.load(plugin)?;
|
||||
let count = grants.len();
|
||||
grants.retain(|grant| grant.id != id);
|
||||
if grants.len() == count {
|
||||
return Ok(false);
|
||||
}
|
||||
self.save(plugin, grants)?;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
/// Return the folder of a grant of this plugin. The folder must still be an ordinary folder
|
||||
/// at the same resolved path, so a folder that became a link does not redirect access.
|
||||
fn resolve(&self, plugin: &str, id: &str) -> Result<PathBuf> {
|
||||
uuid::Uuid::parse_str(id).map_err(|_| Error::new("Invalid folder grant."))?;
|
||||
let grant = self
|
||||
.load(plugin)?
|
||||
.into_iter()
|
||||
.find(|grant| grant.id == id)
|
||||
.ok_or_else(|| Error::new("This plugin has no grant for the folder. Choose the folder again."))?;
|
||||
let metadata = fs::symlink_metadata(&grant.path)
|
||||
.map_err(|_| Error::new("The granted folder is missing. Choose the folder again."))?;
|
||||
if !metadata.is_dir() || is_link(&metadata) || dunce::canonicalize(&grant.path)? != grant.path {
|
||||
return Err("The granted folder changed into a link or a file. Choose the folder again.".into());
|
||||
}
|
||||
Ok(grant.path)
|
||||
}
|
||||
}
|
||||
|
||||
/// Resolve a chosen folder. Reject relative paths, parent segments, files, and whole drives.
|
||||
fn granted_root(folder: &Path) -> Result<PathBuf> {
|
||||
if !folder.is_absolute() || folder.components().any(|part| matches!(part, Component::ParentDir)) {
|
||||
return Err("Supply an absolute folder path without parent segments.".into());
|
||||
}
|
||||
let root = dunce::canonicalize(folder)?;
|
||||
if !root.is_dir() {
|
||||
return Err("The folder does not exist.".into());
|
||||
}
|
||||
if root.parent().is_none() {
|
||||
return Err("Choose a folder, not a whole drive.".into());
|
||||
}
|
||||
Ok(root)
|
||||
}
|
||||
|
||||
/// The path of one ordinary file directly in `root`.
|
||||
fn file_path(root: &Path, name: &str) -> Result<PathBuf> {
|
||||
if !fsutil::is_plain_component(name)
|
||||
|| name.contains(['/', '\\', ':'])
|
||||
|| name.ends_with(' ')
|
||||
|| Path::new(name).components().count() != 1
|
||||
|| !matches!(Path::new(name).components().next(), Some(Component::Normal(_)))
|
||||
{
|
||||
return Err("Supply one file name without folder parts.".into());
|
||||
}
|
||||
Ok(root.join(name))
|
||||
}
|
||||
|
||||
/// Open one ordinary file. Reject links, also a link that replaces the file after the check.
|
||||
fn open_plain(root: &Path, path: &Path) -> Result<(fs::File, u64)> {
|
||||
let metadata = fs::symlink_metadata(path)?;
|
||||
if !metadata.is_file() || is_link(&metadata) {
|
||||
return Err("Granted folder access is limited to ordinary files, not links or folders.".into());
|
||||
}
|
||||
let file = fsutil::open_entry(path)?;
|
||||
let opened = file.metadata()?;
|
||||
if !opened.is_file() || is_link(&opened) || dunce::canonicalize(path)?.parent() != Some(root) {
|
||||
return Err("Granted folder access is limited to ordinary files, not links or folders.".into());
|
||||
}
|
||||
Ok((file, opened.len()))
|
||||
}
|
||||
|
||||
fn list_files(root: &Path) -> Result<Vec<FolderEntry>> {
|
||||
let mut entries = Vec::new();
|
||||
for entry in fs::read_dir(root)? {
|
||||
let entry = entry?;
|
||||
let Some(name) = entry.file_name().to_str().map(str::to_owned) else { continue };
|
||||
let Ok(metadata) = entry.metadata() else { continue };
|
||||
// `DirEntry::metadata` does not follow links.
|
||||
if !metadata.is_file() || is_link(&metadata) || file_path(root, &name).is_err() {
|
||||
continue;
|
||||
}
|
||||
entries.push(FolderEntry { name, size: metadata.len() });
|
||||
if entries.len() > LIST_LIMIT {
|
||||
return Err(format!("The folder has more than {LIST_LIMIT} files.").into());
|
||||
}
|
||||
}
|
||||
entries.sort_by(|a, b| a.name.cmp(&b.name));
|
||||
Ok(entries)
|
||||
}
|
||||
|
||||
fn read_file(root: &Path, name: &str) -> Result<Vec<u8>> {
|
||||
let path = file_path(root, name)?;
|
||||
let (file, size) = open_plain(root, &path)?;
|
||||
if size > READ_LIMIT {
|
||||
return Err("The file exceeds 64 MiB.".into());
|
||||
}
|
||||
fsutil::read_to_limit(file, READ_LIMIT)?.ok_or_else(|| Error::new("The file exceeds 64 MiB."))
|
||||
}
|
||||
|
||||
/// A sidecar is a small JSON file that a plugin keeps beside the user's files, such as
|
||||
/// `.runestone-backgrounds.json`. Its name starts with `.runestone-` and ends with `.json`.
|
||||
fn sidecar_path(root: &Path, name: &str) -> Result<PathBuf> {
|
||||
let stem = name.strip_prefix(".runestone-").and_then(|rest| rest.strip_suffix(".json"));
|
||||
if !stem.is_some_and(|stem| !stem.is_empty() && stem.len() <= 64 && stem.bytes().all(|byte| byte.is_ascii_alphanumeric() || byte == b'-' || byte == b'_')) {
|
||||
return Err("A sidecar file name has the form .runestone-<name>.json.".into());
|
||||
}
|
||||
file_path(root, name)
|
||||
}
|
||||
|
||||
fn read_sidecar(root: &Path, name: &str) -> Result<Option<String>> {
|
||||
let path = sidecar_path(root, name)?;
|
||||
match fs::symlink_metadata(&path) {
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(None),
|
||||
Err(error) => return Err(error.into()),
|
||||
Ok(_) => {}
|
||||
}
|
||||
let (file, size) = open_plain(root, &path)?;
|
||||
if size > SIDECAR_LIMIT {
|
||||
return Err("The sidecar file exceeds 1 MiB.".into());
|
||||
}
|
||||
let bytes = fsutil::read_to_limit(file, SIDECAR_LIMIT)?.ok_or_else(|| Error::new("The sidecar file exceeds 1 MiB."))?;
|
||||
String::from_utf8(bytes).map(Some).map_err(Error::from)
|
||||
}
|
||||
|
||||
/// Save a sidecar only if it still holds `expected` (`None` when the file does not exist).
|
||||
fn write_sidecar(root: &Path, name: &str, contents: &str, expected: Option<&str>) -> Result<()> {
|
||||
let path = sidecar_path(root, name)?;
|
||||
if contents.len() as u64 > SIDECAR_LIMIT {
|
||||
return Err("The sidecar file exceeds 1 MiB.".into());
|
||||
}
|
||||
serde_json::from_str::<serde_json::Value>(contents)?;
|
||||
let _lock = LOCK.lock()?;
|
||||
if read_sidecar(root, name)?.as_deref() != expected {
|
||||
return Err("The sidecar file changed. Read it again before you save.".into());
|
||||
}
|
||||
if expected.is_some() {
|
||||
fsutil::write_text(&path, contents, expected)
|
||||
} else {
|
||||
let temp = root.join(format!(".runestone-sidecar-{}.tmp", uuid::Uuid::new_v4()));
|
||||
Ok(fsutil::create_file(&path, &temp, contents.as_bytes())?)
|
||||
}
|
||||
}
|
||||
|
||||
fn grants(app: &AppHandle) -> Result<Grants> {
|
||||
Ok(Grants { data: app.path().app_data_dir()?.join("plugin-data") })
|
||||
}
|
||||
|
||||
/// Accept only a plugin that is enabled and loaded in the calling window.
|
||||
/// Check the lease on a blocking worker, because the plugin lock can wait for package work.
|
||||
async fn check(app: &AppHandle, window: &Window, plugin: &str) -> Result<()> {
|
||||
let (app, label, plugin) = (app.clone(), window.label().to_owned(), plugin.to_owned());
|
||||
tauri::async_runtime::spawn_blocking(move || app.state::<PluginState>().require_lease(&app, &label, &plugin)).await?
|
||||
}
|
||||
|
||||
/// Check the lease, run `work` on a blocking worker, and check the lease again,
|
||||
/// so that a plugin that stopped during the work receives no result.
|
||||
async fn run<T: Send + 'static>(
|
||||
app: &AppHandle,
|
||||
window: &Window,
|
||||
plugin: &str,
|
||||
work: impl FnOnce(Grants) -> Result<T> + Send + 'static,
|
||||
) -> Result<T> {
|
||||
check(app, window, plugin).await?;
|
||||
let store = grants(app)?;
|
||||
let result = tauri::async_runtime::spawn_blocking(move || work(store)).await??;
|
||||
check(app, window, plugin).await?;
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn folders_choose(app: AppHandle, window: Window, plugin: String, title: Option<String>) -> Result<Option<FolderGrant>> {
|
||||
check(&app, &window, &plugin).await?;
|
||||
let (picker_app, picker_window) = (app.clone(), window.clone());
|
||||
let title = title.filter(|title| !title.trim().is_empty() && title.len() <= 200).unwrap_or_else(|| "Choose a folder".into());
|
||||
let selected = tauri::async_runtime::spawn_blocking(move || {
|
||||
picker_app.dialog().file().set_parent(&picker_window).set_title(title).blocking_pick_folder()
|
||||
})
|
||||
.await?;
|
||||
let Some(selected) = selected else { return Ok(None) };
|
||||
let folder = selected.into_path().map_err(Error::from_display)?;
|
||||
let id = plugin.clone();
|
||||
run(&app, &window, &plugin, move |store| store.add(&id, &folder)).await.map(Some)
|
||||
}
|
||||
|
||||
/// Grant `RuneStone <name>` in the Pictures folder of the user. Create the folder if necessary.
|
||||
#[tauri::command]
|
||||
pub async fn folders_picture(app: AppHandle, window: Window, plugin: String, name: String) -> Result<FolderGrant> {
|
||||
if name.is_empty() || name.len() > 64 || name.starts_with([' ', '-', '_']) || !name.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, ' ' | '-' | '_')) || name.ends_with(' ') {
|
||||
return Err("Supply a folder name with letters, digits, spaces, hyphens, or underscores.".into());
|
||||
}
|
||||
let folder = app.path().picture_dir()?.join(format!("RuneStone {name}"));
|
||||
let id = plugin.clone();
|
||||
run(&app, &window, &plugin, move |store| {
|
||||
fs::create_dir_all(&folder)?;
|
||||
let metadata = fs::symlink_metadata(&folder)?;
|
||||
if !metadata.is_dir() || is_link(&metadata) {
|
||||
return Err("The Pictures folder entry must be an ordinary folder.".into());
|
||||
}
|
||||
store.add(&id, &folder)
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn folders_grants(app: AppHandle, window: Window, plugin: String) -> Result<Vec<FolderGrant>> {
|
||||
let id = plugin.clone();
|
||||
run(&app, &window, &plugin, move |store| store.list(&id)).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn folders_revoke(app: AppHandle, window: Window, plugin: String, grant: String) -> Result<bool> {
|
||||
let id = plugin.clone();
|
||||
run(&app, &window, &plugin, move |store| store.revoke(&id, &grant)).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn folders_list(app: AppHandle, window: Window, plugin: String, grant: String) -> Result<Vec<FolderEntry>> {
|
||||
let id = plugin.clone();
|
||||
run(&app, &window, &plugin, move |store| list_files(&store.resolve(&id, &grant)?)).await
|
||||
}
|
||||
|
||||
/// Return the bytes as an `ArrayBuffer`, not as JSON or base64 text.
|
||||
#[tauri::command]
|
||||
pub async fn folders_read(app: AppHandle, window: Window, plugin: String, grant: String, name: String) -> Result<tauri::ipc::Response> {
|
||||
let id = plugin.clone();
|
||||
let bytes = run(&app, &window, &plugin, move |store| read_file(&store.resolve(&id, &grant)?, &name)).await?;
|
||||
Ok(tauri::ipc::Response::new(bytes))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn folders_read_sidecar(app: AppHandle, window: Window, plugin: String, grant: String, name: String) -> Result<Option<String>> {
|
||||
let id = plugin.clone();
|
||||
run(&app, &window, &plugin, move |store| read_sidecar(&store.resolve(&id, &grant)?, &name)).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn folders_write_sidecar(app: AppHandle, window: Window, plugin: String, grant: String, name: String, contents: String, expected: Option<String>) -> Result<()> {
|
||||
check(&app, &window, &plugin).await?;
|
||||
let store = grants(&app)?;
|
||||
// Check the lease again immediately before the write, on the blocking worker.
|
||||
tauri::async_runtime::spawn_blocking(move || {
|
||||
app.state::<PluginState>().require_lease(&app, window.label(), &plugin)?;
|
||||
write_sidecar(&store.resolve(&plugin, &grant)?, &name, &contents, expected.as_deref())
|
||||
})
|
||||
.await?
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
struct Fixture(PathBuf);
|
||||
impl Fixture {
|
||||
fn new() -> Self {
|
||||
let root = std::env::temp_dir().join(format!("runestone-folders-{}", uuid::Uuid::new_v4()));
|
||||
fs::create_dir(&root).unwrap();
|
||||
Self(dunce::canonicalize(root).unwrap())
|
||||
}
|
||||
fn folder(&self, name: &str) -> PathBuf {
|
||||
let path = self.0.join(name);
|
||||
fs::create_dir_all(&path).unwrap();
|
||||
path
|
||||
}
|
||||
fn store(&self) -> Grants {
|
||||
Grants { data: self.folder("plugin-data") }
|
||||
}
|
||||
}
|
||||
impl Drop for Fixture {
|
||||
fn drop(&mut self) {
|
||||
let _ = fs::remove_dir_all(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
/// Make a link, or return `false` when Windows does not allow links for this user.
|
||||
fn link(original: &Path, link: &Path, folder: bool) -> bool {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let _ = folder;
|
||||
std::os::unix::fs::symlink(original, link).unwrap();
|
||||
true
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let result = if folder {
|
||||
std::os::windows::fs::symlink_dir(original, link)
|
||||
} else {
|
||||
std::os::windows::fs::symlink_file(original, link)
|
||||
};
|
||||
match result {
|
||||
Ok(()) => true,
|
||||
Err(error) if error.raw_os_error() == Some(windows_sys::Win32::Foundation::ERROR_PRIVILEGE_NOT_HELD as i32) => {
|
||||
eprintln!("The link check requires Windows Developer Mode or the symbolic-link privilege.");
|
||||
false
|
||||
}
|
||||
Err(error) => panic!("{error}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grants_persist_per_plugin_and_can_be_revoked() {
|
||||
let fixture = Fixture::new();
|
||||
let images = fixture.folder("images");
|
||||
fs::write(images.join("a.png"), b"png").unwrap();
|
||||
let store = fixture.store();
|
||||
let grant = store.add("org.test.one", &images).unwrap();
|
||||
assert_eq!(grant.path, images.to_string_lossy());
|
||||
assert_eq!(grant.name, "images");
|
||||
// The same folder gives the same grant.
|
||||
assert_eq!(store.add("org.test.one", &images).unwrap().id, grant.id);
|
||||
// A new store reads the saved grants, as after a restart.
|
||||
let reopened = fixture.store();
|
||||
assert_eq!(reopened.list("org.test.one").unwrap(), vec![grant.clone()]);
|
||||
assert_eq!(read_file(&reopened.resolve("org.test.one", &grant.id).unwrap(), "a.png").unwrap(), b"png");
|
||||
// Another plugin cannot use the grant ID of the first plugin.
|
||||
assert!(reopened.resolve("org.test.two", &grant.id).is_err());
|
||||
assert!(reopened.list("org.test.two").unwrap().is_empty());
|
||||
assert!(!reopened.revoke("org.test.two", &grant.id).unwrap());
|
||||
assert!(reopened.resolve("org.test.one", &grant.id).is_ok());
|
||||
assert!(reopened.revoke("org.test.one", &grant.id).unwrap());
|
||||
assert!(reopened.resolve("org.test.one", &grant.id).is_err());
|
||||
assert!(reopened.list("org.test.one").unwrap().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn grants_reject_invalid_plugins_ids_and_folders() {
|
||||
let fixture = Fixture::new();
|
||||
let store = fixture.store();
|
||||
let folder = fixture.folder("images");
|
||||
for plugin in ["", "..", "../escape", "Upper", "a/b", "a\\b", "con"] {
|
||||
assert!(store.add(plugin, &folder).is_err(), "{plugin}");
|
||||
}
|
||||
assert!(store.add("org.test.one", Path::new("relative")).is_err());
|
||||
assert!(store.add("org.test.one", &folder.join("..").join("images")).is_err());
|
||||
assert!(store.add("org.test.one", &fixture.0.join("missing")).is_err());
|
||||
fs::write(fixture.0.join("file.txt"), "x").unwrap();
|
||||
assert!(store.add("org.test.one", &fixture.0.join("file.txt")).is_err());
|
||||
let drive = folder.ancestors().last().unwrap().to_path_buf();
|
||||
assert!(store.add("org.test.one", &drive).is_err());
|
||||
assert!(store.resolve("org.test.one", "not-a-uuid").is_err());
|
||||
assert!(store.resolve("org.test.one", &uuid::Uuid::new_v4().to_string()).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn names_cannot_leave_the_granted_folder() {
|
||||
let fixture = Fixture::new();
|
||||
let root = fixture.folder("images");
|
||||
fs::write(fixture.0.join("secret.txt"), "secret").unwrap();
|
||||
fixture.folder("images/nested");
|
||||
fs::write(root.join("nested/inner.png"), "inner").unwrap();
|
||||
for name in ["../secret.txt", "..", ".", "nested/inner.png", "nested\\inner.png", "C:\\secret.txt", "/secret.txt", "a.png:stream", "", "nul", "trailing."] {
|
||||
assert!(read_file(&root, name).is_err(), "{name}");
|
||||
}
|
||||
assert!(read_file(&root, "nested").is_err(), "a folder is not a file");
|
||||
fs::write(root.join("b.txt"), "b").unwrap();
|
||||
fs::write(root.join("a.png"), "a").unwrap();
|
||||
assert_eq!(list_files(&root).unwrap(), vec![FolderEntry { name: "a.png".into(), size: 1 }, FolderEntry { name: "b.txt".into(), size: 1 }]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn links_are_rejected() {
|
||||
let fixture = Fixture::new();
|
||||
let root = fixture.folder("images");
|
||||
let outside = fixture.folder("outside");
|
||||
fs::write(outside.join("secret.png"), "secret").unwrap();
|
||||
if !link(&outside.join("secret.png"), &root.join("link.png"), false) {
|
||||
return;
|
||||
}
|
||||
assert!(list_files(&root).unwrap().is_empty(), "the listing skips links");
|
||||
assert!(read_file(&root, "link.png").is_err());
|
||||
// A granted folder that is replaced by a link loses its access.
|
||||
let store = fixture.store();
|
||||
let moved = fixture.folder("moved");
|
||||
let grant = store.add("org.test.one", &moved).unwrap();
|
||||
fs::remove_dir(&moved).unwrap();
|
||||
assert!(link(&outside, &moved, true));
|
||||
assert!(store.resolve("org.test.one", &grant.id).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_have_a_size_limit() {
|
||||
let fixture = Fixture::new();
|
||||
let root = fixture.folder("images");
|
||||
fs::File::create(root.join("large.bin")).unwrap().set_len(READ_LIMIT + 1).unwrap();
|
||||
assert!(read_file(&root, "large.bin").unwrap_err().to_string().contains("64 MiB"));
|
||||
fs::File::create(root.join(".runestone-large.json")).unwrap().set_len(SIDECAR_LIMIT + 1).unwrap();
|
||||
assert!(read_sidecar(&root, ".runestone-large.json").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sidecars_keep_external_changes_and_accept_only_sidecar_names() {
|
||||
let fixture = Fixture::new();
|
||||
let root = fixture.folder("images");
|
||||
let name = ".runestone-backgrounds.json";
|
||||
let first = r#"{"schema":1,"images":{}}"#;
|
||||
let next = r#"{"schema":1,"images":{"a.png":{}}}"#;
|
||||
assert_eq!(read_sidecar(&root, name).unwrap(), None);
|
||||
write_sidecar(&root, name, first, None).unwrap();
|
||||
assert!(write_sidecar(&root, name, next, None).is_err());
|
||||
assert!(write_sidecar(&root, name, next, Some("stale")).is_err());
|
||||
write_sidecar(&root, name, next, Some(first)).unwrap();
|
||||
assert_eq!(read_sidecar(&root, name).unwrap().as_deref(), Some(next));
|
||||
assert!(write_sidecar(&root, name, "not json", Some(next)).is_err());
|
||||
assert!(write_sidecar(&root, name, &format!("\"{}\"", "x".repeat(SIDECAR_LIMIT as usize)), Some(next)).is_err());
|
||||
for bad in ["a.png", "settings.json", ".runestone-.json", ".runestone-a/b.json", ".runestone-a.json.png", "../.runestone-a.json"] {
|
||||
assert!(write_sidecar(&root, bad, "{}", None).is_err(), "{bad}");
|
||||
assert!(read_sidecar(&root, bad).is_err(), "{bad}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ mod tab_transfer;
|
||||
mod spelling;
|
||||
mod theme;
|
||||
mod backgrounds;
|
||||
mod folders;
|
||||
|
||||
use pty::PtyState;
|
||||
use tauri::Manager;
|
||||
@@ -39,6 +40,14 @@ pub fn run() {
|
||||
backgrounds::backgrounds_read,
|
||||
backgrounds::backgrounds_read_image_settings,
|
||||
backgrounds::backgrounds_write_image_settings,
|
||||
folders::folders_choose,
|
||||
folders::folders_picture,
|
||||
folders::folders_grants,
|
||||
folders::folders_revoke,
|
||||
folders::folders_list,
|
||||
folders::folders_read,
|
||||
folders::folders_read_sidecar,
|
||||
folders::folders_write_sidecar,
|
||||
theme::theme_export,
|
||||
spelling::spelling_menu_install,
|
||||
spelling::spelling_suggestions,
|
||||
|
||||
+109
-37
@@ -6,6 +6,7 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use portable_pty::{native_pty_system, CommandBuilder, MasterPty, PtySize};
|
||||
use serde::Serialize;
|
||||
use tauri::ipc::{Channel, InvokeResponseBody, JavaScriptChannelId};
|
||||
use tauri::{AppHandle, Emitter, Manager, State};
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
@@ -72,6 +73,63 @@ pub struct PtyExit {
|
||||
pub code: Option<u32>,
|
||||
}
|
||||
|
||||
/// The destination of the output and the exit status of one terminal session.
|
||||
trait PtyOutput: Send {
|
||||
fn data(&self, bytes: &[u8]);
|
||||
fn exit(&self, code: Option<u32>);
|
||||
}
|
||||
|
||||
/// Window events for the released Terminal plugin, which listens for `pty-data` and `pty-exit`.
|
||||
/// The events go to the window that opened the session. A global `listen` in that window
|
||||
/// receives them. Tauri 2 also delivers an addressed event to a global `listen` in other windows.
|
||||
struct EventOutput {
|
||||
app: AppHandle,
|
||||
owner: String,
|
||||
id: String,
|
||||
}
|
||||
|
||||
impl PtyOutput for EventOutput {
|
||||
fn data(&self, bytes: &[u8]) {
|
||||
let _ = self.app.emit_to(self.owner.as_str(), "pty-data", PtyData { id: self.id.clone(), data: bytes.to_vec() });
|
||||
}
|
||||
fn exit(&self, code: Option<u32>) {
|
||||
let _ = self.app.emit_to(self.owner.as_str(), "pty-exit", PtyExit { id: self.id.clone(), code });
|
||||
}
|
||||
}
|
||||
|
||||
/// A channel to the webview that opened the session. Output goes as raw bytes (an
|
||||
/// `ArrayBuffer` in JavaScript). The exit status goes as `{ "exit": code }`.
|
||||
struct ChannelOutput(Channel<InvokeResponseBody>);
|
||||
|
||||
impl PtyOutput for ChannelOutput {
|
||||
fn data(&self, bytes: &[u8]) {
|
||||
let _ = self.0.send(InvokeResponseBody::Raw(bytes.to_vec()));
|
||||
}
|
||||
fn exit(&self, code: Option<u32>) {
|
||||
let _ = self.0.send(InvokeResponseBody::Json(serde_json::json!({ "exit": code }).to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
/// Use the channel when the caller supplies one. Without a channel, use window events.
|
||||
fn output(channel: Option<Channel<InvokeResponseBody>>, events: impl FnOnce() -> Box<dyn PtyOutput>) -> Box<dyn PtyOutput> {
|
||||
match channel {
|
||||
Some(channel) => Box::new(ChannelOutput(channel)),
|
||||
None => events(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Send the output until the reader reaches EOF. Then send the exit status.
|
||||
fn pump(mut reader: impl Read, exit: std::sync::mpsc::Receiver<Option<u32>>, output: &dyn PtyOutput) {
|
||||
let mut buf = [0u8; 4096];
|
||||
loop {
|
||||
match reader.read(&mut buf) {
|
||||
Ok(0) | Err(_) => break,
|
||||
Ok(n) => output.data(&buf[..n]),
|
||||
}
|
||||
}
|
||||
output.exit(exit.recv().ok().flatten());
|
||||
}
|
||||
|
||||
type ShellProcess = (
|
||||
OpenPty,
|
||||
Box<dyn Read + Send>,
|
||||
@@ -223,6 +281,7 @@ fn spawn_shell(root: &Path, cols: u16, rows: u16, profile: Option<&str>, owner:
|
||||
pub async fn pty_open(
|
||||
app: AppHandle,
|
||||
window: tauri::Window,
|
||||
webview: tauri::Webview,
|
||||
workspace: State<'_, WorkspaceState>,
|
||||
id: String,
|
||||
cols: u16,
|
||||
@@ -230,13 +289,16 @@ pub async fn pty_open(
|
||||
cwd: String,
|
||||
profile: Option<String>,
|
||||
directory: Option<String>,
|
||||
channel: Option<JavaScriptChannelId>,
|
||||
) -> Result<()> {
|
||||
let root = current_root(&workspace, window.label())?;
|
||||
if root.to_string_lossy() != cwd {
|
||||
return Err(Error::new("workspace changed before the terminal started"));
|
||||
}
|
||||
let owner = window.label().to_owned();
|
||||
tauri::async_runtime::spawn_blocking(move || open(app, owner, root, id, cols, rows, profile, directory)).await?
|
||||
// A session with a channel sends no `pty-data` or `pty-exit` events.
|
||||
let channel = channel.map(|channel| channel.channel_on(webview));
|
||||
tauri::async_runtime::spawn_blocking(move || open(app, owner, root, id, cols, rows, profile, directory, channel)).await?
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@@ -249,6 +311,7 @@ fn open(
|
||||
rows: u16,
|
||||
profile: Option<String>,
|
||||
directory: Option<String>,
|
||||
channel: Option<Channel<InvokeResponseBody>>,
|
||||
) -> Result<()> {
|
||||
let pty = app.state::<PtyState>();
|
||||
let mut guard = pty.inner.lock().map_err(|_| Error::new("pty lock"))?;
|
||||
@@ -257,7 +320,7 @@ fn open(
|
||||
}
|
||||
let directory = directory.map(PathBuf::from).unwrap_or(root);
|
||||
if !directory.is_dir() { return Err(Error::new("Terminal working directory does not exist")); }
|
||||
let (session, mut reader, mut child) = spawn_shell(&directory, cols, rows, profile.as_deref(), &owner)?;
|
||||
let (session, reader, mut child) = spawn_shell(&directory, cols, rows, profile.as_deref(), &owner)?;
|
||||
guard.insert(id.clone(), session);
|
||||
drop(guard);
|
||||
let (exit_tx, exit_rx) = std::sync::mpsc::channel();
|
||||
@@ -275,41 +338,8 @@ fn open(
|
||||
drop(session);
|
||||
let _ = exit_tx.send(code);
|
||||
});
|
||||
let app_reader = app.clone();
|
||||
let reader_id = id.clone();
|
||||
thread::spawn(move || {
|
||||
let mut buf = [0u8; 4096];
|
||||
// Address the terminal events to the window that opened the session.
|
||||
// A global `listen` in that window receives them. Tauri 2 also delivers an addressed
|
||||
// event to a global `listen` in other windows. A listener with a window target does not
|
||||
// receive the events of other windows.
|
||||
loop {
|
||||
match reader.read(&mut buf) {
|
||||
Ok(0) => break,
|
||||
Ok(n) => {
|
||||
let data = buf[..n].to_vec();
|
||||
let _ = app_reader.emit_to(
|
||||
owner.as_str(),
|
||||
"pty-data",
|
||||
PtyData {
|
||||
id: reader_id.clone(),
|
||||
data,
|
||||
},
|
||||
);
|
||||
}
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
let code = exit_rx.recv().ok().flatten();
|
||||
let _ = app_reader.emit_to(
|
||||
owner.as_str(),
|
||||
"pty-exit",
|
||||
PtyExit {
|
||||
id: reader_id,
|
||||
code,
|
||||
},
|
||||
);
|
||||
});
|
||||
let output = output(channel, || Box::new(EventOutput { app: app.clone(), owner, id }));
|
||||
thread::spawn(move || pump(reader, exit_rx, output.as_ref()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -403,8 +433,50 @@ pub fn pty_dictation() -> Result<()> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// Records the window events that a session would send.
|
||||
struct FakeEvents(Arc<Mutex<Vec<String>>>);
|
||||
impl PtyOutput for FakeEvents {
|
||||
fn data(&self, bytes: &[u8]) { self.0.lock().unwrap().push(format!("pty-data {}", String::from_utf8_lossy(bytes))); }
|
||||
fn exit(&self, code: Option<u32>) { self.0.lock().unwrap().push(format!("pty-exit {code:?}")); }
|
||||
}
|
||||
|
||||
fn run_pump(channel: Option<Channel<InvokeResponseBody>>, events: Arc<Mutex<Vec<String>>>) {
|
||||
let (exit_tx, exit_rx) = std::sync::mpsc::channel();
|
||||
exit_tx.send(Some(3)).unwrap();
|
||||
let output = output(channel, move || Box::new(FakeEvents(events)));
|
||||
pump(std::io::Cursor::new(b"hello \xce\xbb".to_vec()), exit_rx, output.as_ref());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_channel_session_sends_raw_bytes_and_no_window_events() {
|
||||
let events = Arc::new(Mutex::new(Vec::new()));
|
||||
let received = Arc::new(Mutex::new(Vec::new()));
|
||||
let sink = received.clone();
|
||||
let channel = Channel::new(move |body| { sink.lock().unwrap().push(body); Ok(()) });
|
||||
run_pump(Some(channel), events.clone());
|
||||
assert!(events.lock().unwrap().is_empty(), "a channel session must not send pty-data or pty-exit events");
|
||||
let received = received.lock().unwrap();
|
||||
assert_eq!(received.len(), 2);
|
||||
match &received[0] {
|
||||
InvokeResponseBody::Raw(bytes) => assert_eq!(bytes, b"hello \xce\xbb"),
|
||||
InvokeResponseBody::Json(json) => panic!("output must be raw bytes, not JSON: {json}"),
|
||||
}
|
||||
match &received[1] {
|
||||
InvokeResponseBody::Json(json) => assert_eq!(serde_json::from_str::<serde_json::Value>(json).unwrap(), serde_json::json!({ "exit": 3 })),
|
||||
InvokeResponseBody::Raw(_) => panic!("the exit status must be JSON"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_session_without_a_channel_keeps_the_window_events() {
|
||||
let events = Arc::new(Mutex::new(Vec::new()));
|
||||
run_pump(None, events.clone());
|
||||
assert_eq!(*events.lock().unwrap(), vec!["pty-data hello λ".to_owned(), "pty-exit Some(3)".to_owned()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installed_profiles_start_and_report_shell_prompts() {
|
||||
let root = dunce::canonicalize(std::env::current_dir().unwrap()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user