APIShardX Launcher APITrash

Trash

列出已删除的个人资料

GEThttp://127.0.0.1:40325/trash

返回由 DELETE /profiles/{id} 存档的配置文件(最新的在前)及其恢复到期时间。启动器启动时,过期的条目将被删除。

Authorizations
bearerAuth
Authorizationstringrequired

来自 Settings → Automation API 的永久 JWT。

Responses
200回收站内容。application/json
idstring · uuidoptional
namestringoptional
folderstringoptional
deleted_atinteger · int64optional

Unix 秒。

expires_atinteger · int64optional

Unix 秒;启动扫描会删除所有过去的内容。

size_bytesinteger · int64optional

存档,保存帐户而不是缓存。

401缺失或无效的 Bearer 令牌。
GET/trash
GET /trash HTTP/1.1
Host: 127.0.0.1:40325
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
curl -X GET 'http://127.0.0.1:40325/trash' \
  -H 'Authorization: Bearer YOUR_SECRET_TOKEN'
import requests

# 来自 Settings → Automation API 的永久 JWT。
token = "YOUR_SECRET_TOKEN"

url = "http://127.0.0.1:40325/trash"
headers = {
    "Authorization": f"Bearer {token}",
}

response = requests.get(url, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)
// 来自 Settings → Automation API 的永久 JWT。
const token = "YOUR_SECRET_TOKEN";

const url = "http://127.0.0.1:40325/trash";

const response = await fetch(url, {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${token}`,
  },
});

console.log(response.status);
console.log(await response.text());
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	// 来自 Settings → Automation API 的永久 JWT。
	token := "YOUR_SECRET_TOKEN"

	url := "http://127.0.0.1:40325/trash"

	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Authorization", "Bearer "+token)

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	out, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp.Status)
	fmt.Println(string(out))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 来自 Settings → Automation API 的永久 JWT。
    let token = "YOUR_SECRET_TOKEN";

    let client = reqwest::Client::new();
    let response = client
        .get("http://127.0.0.1:40325/trash")
        .header("Authorization", format!("Bearer {token}"))
        .send()
        .await?;

    println!("{}", response.status());
    println!("{}", response.text().await?);
    Ok(())
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        // 来自 Settings → Automation API 的永久 JWT。
        var token = "YOUR_SECRET_TOKEN";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

        var request = new HttpRequestMessage(HttpMethod.Get, "http://127.0.0.1:40325/trash");

        var response = await client.SendAsync(request);
        Console.WriteLine((int)response.StatusCode);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>

#include <iostream>
#include <string>

static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
    static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
    return size * nmemb;
}

int main() {
    // 来自 Settings → Automation API 的永久 JWT。
    const std::string token = "YOUR_SECRET_TOKEN";

    curl_global_init(CURL_GLOBAL_DEFAULT);
    CURL *curl = curl_easy_init();
    if (!curl) {
        std::cerr << "curl_easy_init failed\n";
        curl_global_cleanup();
        return 1;
    }

    struct curl_slist *headers = nullptr;
    headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());

    std::string response;
    curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:40325/trash");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);

    const CURLcode rc = curl_easy_perform(curl);
    if (rc != CURLE_OK) {
        std::cerr << curl_easy_strerror(rc) << "\n";
    } else {
        long status = 0;
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
        std::cout << status << "\n" << response << "\n";
    }

    curl_slist_free_all(headers);
    curl_easy_cleanup(curl);
    curl_global_cleanup();
    return rc == CURLE_OK ? 0 : 1;
}
200回收站内容。
[
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "text",
    "folder": "text",
    "deleted_at": 1,
    "expires_at": 1,
    "size_bytes": 1
  }
]

恢复已删除的个人资料

POSThttp://127.0.0.1:40325/trash/{id}/restore

使用配置文件的原始 ID恢复它,因此引用该配置文件的脚本、书签文件夹或代理绑定仍然有效。恢复后会删除归档。

会恢复账户数据、cookies、登录信息、网页数据、偏好设置、历史记录、书签、Local Storage 和 IndexedDB。缓存不会被归档,会在下次启动时重新生成。

Authorizations
bearerAuth
Authorizationstringrequired

来自 Settings → Automation API 的永久 JWT。

Path parameters
idstring · uuidrequired
Responses
200恢复的个人资料。application/json

启动器中配置文件的元数据(创建时返回)。

idstring · uuidoptional
namestringoptional
notesstringoptional
proxy_idstring· nullableoptional
last_launched_atstring· nullableoptional

ISO-8601 或 null。

created_atstring· nullableoptional
pinnedbooleanoptional
folderstringoptional
colorstring· nullableoptional

图标强调色,格式为 #rrggbb;null 表示根据名称自动生成颜色,这是浏览器在未选择颜色时的默认行为。

extensionsstring[]optional

启动时加载的扩展库 ID。

401缺失或无效的 Bearer 令牌。
404没有使用此 ID 的已删除配置文件。application/json
errorstringrequired
POST/trash/123e4567-e89b-12d3-a456-426614174000/restore
POST /trash/123e4567-e89b-12d3-a456-426614174000/restore HTTP/1.1
Host: 127.0.0.1:40325
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
curl -X POST 'http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore' \
  -H 'Authorization: Bearer YOUR_SECRET_TOKEN'
import requests

# 来自 Settings → Automation API 的永久 JWT。
token = "YOUR_SECRET_TOKEN"

url = "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore"
headers = {
    "Authorization": f"Bearer {token}",
}

response = requests.post(url, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)
// 来自 Settings → Automation API 的永久 JWT。
const token = "YOUR_SECRET_TOKEN";

const url = "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore";

const response = await fetch(url, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${token}`,
  },
});

console.log(response.status);
console.log(await response.text());
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	// 来自 Settings → Automation API 的永久 JWT。
	token := "YOUR_SECRET_TOKEN"

	url := "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore"

	req, err := http.NewRequest("POST", url, nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Authorization", "Bearer "+token)

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	out, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp.Status)
	fmt.Println(string(out))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 来自 Settings → Automation API 的永久 JWT。
    let token = "YOUR_SECRET_TOKEN";

    let client = reqwest::Client::new();
    let response = client
        .post("http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore")
        .header("Authorization", format!("Bearer {token}"))
        .send()
        .await?;

    println!("{}", response.status());
    println!("{}", response.text().await?);
    Ok(())
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        // 来自 Settings → Automation API 的永久 JWT。
        var token = "YOUR_SECRET_TOKEN";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

        var request = new HttpRequestMessage(HttpMethod.Post, "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore");

        var response = await client.SendAsync(request);
        Console.WriteLine((int)response.StatusCode);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>

#include <iostream>
#include <string>

static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
    static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
    return size * nmemb;
}

int main() {
    // 来自 Settings → Automation API 的永久 JWT。
    const std::string token = "YOUR_SECRET_TOKEN";

    curl_global_init(CURL_GLOBAL_DEFAULT);
    CURL *curl = curl_easy_init();
    if (!curl) {
        std::cerr << "curl_easy_init failed\n";
        curl_global_cleanup();
        return 1;
    }

    struct curl_slist *headers = nullptr;
    headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());

    std::string response;
    curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000/restore");
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);

    const CURLcode rc = curl_easy_perform(curl);
    if (rc != CURLE_OK) {
        std::cerr << curl_easy_strerror(rc) << "\n";
    } else {
        long status = 0;
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
        std::cout << status << "\n" << response << "\n";
    }

    curl_slist_free_all(headers);
    curl_easy_cleanup(curl);
    curl_global_cleanup();
    return rc == CURLE_OK ? 0 : 1;
}
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "text",
  "notes": "text",
  "proxy_id": "text",
  "last_launched_at": "text",
  "created_at": "text",
  "pinned": true,
  "folder": "text",
  "color": "text",
  "extensions": [
    "text"
  ]
}
{
  "error": "text"
}

永久删除已废弃的个人资料

DELhttp://127.0.0.1:40325/trash/{id}

此操作不可逆,归档是唯一剩余副本。

Authorizations
bearerAuth
Authorizationstringrequired

来自 Settings → Automation API 的永久 JWT。

Path parameters
idstring · uuidrequired
Responses
200净化了。application/json
purgedbooleanoptional
idstring · uuidoptional
401缺失或无效的 Bearer 令牌。
DEL/trash/123e4567-e89b-12d3-a456-426614174000
DELETE /trash/123e4567-e89b-12d3-a456-426614174000 HTTP/1.1
Host: 127.0.0.1:40325
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
curl -X DELETE 'http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000' \
  -H 'Authorization: Bearer YOUR_SECRET_TOKEN'
import requests

# 来自 Settings → Automation API 的永久 JWT。
token = "YOUR_SECRET_TOKEN"

url = "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000"
headers = {
    "Authorization": f"Bearer {token}",
}

response = requests.delete(url, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)
// 来自 Settings → Automation API 的永久 JWT。
const token = "YOUR_SECRET_TOKEN";

const url = "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000";

const response = await fetch(url, {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${token}`,
  },
});

console.log(response.status);
console.log(await response.text());
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	// 来自 Settings → Automation API 的永久 JWT。
	token := "YOUR_SECRET_TOKEN"

	url := "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000"

	req, err := http.NewRequest("DELETE", url, nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Authorization", "Bearer "+token)

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	out, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp.Status)
	fmt.Println(string(out))
}
// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 来自 Settings → Automation API 的永久 JWT。
    let token = "YOUR_SECRET_TOKEN";

    let client = reqwest::Client::new();
    let response = client
        .delete("http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000")
        .header("Authorization", format!("Bearer {token}"))
        .send()
        .await?;

    println!("{}", response.status());
    println!("{}", response.text().await?);
    Ok(())
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        // 来自 Settings → Automation API 的永久 JWT。
        var token = "YOUR_SECRET_TOKEN";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

        var request = new HttpRequestMessage(HttpMethod.Delete, "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000");

        var response = await client.SendAsync(request);
        Console.WriteLine((int)response.StatusCode);
        Console.WriteLine(await response.Content.ReadAsStringAsync());
    }
}
// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>

#include <iostream>
#include <string>

static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
    static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
    return size * nmemb;
}

int main() {
    // 来自 Settings → Automation API 的永久 JWT。
    const std::string token = "YOUR_SECRET_TOKEN";

    curl_global_init(CURL_GLOBAL_DEFAULT);
    CURL *curl = curl_easy_init();
    if (!curl) {
        std::cerr << "curl_easy_init failed\n";
        curl_global_cleanup();
        return 1;
    }

    struct curl_slist *headers = nullptr;
    headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());

    std::string response;
    curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:40325/trash/123e4567-e89b-12d3-a456-426614174000");
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);

    const CURLcode rc = curl_easy_perform(curl);
    if (rc != CURLE_OK) {
        std::cerr << curl_easy_strerror(rc) << "\n";
    } else {
        long status = 0;
        curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
        std::cout << status << "\n" << response << "\n";
    }

    curl_slist_free_all(headers);
    curl_easy_cleanup(curl);
    curl_global_cleanup();
    return rc == CURLE_OK ? 0 : 1;
}
200净化了。
{
  "purged": true,
  "id": "123e4567-e89b-12d3-a456-426614174000"
}

最后更新

本页内容