From 39f536644a7238f48ca196c125eadf0275e18227 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:33 +0800 Subject: [PATCH 01/11] feat: add app-dialog store for programmatic alert/confirm Introduces useAppDialog() hook backed by a Zustand queue. Supports Promise-based alert() and confirm() with variant styling (default/destructive) so callers can await user interaction instead of blocking on window.alert/confirm. --- src/stores/app-dialog-store.ts | 109 +++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 src/stores/app-dialog-store.ts diff --git a/src/stores/app-dialog-store.ts b/src/stores/app-dialog-store.ts new file mode 100644 index 00000000..9616339f --- /dev/null +++ b/src/stores/app-dialog-store.ts @@ -0,0 +1,109 @@ +import { create } from "zustand" + +type DialogButtonVariant = "default" | "destructive" + +interface AppAlertOptions { + title?: string + message: string + confirmLabel?: string + confirmVariant?: DialogButtonVariant +} + +interface AppConfirmOptions extends AppAlertOptions { + cancelLabel?: string +} + +interface AlertDialogRequest extends Required { + id: number + kind: "alert" + resolve: () => void +} + +interface ConfirmDialogRequest extends Required { + id: number + kind: "confirm" + resolve: (confirmed: boolean) => void +} + +export type AppDialogRequest = AlertDialogRequest | ConfirmDialogRequest + +interface AppDialogStoreState { + queue: AppDialogRequest[] + alert: (options: AppAlertOptions) => Promise + confirm: (options: AppConfirmOptions) => Promise + dismissCurrent: (confirmed?: boolean) => void +} + +let nextDialogId = 1 + +function buildAlertRequest( + options: AppAlertOptions, + resolve: () => void, +): AlertDialogRequest { + return { + id: nextDialogId++, + kind: "alert", + title: options.title ?? "Notice", + message: options.message, + confirmLabel: options.confirmLabel ?? "OK", + confirmVariant: options.confirmVariant ?? "default", + resolve, + } +} + +function buildConfirmRequest( + options: AppConfirmOptions, + resolve: (confirmed: boolean) => void, +): ConfirmDialogRequest { + return { + id: nextDialogId++, + kind: "confirm", + title: options.title ?? "Confirm", + message: options.message, + confirmLabel: options.confirmLabel ?? "Confirm", + cancelLabel: options.cancelLabel ?? "Cancel", + confirmVariant: options.confirmVariant ?? "default", + resolve, + } +} + +export const useAppDialogStore = create((set) => ({ + queue: [], + alert: (options) => + new Promise((resolve) => { + set((state) => ({ + queue: [...state.queue, buildAlertRequest(options, resolve)], + })) + }), + confirm: (options) => + new Promise((resolve) => { + set((state) => ({ + queue: [...state.queue, buildConfirmRequest(options, resolve)], + })) + }), + dismissCurrent: (confirmed = false) => { + let current: AppDialogRequest | undefined + + set((state) => { + current = state.queue[0] + if (!current) return state + return { queue: state.queue.slice(1) } + }) + + if (!current) return + + if (current.kind === "confirm") { + current.resolve(confirmed) + return + } + + current.resolve() + }, +})) + +export function useAppDialog() { + const alert = useAppDialogStore((s) => s.alert) + const confirm = useAppDialogStore((s) => s.confirm) + + return { alert, confirm } +} From a06059a8dcfe43959dbbff176d6348f42ea13dfc Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:36 +0800 Subject: [PATCH 02/11] feat: add AppDialogHost component Global dialog renderer that consumes the app-dialog store queue. Mounts once in App.tsx and serially displays alert/confirm dialogs using the existing shadcn/ui Dialog primitive. --- src/components/ui/app-dialog-host.tsx | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/components/ui/app-dialog-host.tsx diff --git a/src/components/ui/app-dialog-host.tsx b/src/components/ui/app-dialog-host.tsx new file mode 100644 index 00000000..489c079c --- /dev/null +++ b/src/components/ui/app-dialog-host.tsx @@ -0,0 +1,51 @@ +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog" +import { Button } from "@/components/ui/button" +import { useAppDialogStore } from "@/stores/app-dialog-store" + +export function AppDialogHost() { + const dialog = useAppDialogStore((s) => s.queue[0] ?? null) + const dismissCurrent = useAppDialogStore((s) => s.dismissCurrent) + + return ( + { + if (!open && dialog) dismissCurrent(false) + }} + > + {dialog && ( + + + {dialog.title} + + {dialog.message} + + + + {dialog.kind === "confirm" && ( + + )} + + + + )} + + ) +} From f863fcd3cef880e0c41a9a24dd24f3d339b7b892 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:44 +0800 Subject: [PATCH 03/11] refactor(App): replace window.alert with app-dialog Mounts AppDialogHost in all three render paths (loading, welcome, project) and replaces the two window.alert calls with await alert() for consistent dialog styling. --- src/App.tsx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 8f52d531..2061a935 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,8 @@ import { startClipWatcher } from "@/lib/clip-watcher" import { AppLayout } from "@/components/layout/app-layout" import { WelcomeScreen } from "@/components/project/welcome-screen" import { CreateProjectDialog } from "@/components/project/create-project-dialog" +import { AppDialogHost } from "@/components/ui/app-dialog-host" +import { useAppDialog } from "@/stores/app-dialog-store" import type { WikiProject } from "@/types/wiki" function App() { @@ -22,6 +24,7 @@ function App() { const setActiveView = useWikiStore((s) => s.setActiveView) const [showCreateDialog, setShowCreateDialog] = useState(false) const [loading, setLoading] = useState(true) + const { alert } = useAppDialog() // Set up auto-save and clip watcher once on mount useEffect(() => { @@ -394,7 +397,10 @@ function App() { const validated = await openProject(proj.path) await handleProjectOpened(validated) } catch (err) { - window.alert(`Failed to open project: ${err}`) + await alert({ + title: "Failed to Open Project", + message: `Failed to open project: ${err}`, + }) } } @@ -409,7 +415,10 @@ function App() { const proj = await openProject(selected) await handleProjectOpened(proj) } catch (err) { - window.alert(`Failed to open project: ${err}`) + await alert({ + title: "Failed to Open Project", + message: `Failed to open project: ${err}`, + }) } } @@ -437,9 +446,12 @@ function App() { if (loading) { return ( -
- Loading... -
+ <> +
+ Loading... +
+ + ) } @@ -456,6 +468,7 @@ function App() { onOpenChange={setShowCreateDialog} onCreated={handleProjectOpened} /> + ) } @@ -468,6 +481,7 @@ function App() { onOpenChange={setShowCreateDialog} onCreated={handleProjectOpened} /> + ) } From cd685b2aa22f5dc1fc5c822952192c8dcbdb0065 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:46 +0800 Subject: [PATCH 04/11] refactor(activity-panel): replace window.confirm with app-dialog Converts handleCancelAll to async and replaces window.confirm with await confirm() using destructive variant for cancel operations. --- src/components/layout/activity-panel.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/layout/activity-panel.tsx b/src/components/layout/activity-panel.tsx index ecd4ef6a..5e5a3427 100644 --- a/src/components/layout/activity-panel.tsx +++ b/src/components/layout/activity-panel.tsx @@ -24,6 +24,7 @@ import { type FileChangeTask, } from "@/commands/file-sync" import { inferWikiTypeFromPath, wikiTypeLabel } from "@/lib/wiki-page-types" +import { useAppDialog } from "@/stores/app-dialog-store" const FILE_TYPE_ICONS: Record = { sources: BookOpen, @@ -74,6 +75,7 @@ export function ActivityPanel() { const fileSyncTasks = useFileSyncStore((s) => s.tasks) const setFileSyncTasks = useFileSyncStore((s) => s.setTasks) const fileSyncError = useFileSyncStore((s) => s.lastError) + const { confirm } = useAppDialog() const [expanded, setExpanded] = useState(false) const [queueTasks, setQueueTasks] = useState([]) const prevRunningRef = useRef(0) @@ -121,17 +123,22 @@ export function ActivityPanel() { cancelTask(taskId) }, [project]) - const handleCancelAll = useCallback(() => { + const handleCancelAll = useCallback(async () => { if (!project) return const activeCount = queueSummary.pending + queueSummary.processing if (activeCount === 0) return - if (!window.confirm( - `Cancel all ${activeCount} queued/processing task${activeCount > 1 ? "s" : ""}? ` + - `Partial files from the in-progress task will be removed. ` + - `Failed tasks will be kept so you can retry them.`, - )) return + const confirmed = await confirm({ + title: "Cancel Active Tasks", + message: + `Cancel all ${activeCount} queued/processing task${activeCount > 1 ? "s" : ""}? ` + + `Partial files from the in-progress task will be removed. ` + + `Failed tasks will be kept so you can retry them.`, + confirmLabel: "Cancel Tasks", + confirmVariant: "destructive", + }) + if (!confirmed) return cancelAllTasks() - }, [project, queueSummary.pending, queueSummary.processing]) + }, [confirm, project, queueSummary.pending, queueSummary.processing]) const handleFileSyncRescan = useCallback(() => { if (!project) return From 052c464a3b00c69bce39bf37410e0048f1ef1915 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:48 +0800 Subject: [PATCH 05/11] refactor(knowledge-tree): replace window.alert with app-dialog Replaces delete-failure window.alert with alert() and adds useAppDialog import. --- src/components/layout/knowledge-tree.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/layout/knowledge-tree.tsx b/src/components/layout/knowledge-tree.tsx index 1368f792..2006688d 100644 --- a/src/components/layout/knowledge-tree.tsx +++ b/src/components/layout/knowledge-tree.tsx @@ -10,6 +10,7 @@ import type { FileNode } from "@/types/wiki" import { normalizePath } from "@/lib/path-utils" import { cascadeDeleteWikiPagesWithRefs } from "@/lib/wiki-page-delete" import { inferWikiTypeFromPath } from "@/lib/wiki-page-types" +import { useAppDialog } from "@/stores/app-dialog-store" interface WikiPageInfo { path: string @@ -41,6 +42,7 @@ export function KnowledgeTree() { const fileTree = useWikiStore((s) => s.fileTree) const setFileTree = useWikiStore((s) => s.setFileTree) const bumpDataVersion = useWikiStore((s) => s.bumpDataVersion) + const { alert } = useAppDialog() const [pages, setPages] = useState([]) const [expandedTypes, setExpandedTypes] = useState>(new Set(["overview", "entity", "concept", "source"])) // Two-stage delete: first click arms the row, second click executes. @@ -109,7 +111,10 @@ export function KnowledgeTree() { if (selectedFile === pagePath) setSelectedFile(null) } catch (err) { console.error("[KnowledgeTree] delete failed:", err) - window.alert(`Failed to delete: ${err}`) + void alert({ + title: "Delete Failed", + message: `Failed to delete: ${err}`, + }) } finally { setDeletingPath(null) } From bdb33d87fd6e17151a5b619e7893d9a15b486590 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:50 +0800 Subject: [PATCH 06/11] refactor(research-panel): replace window.alert with app-dialog Replaces web-search-not-configured window.alert with await alert() in handleStartResearch. --- src/components/layout/research-panel.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/layout/research-panel.tsx b/src/components/layout/research-panel.tsx index 5c8358ee..07fef4b3 100644 --- a/src/components/layout/research-panel.tsx +++ b/src/components/layout/research-panel.tsx @@ -19,6 +19,7 @@ import { isImeComposing } from "@/lib/keyboard-utils" import { detectLanguage } from "@/lib/detect-language" import { getHtmlLang, getTextDirection } from "@/lib/language-metadata" import { MermaidDiagram, unwrapMermaidPre } from "@/components/mermaid-diagram" +import { useAppDialog } from "@/stores/app-dialog-store" export function ResearchPanel() { const tasks = useResearchStore((s) => s.tasks) @@ -27,17 +28,21 @@ export function ResearchPanel() { const project = useWikiStore((s) => s.project) const llmConfig = useWikiStore((s) => s.llmConfig) const searchApiConfig = useWikiStore((s) => s.searchApiConfig) + const { alert } = useAppDialog() const [inputValue, setInputValue] = useState("") const running = tasks.filter((t) => ["searching", "synthesizing", "saving"].includes(t.status)) const queued = tasks.filter((t) => t.status === "queued") const done = tasks.filter((t) => t.status === "done" || t.status === "error") - function handleStartResearch() { + async function handleStartResearch() { const topic = inputValue.trim() if (!topic || !project) return if (!hasConfiguredSearchProvider(searchApiConfig)) { - window.alert("Web Search not configured. Go to Settings → Web Search to configure a provider.") + await alert({ + title: "Web Search Not Configured", + message: "Web Search not configured. Go to Settings → Web Search to configure a provider.", + }) return } queueResearch(normalizePath(project.path), topic, llmConfig, searchApiConfig) From 8b26a741e7a4e416dee89f8f573f7d628e816aad Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:07:57 +0800 Subject: [PATCH 07/11] refactor(lint-view): replace window.confirm with app-dialog Replaces orphan-page delete confirmation with await confirm() and uses destructive variant for the delete action. --- src/components/lint/lint-view.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/lint/lint-view.tsx b/src/components/lint/lint-view.tsx index fb52a9b1..78dec158 100644 --- a/src/components/lint/lint-view.tsx +++ b/src/components/lint/lint-view.tsx @@ -18,6 +18,7 @@ import { runStructuralLint, runSemanticLint, type LintResult } from "@/lib/lint" import { hasUsableLlm } from "@/lib/has-usable-llm" import { readFile, writeFile, listDirectory } from "@/commands/fs" import { normalizePath } from "@/lib/path-utils" +import { useAppDialog } from "@/stores/app-dialog-store" import { useTranslation } from "react-i18next" interface IndexedLintResult { @@ -53,6 +54,7 @@ export function LintView() { const setActiveView = useWikiStore((s) => s.setActiveView) const setFileTree = useWikiStore((s) => s.setFileTree) const bumpDataVersion = useWikiStore((s) => s.bumpDataVersion) + const { confirm } = useAppDialog() // Dynamic type config based on i18n const typeConfig = useMemo(() => ({ @@ -204,7 +206,12 @@ export function LintView() { if (!project) return const pp = normalizePath(project.path) const pagePath = `${pp}/wiki/${result.page}` - const confirmed = window.confirm(t("lint.deleteOrphanConfirm", { page: result.page })) + const confirmed = await confirm({ + title: "Delete Orphan Page", + message: t("lint.deleteOrphanConfirm", { page: result.page }), + confirmLabel: "Delete", + confirmVariant: "destructive", + }) if (!confirmed) return try { From 4f3019eac6679d086b9676b55468ff070bcc6597 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:08:00 +0800 Subject: [PATCH 08/11] refactor(review-view): replace window.alert with app-dialog Replaces web-search-not-configured window.alert with await alert() in the deep-research action handler. --- src/components/review/review-view.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/review/review-view.tsx b/src/components/review/review-view.tsx index b5ec72eb..bdc528ed 100644 --- a/src/components/review/review-view.tsx +++ b/src/components/review/review-view.tsx @@ -17,6 +17,7 @@ import { useWikiStore } from "@/stores/wiki-store" import { writeFile, readFile, listDirectory, deleteFile } from "@/commands/fs" import { normalizePath } from "@/lib/path-utils" import { hasConfiguredSearchProvider } from "@/lib/web-search" +import { useAppDialog } from "@/stores/app-dialog-store" const typeConfig: Record = { contradiction: { icon: AlertTriangle, label: "Contradiction", color: "text-amber-500" }, @@ -33,6 +34,7 @@ export function ReviewView() { const clearResolved = useReviewStore((s) => s.clearResolved) const project = useWikiStore((s) => s.project) const setFileTree = useWikiStore((s) => s.setFileTree) + const { alert } = useAppDialog() const handleResolve = useCallback(async (id: string, action: string) => { const pp = project ? normalizePath(project.path) : "" @@ -41,7 +43,10 @@ export function ReviewView() { if (action === "__deep_research__" && project) { const searchConfig = useWikiStore.getState().searchApiConfig if (!hasConfiguredSearchProvider(searchConfig)) { - window.alert("Web Search not configured. Go to Settings → Web Search to configure a provider first.") + await alert({ + title: "Web Search Not Configured", + message: "Web Search not configured. Go to Settings → Web Search to configure a provider first.", + }) return } if (item) { From 8f042239690a279c29a8e98607c3ab7ac702cbc1 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:08:02 +0800 Subject: [PATCH 09/11] refactor(about-section): replace bare alert() with app-dialog Replaces the two bare alert() calls (browser-open fallback) with await alert() for consistent dialog styling. --- src/components/settings/sections/about-section.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/settings/sections/about-section.tsx b/src/components/settings/sections/about-section.tsx index a93a30a7..7e208806 100644 --- a/src/components/settings/sections/about-section.tsx +++ b/src/components/settings/sections/about-section.tsx @@ -8,6 +8,7 @@ import { API_SERVER_HEALTH_URL, API_SERVER_PORT } from "@/lib/api-server-constan import { useUpdateStore, hasAvailableUpdate } from "@/stores/update-store" import { checkForUpdates, toLatestReleaseUrl } from "@/lib/update-check" import { saveUpdateCheckState } from "@/lib/project-store" +import { useAppDialog } from "@/stores/app-dialog-store" interface ApiHealth { enabled?: boolean @@ -251,6 +252,7 @@ function UpdateAvailableBanner({ onDismiss, }: UpdateAvailableBannerProps) { const { t } = useTranslation() + const { alert } = useAppDialog() // Use `/releases/latest` (canonical GitHub redirect to the newest // release) rather than the tag-specific URL from the release // payload. Same rationale as in the top banner — see @@ -273,11 +275,15 @@ function UpdateAvailableBanner({ console.error("[update-banner] openUrl failed:", err) try { await navigator.clipboard.writeText(targetUrl) - // eslint-disable-next-line no-alert - alert(`Could not open browser. URL copied to clipboard:\n${targetUrl}`) + await alert({ + title: "Could Not Open Browser", + message: `URL copied to clipboard:\n${targetUrl}`, + }) } catch { - // eslint-disable-next-line no-alert - alert(`Could not open browser. Visit:\n${targetUrl}`) + await alert({ + title: "Could Not Open Browser", + message: `Visit:\n${targetUrl}`, + }) } } } From f25333f56952bb0b127c8450fef27da60820d980 Mon Sep 17 00:00:00 2001 From: luojiyin Date: Mon, 25 May 2026 22:08:04 +0800 Subject: [PATCH 10/11] refactor(sources-view): replace window.alert with app-dialog Replaces delete-failure and delete-folder-failure window.alert calls with await alert(). --- src/components/sources/sources-view.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/sources/sources-view.tsx b/src/components/sources/sources-view.tsx index e4605fc3..ccc02639 100644 --- a/src/components/sources/sources-view.tsx +++ b/src/components/sources/sources-view.tsx @@ -11,6 +11,7 @@ import { useTranslation } from "react-i18next" import { normalizePath } from "@/lib/path-utils" import { decideDeleteClick } from "@/lib/sources-tree-delete" import { rescanProjectFileSync } from "@/lib/project-file-sync" +import { useAppDialog } from "@/stores/app-dialog-store" import { deleteSourceFile, deleteSourceFolder, @@ -31,6 +32,7 @@ export function SourcesView() { const setFileTree = useWikiStore((s) => s.setFileTree) const llmConfig = useWikiStore((s) => s.llmConfig) const dataVersion = useWikiStore((s) => s.dataVersion) + const { alert } = useAppDialog() const [sources, setSources] = useState([]) const [importing, setImporting] = useState(false) const [ingestingPath, setIngestingPath] = useState(null) @@ -198,7 +200,10 @@ export function SourcesView() { } } catch (err) { console.error("Failed to delete source:", err) - window.alert(`Failed to delete: ${err}`) + await alert({ + title: "Delete Failed", + message: `Failed to delete: ${err}`, + }) } } @@ -233,7 +238,10 @@ export function SourcesView() { } } catch (err) { console.error("Failed to delete folder:", err) - window.alert(`Failed to delete folder: ${err}`) + await alert({ + title: "Delete Folder Failed", + message: `Failed to delete folder: ${err}`, + }) } } From b182f36532844127e3f39fa590e8d7484722bf2a Mon Sep 17 00:00:00 2001 From: luojiyin Date: Thu, 28 May 2026 14:15:33 +0800 Subject: [PATCH 11/11] fix: git concflict from merge main --- .codegraph/.gitignore | 16 + CONTRIBUTING_OPPORTUNITIES.md | 717 +++++ LEARNING_PATH.md | 753 +++++ src-tauri/vendor/soup3-0.5.0/.cargo-ok | 1 + .../vendor/soup3-0.5.0/.cargo_vcs_info.json | 6 + src-tauri/vendor/soup3-0.5.0/.gitignore | 2 + src-tauri/vendor/soup3-0.5.0/.gitlab-ci.yml | 65 + src-tauri/vendor/soup3-0.5.0/.gitmodules | 6 + src-tauri/vendor/soup3-0.5.0/Cargo.toml | 78 + src-tauri/vendor/soup3-0.5.0/Cargo.toml.orig | 48 + src-tauri/vendor/soup3-0.5.0/Gir.toml | 329 +++ src-tauri/vendor/soup3-0.5.0/LICENSE | 22 + src-tauri/vendor/soup3-0.5.0/README.md | 41 + src-tauri/vendor/soup3-0.5.0/src/auto/auth.rs | 328 ++ .../vendor/soup3-0.5.0/src/auto/auth_basic.rs | 24 + .../soup3-0.5.0/src/auto/auth_digest.rs | 24 + .../soup3-0.5.0/src/auto/auth_domain.rs | 253 ++ .../soup3-0.5.0/src/auto/auth_domain_basic.rs | 111 + .../src/auto/auth_domain_digest.rs | 121 + .../soup3-0.5.0/src/auto/auth_manager.rs | 43 + .../soup3-0.5.0/src/auto/auth_negotiate.rs | 31 + .../vendor/soup3-0.5.0/src/auto/auth_ntlm.rs | 24 + .../vendor/soup3-0.5.0/src/auto/cache.rs | 98 + .../vendor/soup3-0.5.0/src/auto/constants.rs | 13 + .../soup3-0.5.0/src/auto/content_decoder.rs | 24 + .../soup3-0.5.0/src/auto/content_sniffer.rs | 42 + .../vendor/soup3-0.5.0/src/auto/cookie.rs | 213 ++ .../vendor/soup3-0.5.0/src/auto/cookie_jar.rs | 225 ++ .../soup3-0.5.0/src/auto/cookie_jar_db.rs | 41 + .../soup3-0.5.0/src/auto/cookie_jar_text.rs | 41 + .../vendor/soup3-0.5.0/src/auto/enums.rs | 2625 +++++++++++++++++ .../vendor/soup3-0.5.0/src/auto/flags.rs | 383 +++ .../vendor/soup3-0.5.0/src/auto/functions.rs | 336 +++ .../soup3-0.5.0/src/auto/hsts_enforcer.rs | 148 + .../soup3-0.5.0/src/auto/hsts_enforcer_db.rs | 38 + .../soup3-0.5.0/src/auto/hsts_policy.rs | 113 + .../vendor/soup3-0.5.0/src/auto/logger.rs | 174 ++ .../vendor/soup3-0.5.0/src/auto/message.rs | 1281 ++++++++ .../soup3-0.5.0/src/auto/message_body.rs | 103 + .../soup3-0.5.0/src/auto/message_headers.rs | 258 ++ .../soup3-0.5.0/src/auto/message_metrics.rs | 115 + src-tauri/vendor/soup3-0.5.0/src/auto/mod.rs | 156 + .../vendor/soup3-0.5.0/src/auto/multipart.rs | 119 + .../src/auto/multipart_input_stream.rs | 70 + .../vendor/soup3-0.5.0/src/auto/server.rs | 553 ++++ .../soup3-0.5.0/src/auto/server_message.rs | 586 ++++ .../vendor/soup3-0.5.0/src/auto/session.rs | 1065 +++++++ .../soup3-0.5.0/src/auto/session_feature.rs | 35 + .../vendor/soup3-0.5.0/src/auto/versions.txt | 3 + .../src/auto/websocket_connection.rs | 366 +++ .../src/auto/websocket_extension.rs | 104 + .../src/auto/websocket_extension_deflate.rs | 24 + .../src/auto/websocket_extension_manager.rs | 24 + .../vendor/soup3-0.5.0/src/cookie_jar.rs | 60 + src-tauri/vendor/soup3-0.5.0/src/functions.rs | 62 + src-tauri/vendor/soup3-0.5.0/src/lib.rs | 28 + src-tauri/vendor/soup3-0.5.0/src/logger.rs | 52 + .../vendor/soup3-0.5.0/src/message_headers.rs | 81 + src-tauri/vendor/soup3-0.5.0/src/prelude.rs | 12 + src-tauri/vendor/soup3-0.5.0/src/rt.rs | 11 + src-tauri/vendor/soup3-0.5.0/src/server.rs | 178 ++ src-tauri/vendor/soup3-0.5.0/src/session.rs | 106 + .../soup3-0.5.0/src/websocket_connection.rs | 35 + 63 files changed, 13044 insertions(+) create mode 100644 .codegraph/.gitignore create mode 100644 CONTRIBUTING_OPPORTUNITIES.md create mode 100644 LEARNING_PATH.md create mode 100644 src-tauri/vendor/soup3-0.5.0/.cargo-ok create mode 100644 src-tauri/vendor/soup3-0.5.0/.cargo_vcs_info.json create mode 100644 src-tauri/vendor/soup3-0.5.0/.gitignore create mode 100644 src-tauri/vendor/soup3-0.5.0/.gitlab-ci.yml create mode 100644 src-tauri/vendor/soup3-0.5.0/.gitmodules create mode 100644 src-tauri/vendor/soup3-0.5.0/Cargo.toml create mode 100644 src-tauri/vendor/soup3-0.5.0/Cargo.toml.orig create mode 100644 src-tauri/vendor/soup3-0.5.0/Gir.toml create mode 100644 src-tauri/vendor/soup3-0.5.0/LICENSE create mode 100644 src-tauri/vendor/soup3-0.5.0/README.md create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_basic.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_digest.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_basic.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_digest.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_manager.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_negotiate.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/auth_ntlm.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/cache.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/constants.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/content_decoder.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/content_sniffer.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/cookie.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_db.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_text.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/enums.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/flags.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/functions.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer_db.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/hsts_policy.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/logger.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/message.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/message_body.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/message_headers.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/message_metrics.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/mod.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/multipart.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/multipart_input_stream.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/server.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/server_message.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/session.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/session_feature.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/versions.txt create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/websocket_connection.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_deflate.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_manager.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/cookie_jar.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/functions.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/lib.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/logger.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/message_headers.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/prelude.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/rt.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/server.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/session.rs create mode 100644 src-tauri/vendor/soup3-0.5.0/src/websocket_connection.rs diff --git a/.codegraph/.gitignore b/.codegraph/.gitignore new file mode 100644 index 00000000..9de0f169 --- /dev/null +++ b/.codegraph/.gitignore @@ -0,0 +1,16 @@ +# CodeGraph data files +# These are local to each machine and should not be committed + +# Database +*.db +*.db-wal +*.db-shm + +# Cache +cache/ + +# Logs +*.log + +# Hook markers +.dirty diff --git a/CONTRIBUTING_OPPORTUNITIES.md b/CONTRIBUTING_OPPORTUNITIES.md new file mode 100644 index 00000000..bac59d4e --- /dev/null +++ b/CONTRIBUTING_OPPORTUNITIES.md @@ -0,0 +1,717 @@ +# LLM Wiki 外部贡献者改进指南 + +> 基于对项目代码的深度分析,整理出适合不同水平外部贡献者的改进方向。 +> 分析时间:2026-05-25 + +--- + +## 目录 + +0. [当前优先的外部贡献(2026-05-26)](#0-当前优先的外部贡献2026-05-26) +1. [如何阅读本指南](#1-如何阅读本指南) +2. [Good First Issues(入门友好)](#2-good-first-issues入门友好) +3. [Help Wanted(需要社区力量)](#3-help-wanted需要社区力量) +4. [Advanced Contributions(深度参与)](#4-advanced-contributions深度参与) +5. [技术债务与重构机会](#5-技术债务与重构机会) +6. [按技术领域分类](#6-按技术领域分类) +7. [提交贡献的最佳实践](#7-提交贡献的最佳实践) + +--- + +## 0. 当前优先的外部贡献(2026-05-26) + +> 这一节不是泛泛而谈的“可以做什么”,而是基于当前代码状态筛出来的、 +> 更适合外部贡献者切入、且更可能被快速 review/合并的方向。 + +### 0.1 搜索性能:把关键词搜索从“全量扫 markdown”改成“预建索引” +**难度**:🟡 **影响面**:Core + Rust **预估工时**:1-3 周 + +当前关键词搜索在后端每次查询都会遍历 `wiki/` 下的 `.md` 文件并逐个读取内容, +规模一大就会直接拉高延迟: + +- `src-tauri/src/commands/search.rs:123` +- `src-tauri/src/commands/search.rs:147` +- `src-tauri/src/commands/search.rs:160` + +**为什么值得做**: +- 这是当前最明确的性能瓶颈 +- 边界清楚,集中在搜索链路 +- 做完后收益能被用户直接感知 + +**适合的贡献方式**: +1. 先补 benchmark / profiling,量化当前搜索延迟 +2. 增加一个增量关键词索引(SQLite FTS / Tantivy / 其他轻量倒排索引) +3. 支持页面新增、删除、重写时的索引更新 +4. 保持现有 hybrid 搜索接口不变,先只替换 token 搜索底座 + +**建议验收标准**: +- 搜索 API 兼容现有 `search_project` +- 中型 wiki 下搜索耗时明显下降 +- 为“索引缺失 / 索引损坏 / 索引过期”提供回退路径 + +--- + +### 0.2 Embedding 吞吐优化:有限并发,而不是全串行 +**难度**:🟡 **影响面**:Core + TS **预估工时**:3-7 天 + +当前 embedding 是逐页、逐 chunk 顺序发请求: + +- `src/lib/ingest.ts:732` +- `src/lib/embedding.ts:345` +- `src/lib/embedding.ts:363` + +**为什么值得做**: +- 大批量导入时吞吐几乎严格线性 +- 任一慢 embedding 请求都会卡住整条 ingest 链 +- 可以在不重写架构的前提下显著提速 + +**适合的贡献方式**: +1. 为 chunk embedding 增加有上限的并发(例如 2-4) +2. 为支持 batch embeddings 的 provider 增加批量请求路径 +3. 保留现有失败重试和 oversize auto-halving 逻辑 +4. 为 Settings 或 Activity Panel 暴露更清晰的 embedding 进度 + +**建议验收标准**: +- 不改变结果格式和 LanceDB upsert 行为 +- 不引入同一页面的重复写入竞争 +- real-llm / mock tests 至少补一个并发场景 + +--- + +### 0.3 Rust API Server:把 `chat` 从 501 变成可用接口 +**难度**:🟡/🔴 **影响面**:Rust + Core **预估工时**:1-2 周 + +本地 API server 已有 `projects/files/search/graph/rescan`,但 `chat` 仍未实现: + +- `src-tauri/src/api_server.rs:257` +- `src-tauri/src/api_server.rs:262` + +**为什么值得做**: +- 这是“桌面应用”走向“可被外部 agent 调用的平台”的关键缺口 +- 能直接提升脚本化、自动化、远程接入能力 + +**适合的贡献方式**: +1. 先抽取 WebView 里已有的共享 chat/RAG 逻辑 +2. 在 Rust backend command 暴露一个统一入口 +3. 让 `/api/v1/projects/:id/chat` 走同一条后端能力链 +4. 补 API contract tests 与错误码约定 + +**风险提醒**: +- 这是高价值方向,但会碰前后端边界,不建议第一次贡献就大拆主流程 + +--- + +### 0.4 编译 warning 清理与小型 correctness 修复 +**难度**:🟢 **影响面**:Rust **预估工时**:1-3 天 + +当前 `cargo check` 已通过,但仍有一批明确 warning: + +- `src-tauri/src/clip_server.rs:45` +- `src-tauri/src/commands/fs.rs:483` +- `src-tauri/src/commands/fs.rs:486` +- `src-tauri/src/commands/fs.rs:568` +- `src-tauri/src/commands/fs.rs:584` +- `src-tauri/src/commands/fs.rs:819` + +**为什么值得做**: +- 边界清楚,适合首次 PR +- review 成本低 +- 能提升主分支健康度,建立信任 + +**适合的贡献方式**: +1. 清理未使用变量 / 无效模式匹配 +2. 为不清晰逻辑补最小测试 +3. 不顺手大改 unrelated 代码 + +--- + +### 0.5 测试补强:优先补“边界场景”,不要只加快照 +**难度**:🟢/🟡 **影响面**:Tests **预估工时**:2-5 天 + +项目已有较多测试基础,外部贡献者更适合补“薄弱边界”,而不是重复已有 happy path。 + +**优先推荐的测试方向**: +1. 搜索 ranking / hybrid fallback 场景 +2. ingest queue 中断恢复、取消、空结果失败路径 +3. API server 无头集成测试 +4. embedding 降级路径与 provider 兼容性测试 + +**相关入口**: +- `package.json` 中 `test:mocks` / `test:llm` +- `src/lib/*.test.ts` +- `src/lib/*.real-llm.test.ts` + +--- + +### 0.6 队列与调度持久化:提升可观测性和恢复能力 +**难度**:🟡 **影响面**:Core + TS **预估工时**:3-6 天 + +当前 ingest queue、dedup queue、scheduled import 都依赖 JSON 文件和模块级状态。 +这类贡献不如搜索重构“显眼”,但很适合稳健型外部贡献者。 + +相关文件: +- `src/lib/ingest-queue.ts` +- `src/lib/dedup-queue.ts` +- `src/lib/scheduled-import.ts` + +**适合的贡献方式**: +1. 为 queue/db 文件增加 schema version +2. 增强损坏文件恢复策略 +3. 增加更清晰的 task telemetry / error metadata +4. 改善 retry / failed 状态的 UI 可见性 + +--- + +### 0.7 首次外部贡献的推荐顺序 + +如果你是第一次向这个项目发 PR,建议按这个顺序选题: + +1. 清理 `cargo check` warning +2. 补一个搜索或队列的边界测试 +3. 做 embedding 有限并发 +4. 做关键词搜索 benchmark / profiling +5. 做搜索索引原型 +6. 最后再碰 API `/chat` + +--- + +## 1. 如何阅读本指南 + +每条改进建议包含: +- **难度**:🟢 简单 / 🟡 中等 / 🔴 困难 +- **影响面**:UI / Core / Rust / Docs / Infra +- **预估工时**:粗略估计 +- **相关文件**:便于快速定位代码 + +--- + +## 2. Good First Issues(入门友好) + +### 2.1 添加更多文件类型的图标映射 +**难度**:🟢 **影响面**:UI **预估工时**:1-2h + +当前 `src/lib/file-types.ts` 缺少一些常见格式: +- `.jl` (Julia)、`.ex` / `.exs` (Elixir)、`.dart`、`.kt` 已有但 `.kts` 缺失 +- `.graphql`、`.prisma`、`.proto` +- `.ipynb` (Jupyter Notebook) +- `.psd`、`.ai`、`.sketch` (设计文件) +- `.zip`、`.tar`、`.gz` (压缩文件) + +**怎么做**: +1. 在 `EXT_MAP` 中添加扩展名到分类的映射 +2. 在 `getCodeLanguage()` 中添加语法高亮映射 +3. 如有对应图标需求,可在 UI 层添加分类图标 + +**相关文件**:`src/lib/file-types.ts` + +--- + +### 2.2 替换原生 `window.alert/confirm` 为应用内 Dialog +**难度**:🟢 **影响面**:UI **预估工时**:2-4h + +项目中有 **9 处**直接使用原生弹窗,破坏桌面应用体验: +- `src/components/sources/sources-view.tsx` (2 处 alert) +- `src/components/lint/lint-view.tsx` (1 处 confirm) +- `src/components/review/review-view.tsx` (1 处 alert) +- `src/components/layout/knowledge-tree.tsx` (1 处 alert) +- `src/components/layout/research-panel.tsx` (1 处 alert) +- `src/components/layout/activity-panel.tsx` (1 处 confirm) +- `src/App.tsx` (2 处 alert) + +**怎么做**: +1. 已有 `src/components/ui/dialog.tsx` (shadcn/ui Dialog) +2. 封装一个 `useConfirmDialog()` hook 或全局 Alert 状态 +3. 逐处替换,保持原有文案和交互逻辑 + +**相关文件**:上述 7 个文件 + `src/components/ui/dialog.tsx` + +--- + +### 2.3 修复 i18n 遗漏的硬编码字符串 +**难度**:🟢 **影响面**:UI **预估工时**:2-3h + +通过扫描发现部分 UI 仍使用硬编码英文,未走 `react-i18next`: +- `window.alert` 和 `window.confirm` 中的文案 +- 部分 `console.warn/error` 中的用户可见提示 +- Graph 视图中部分 tooltip 和 label + +**怎么做**: +1. 在 `src/i18n/en.json` 和 `src/i18n/zh.json` 中添加对应 key +2. 用 `useTranslation()` 的 `t()` 替换硬编码字符串 +3. 运行 `npm run test:mocks` 确保不破坏测试 + +**相关文件**:`src/i18n/*.json` + 各组件文件 + +--- + +### 2.4 为 i18n 添加新语言支持 +**难度**:🟢 **影响面**:UI **预估工时**:3-6h/语言 + +当前仅支持 **English + Chinese**。社区可贡献: +- 日本语 (ja) — README_JA.md 已存在,说明有日语用户基础 +- 西班牙语 (es)、法语 (fr)、德语 (de) +- 韩语 (ko) + +**怎么做**: +1. 复制 `src/i18n/en.json` 为目标语言文件 +2. 翻译所有字符串(约 200-300 条) +3. 在 `src/i18n/index.ts` 中注册新语言 +4. 在 Settings → Interface 中添加语言选项 + +**相关文件**:`src/i18n/*` + +--- + +### 2.5 添加 `.typos.toml` 忽略项目特定术语 +**难度**:🟢 **影响面**:Infra **预估工时**:30min + +项目已使用 `typos` CLI 做拼写检查,但存在大量 false positives(如德语单词、越南语地名、数学符号)。可在项目根目录添加 `.typos.toml` 配置,减少噪音。 + +**参考配置**: +```toml +[default.extend-identifiers] +"BA" = "BA" +"Ba" = "Ba" +"Nd" = "Nd" +"ODF" = "ODF" +"odf" = "odf" + +[default.extend-words] +"als" = "als" +"ein" = "ein" +"eine" = "eine" +"ist" = "ist" +"oder" = "oder" +"sie" = "sie" +"Vor" = "Vor" +"Alle" = "Alle" +"Nam" = "Nam" +"unparseable" = "unparseable" + +[type.html] +extend-glob = [] +check-file = false +``` + +**相关文件**:项目根目录(新建 `.typos.toml`) + +--- + +### 2.6 添加 Issue/PR 模板 +**难度**:🟢 **影响面**:Community **预估工时**:1h + +当前 `.github/` 目录只有 workflows,缺少社区协作模板: +- Bug Report 模板 +- Feature Request 模板 +- PR 模板(含 checklist:测试通过、i18n 更新、文档更新) + +**相关文件**:`.github/ISSUE_TEMPLATE/`、`.github/pull_request_template.md` + +--- + +### 2.7 清理 `console.log/warn/error` 生产残留 +**难度**:🟢 **影响面**:Core **预估工时**:2-3h + +代码中有 **204 处** `console.*` 调用。虽然很多是合理的错误上报,但: +- 诊断性 `console.log`(如 `[ingest:diag]`)不应出现在生产构建 +- 应统一为可开关的日志系统或 `import.meta.env.DEV` 守卫 + +**怎么做**: +1. 封装 `src/lib/logger.ts`: + ```ts + export const log = { + debug: (...args: unknown[]) => { if (import.meta.env.DEV) console.log(...args) }, + warn: (...args: unknown[]) => console.warn(...args), + error: (...args: unknown[]) => console.error(...args), + } + ``` +2. 批量替换诊断日志为 `log.debug()` +3. 保留真正的错误上报(`warn/error`) + +**相关文件**:全项目(可用脚本批量替换) + +--- + +## 3. Help Wanted(需要社区力量) + +### 3.1 添加更多 LLM Provider 预设 +**难度**:🟡 **影响面**:Core **预估工时**:2-4h/Provider + +当前 `src/components/settings/llm-presets.ts` 已有 OpenAI、Anthropic、DeepSeek 等预设,但缺少: +- **Groq**(高速推理) +- **Mistral AI**(Le Chat / Codestral) +- **Cerebras**(超快推理) +- **Fireworks AI** +- **Together AI** +- **OpenRouter**(统一网关) + +**怎么做**: +1. 在 `llm-presets.ts` 的 `LLM_PRESETS` 数组中添加配置 +2. 确保 `llm-providers.ts` 能正确解析 endpoint(大多数是 OpenAI-compatible) +3. 添加 provider 图标(如可用) +4. 更新设置界面的预设选择器 + +**相关文件**:`src/components/settings/llm-presets.ts`、`src/lib/llm-providers.ts` + +--- + +### 3.2 为纯前端组件添加无障碍 (a11y) 改进 +**难度**:🟡 **影响面**:UI **预估工时**:3-5h + +当前 a11y 标记较少(仅 34 处 aria-*)。可改进点: +- **Graph 视图**:节点和边无法被屏幕阅读器感知 +- **Sources 树**:缺少 `aria-expanded`、`aria-level`、`aria-setsize` +- **Activity Panel**:进度条缺少 `role="progressbar"`、`aria-valuenow` +- **Search 面板**:搜索结果列表缺少 `role="listbox"`、`aria-selected` +- **Color contrast**:部分文字与背景对比度可能低于 WCAG AA 标准 + +**怎么做**: +1. 为交互元素添加语义化 role 和 aria 属性 +2. 确保键盘导航(Tab/Enter/Escape)在所有面板正常工作 +3. 使用 axe-core 或 Lighthouse 做自动化 a11y 审计 + +**相关文件**:`src/components/**/*.tsx` + +--- + +### 3.3 添加 CSV/TSV 结构化预览 +**难度**:🟡 **影响面**:UI + Core **预估工时**:4-6h + +当前 CSV 被归类为 `data`,在编辑器中按纯文本展示。可改进为: +- 表格形式预览(类似 Excel) +- 支持排序、搜索 +- 分页(大 CSV 不卡顿) + +**怎么做**: +1. 在 `src/components/editor/file-preview.tsx` 中添加 CSV 分支 +2. 用轻量表格组件(如 `@tanstack/react-table` 或手写)渲染 +3. Rust 后端 `fs.rs` 中已有 `calamine` 支持 Excel,CSV 可直接用 Rust 或前端解析 +4. 注意大文件性能(>1MB CSV 应截断或虚拟滚动) + +**相关文件**:`src/components/editor/file-preview.tsx`、`src/lib/file-types.ts` + +--- + +### 3.4 为 Ingest 添加更多源文件格式支持 +**难度**:🟡 **影响面**:Rust **预估工时**:4-8h/格式 + +| 格式 | 优先级 | 技术方案 | +|------|--------|----------| +| `.epub` | 高 | 电子书格式,可用 `epub` crate 或解压后解析 HTML | +| `.rtf` | 中 | 富文本格式,可用 `rtf-parser` 或直接当 text 读取 | +| `.html` / `.htm` | 高 | 本地网页保存,可用 `html2md` 或 Readability | +| `.tex` | 低 | LaTeX 源文件,可作为纯文本 + 特殊渲染 | +| `.ipynb` | 中 | Jupyter Notebook,解析 JSON 提取 markdown + code cells | + +**怎么做**: +1. 在 `src-tauri/src/commands/fs.rs` 的 `read_file()` 匹配分支中添加新格式 +2. 如有必要,添加 Rust crate 依赖 +3. 在 `src/lib/file-types.ts` 中更新分类 +4. 添加对应的测试用例 + +**相关文件**:`src-tauri/src/commands/fs.rs`、`src/lib/file-types.ts` + +--- + +### 3.5 添加键盘快捷键系统 +**难度**:🟡 **影响面**:UI **预估工时**:4-6h + +当前应用缺少全局键盘快捷键: +- `Ctrl/Cmd + K`:快速打开 Search +- `Ctrl/Cmd + N`:新建对话 +- `Ctrl/Cmd + Shift + I`:导入文件 +- `Ctrl/Cmd + Shift + S`:保存到 Wiki +- `Ctrl/Cmd + B`:切换侧边栏 +- `Escape`:关闭弹窗/面板 + +**怎么做**: +1. 创建 `src/lib/keyboard-shortcuts.ts` 统一管理快捷键 +2. 使用 `document.addEventListener('keydown')` 或 `react-hotkeys-hook` +3. 在 Settings 中添加快捷键自定义界面(可选) +4. 注意与 Milkdown 编辑器的快捷键冲突 + +**相关文件**:新建 `src/lib/keyboard-shortcuts.ts`,修改 `src/App.tsx` + +--- + +### 3.6 优化 Sources 树的大文件夹性能 +**难度**:🟡 **影响面**:UI **预估工时**:3-5h + +当前 Sources 树已有**渐进式加载**(`SOURCE_TREE_INITIAL_ROWS` + `IntersectionObserver`),但: +- 超过 1000 个文件时,展开/折叠操作仍可能卡顿 +- 缺少虚拟滚动(Virtualized List) +- 搜索/过滤大文件夹时无 debounce + +**怎么做**: +1. 引入 `@tanstack/react-virtual` 或 `react-window` 做虚拟滚动 +2. 为过滤输入添加 `useDeferredValue` 或 debounce +3. 用 `useMemo` 缓存过滤后的树形结构 + +**相关文件**:`src/components/sources/sources-view.tsx` + +--- + +### 3.7 为 API Server 添加 OpenAPI/Swagger 文档 +**难度**:🟡 **影响面**:Docs + Rust **预估工时**:3-4h + +当前本地 HTTP API (`src-tauri/src/api_server.rs`) 功能完善但缺少机器可读的文档: +- `GET /api/v1/health` +- `GET /api/v1/projects` +- `POST /api/v1/projects/{id}/search` +- `GET /api/v1/projects/{id}/graph` +- etc. + +**怎么做**: +1. 使用 `utoipa` crate 从 Rust 代码生成 OpenAPI 3.0 spec +2. 在 `api_server.rs` 的 handler 函数上添加 `#[utoipa::path(...)]` 宏 +3. 暴露 `/api/v1/docs` 端点提供 Swagger UI(可选嵌入 `swagger-ui-dist`) +4. 同步更新 README 中的 API 章节 + +**相关文件**:`src-tauri/src/api_server.rs`、`src-tauri/Cargo.toml` + +--- + +### 3.8 为 Graph 视图导出功能 +**难度**:🟡 **影响面**:UI **预估工时**:3-5h + +用户希望将知识图谱导出为图片或数据文件: +- **PNG/SVG 导出**:sigma.js 支持 `sigma.toPNG()` 和 `sigma.toSVG()` +- **GEXF/GraphML 导出**:用于 Gephi、Cytoscape 等外部工具分析 +- **CSV 节点/边列表**:便于做数据科学分析 + +**怎么做**: +1. 在 Graph 视图工具栏添加导出按钮 +2. 使用 `graphology` 的导出工具(`graphology-gexf` 等) +3. 通过 Tauri `dialog` plugin 让用户选择保存路径 +4. 大图的 PNG 导出注意内存占用 + +**相关文件**:`src/components/graph/graph-view.tsx` + +--- + +## 4. Advanced Contributions(深度参与) + +### 4.1 Ingest 流水线模块化拆分 +**难度**:🔴 **影响面**:Core **预估工时**:8-15h + +`src/lib/ingest.ts` 当前 **1833 行**,是项目中最大的单体 TS 文件: +- 包含分析、生成、缓存、图片提取、caption、sanitize、file block 解析等 10+ 个职责 +- 测试文件 `ingest.*.test.ts` 也极其庞大 + +**拆分方向**: +``` +ingest/ +├── index.ts # 公共接口(enqueueSourceIngest 等) +├── analyze.ts # Step 1: LLM 分析源文件 +├── generate.ts # Step 2: LLM 生成 Wiki 页面 +├── parse-blocks.ts # FILE block 解析(已有独立文件) +├── cache.ts # 已独立(ingest-cache.ts) +├── images.ts # 图片提取与注入(可从 ingest.ts 抽出) +├── sanitize.ts # 已独立(ingest-sanitize.ts) +└── helpers.ts # 共享工具函数 +``` + +**相关文件**:`src/lib/ingest.ts`、`src/lib/ingest-*.ts` + +--- + +### 4.2 Rust `fs.rs` 模块化拆分 +**难度**:🔴 **影响面**:Rust **预估工时**:10-20h + +`src-tauri/src/commands/fs.rs` 当前 **2048 行**,职责过重: +- 文件读写(通用) +- PDF 文本提取 +- Office 文档解析(DOCX/PPTX/XLSX/ODF) +- 缓存读写 +- 文件系统遍历 +- Wiki 页面关联查找 + +**拆分方向**: +``` +commands/ +├── fs.rs # 基础文件操作(read/write/list) +├── extractors/ +│ ├── pdf.rs # PDF 提取 +│ ├── office.rs # Office 提取 +│ └── cache.rs # 预处理缓存 +└── wiki_ops.rs # Wiki 相关操作(find_related_wiki_pages 等) +``` + +**相关文件**:`src-tauri/src/commands/fs.rs` + +--- + +### 4.3 添加 Plugin/Extension 系统 +**难度**:🔴 **影响面**:Architecture **预估工时**:20-40h + +当前应用是 monolithic 架构,外部开发者无法扩展功能。可设计轻量插件系统: +- **Ingest Plugin**:自定义文件格式解析器 +- **Graph Plugin**:自定义布局算法或可视化 +- **LLM Plugin**:自定义 Provider(无需修改核心代码) +- **Export Plugin**:自定义导出格式 + +**技术方案选项**: +- **方案 A**:JavaScript Plugin(前端 eval 或 Web Worker)— 风险高 +- **方案 B**:WASM Plugin(Rust 编译为 WASM,通过 WASI 沙箱)— 较安全 +- **方案 C**:外部 CLI Plugin(类似 Git LFS filter)— 最简单 + +**相关文件**:架构级改动,需先开 Discussion 讨论设计 + +--- + +### 4.4 向量搜索性能优化 +**难度**:🔴 **影响面**:Rust + Core **预估工时**:10-15h + +当前 LanceDB 向量搜索在 Wiki 超过 5000 页面时可能出现: +- 索引构建时间过长(阻塞 UI) +- 内存占用过高(全部向量驻留内存) +- 增量更新效率低(每次全量 re-index) + +**优化方向**: +1. **异步索引构建**:将 `vector_upsert` 改为后台任务,不阻塞 ingest +2. **分区存储**:按类型(entity/concept/source)分表存储,减少单次搜索扫描量 +3. **HNSW 索引**:如 LanceDB 支持,启用近似最近邻索引加速 +4. **Embedding 缓存**:相同文本的 embedding 结果复用(已部分实现,可完善) + +**相关文件**:`src-tauri/src/commands/vectorstore.rs`、`src/lib/embedding.ts` + +--- + +### 4.5 为图可视化添加 WebGL 2 渲染后端 +**难度**:🔴 **影响面**:UI **预估工时**:15-25h + +当前 sigma.js 在 5000+ 节点时,Canvas 2D 渲染帧率下降明显。可探索: +- **sigma.js WebGL renderer**(如官方支持) +- 或迁移到 **deck.gl** / **Pixi.js** 做高性能图渲染 +- 或按需渲染(viewport culling)+ 层级聚合(cluster on zoom out) + +**相关文件**:`src/components/graph/graph-view.tsx` + +--- + +### 4.6 多工作区/多窗口支持 +**难度**:🔴 **影响面**:Architecture **预估工时**:15-30h + +当前应用是单项目单窗口模式。用户反馈可能需要: +- 同时打开两个 Wiki 项目对比 +- 弹出独立预览窗口 +- 分离 Graph 视图为独立窗口 + +**技术挑战**: +1. Tauri 多窗口 API (`WebviewWindowBuilder`) +2. 窗口间状态同步(Tauri Event System) +3. 后端 API Server 和 Clip Server 的共享/隔离 + +**相关文件**:`src-tauri/src/lib.rs`、`src/App.tsx` + +--- + +## 5. 技术债务与重构机会 + +### 5.1 统一错误处理与用户提示 + +当前错误处理分散: +- 有些用 `window.alert` +- 有些用 `console.error` +- 有些在 UI 中内联显示 +- 有些静默吞掉(`catch { /* non-critical */ }`) + +**建议**:引入 Toast/Notification 系统统一用户可见错误。 + +### 5.2 减少重复代码 + +通过扫描发现 `ingest-queue.ts` 和 `dedup-queue.ts` 几乎**镜像实现**(相同的 pause/resume/persist/retry 逻辑),可提取为 `src/lib/serial-queue.ts` 抽象基类。 + +### 5.3 类型定义集中化 + +部分类型分散在多个 store 文件中(如 `LlmConfig` 定义在 `wiki-store.ts`),可提取到 `src/types/` 目录统一管理。 + +### 5.4 减少组件文件大小 + +`graph-view.tsx` (1245 行) 包含: +- Sigma 容器配置 +- ForceAtlas2 布局控制 +- 社区检测 UI +- Insights 面板 +- 搜索/过滤逻辑 +- 导出逻辑(待实现) + +可拆分为:`graph-renderer.tsx`、`graph-controls.tsx`、`graph-insights-panel.tsx`。 + +--- + +## 6. 按技术领域分类 + +### 前端 React/TypeScript +| 改进 | 难度 | 工时 | +|------|------|------| +| 替换 window.alert 为 Dialog | 🟢 | 2-4h | +| i18n 硬编码清理 | 🟢 | 2-3h | +| 新语言支持 | 🟢 | 3-6h | +| 键盘快捷键系统 | 🟡 | 4-6h | +| a11y 改进 | 🟡 | 3-5h | +| CSV 结构化预览 | 🟡 | 4-6h | +| Graph 导出功能 | 🟡 | 3-5h | +| Sources 树虚拟滚动 | 🟡 | 3-5h | +| Graph 视图拆分 | 🟡 | 4-6h | +| WebGL 渲染后端 | 🔴 | 15-25h | + +### Rust / Tauri +| 改进 | 难度 | 工时 | +|------|------|------| +| 新文件格式解析 (epub/html) | 🟡 | 4-8h | +| OpenAPI/Swagger 文档 | 🟡 | 3-4h | +| fs.rs 模块化拆分 | 🔴 | 10-20h | +| 向量搜索性能优化 | 🔴 | 10-15h | +| 多窗口支持 | 🔴 | 15-30h | + +### 核心算法 / LLM +| 改进 | 难度 | 工时 | +|------|------|------| +| 新 LLM Provider 预设 | 🟡 | 2-4h | +| Ingest 流水线拆分 | 🔴 | 8-15h | +| Plugin 系统设计 | 🔴 | 20-40h | + +### 基础设施 / 社区 +| 改进 | 难度 | 工时 | +|------|------|------| +| `.typos.toml` 配置 | 🟢 | 30min | +| Issue/PR 模板 | 🟢 | 1h | +| 统一日志系统 | 🟢 | 2-3h | +| 更多文件类型图标 | 🟢 | 1-2h | +| 测试覆盖率补充 | 🟡 | 3-10h | + +--- + +## 7. 提交贡献的最佳实践 + +### 7.1 开始之前 +1. **阅读 README**:了解项目架构和快速开始指南 +2. **查看现有 Issues/PRs**:避免重复劳动 +3. **开 Discussion 或 Issue**:对于大型改动(>8h),先与维护者对齐设计 + +### 7.2 代码规范 +- **TypeScript**:严格模式已开启,避免 `any` +- **Rust**:遵循 `cargo fmt` 和 `cargo clippy` +- **Commit Message**:参考现有风格(`fix:`, `feat:`, `refactor:`, `docs:`) +- **i18n**:所有用户可见字符串必须走 `t()`,同步更新 `en.json` 和 `zh.json` + +### 7.3 测试要求 +- 新增功能必须附带测试(`.test.ts`) +- 运行 `npm run test:mocks` 确保通过 +- 涉及 LLM 的功能可只写 mock 测试(real-llm 测试可选) +- Rust 修改需确保 `cargo test` 通过 + +### 7.4 PR Checklist +```markdown +- [ ] 代码通过 `npm run typecheck` +- [ ] 测试通过 `npm run test:mocks` +- [ ] i18n 字符串已更新(如适用) +- [ ] 文档已更新(README/CHANGELOG,如适用) +- [ ] Rust 代码通过 `cargo clippy`(如适用) +- [ ] 手动测试确认 UI 正常(如适用) +``` + +--- + +*本指南基于代码静态分析生成,具体优先级请与项目维护者确认。* diff --git a/LEARNING_PATH.md b/LEARNING_PATH.md new file mode 100644 index 00000000..15ccba6c --- /dev/null +++ b/LEARNING_PATH.md @@ -0,0 +1,753 @@ +# LLM Wiki 项目学习路径 + +> 基于对 [nashsu/llm_wiki](https://github.com/nashsu/llm_wiki) 的深度代码分析,整理出系统化的学习路径。 +> 生成时间:2026-05-25 + +--- + +## 目录 + +1. [项目概览](#1-项目概览) +2. [前置知识要求](#2-前置知识要求) +3. [学习阶段总览](#3-学习阶段总览) +4. [阶段一:技术栈基础](#4-阶段一技术栈基础) +5. [阶段二:前端架构与状态管理](#5-阶段二前端架构与状态管理) +6. [阶段三:LLM 集成与流式处理](#6-阶段三llm-集成与流式处理) +7. [阶段四:知识图谱与图算法](#7-阶段四知识图谱与图算法) +8. [阶段五:搜索与向量检索](#8-阶段五搜索与向量检索) +9. [阶段六:Rust 后端与桌面应用](#9-阶段六rust-后端与桌面应用) +10. [阶段七:数据持久化与队列系统](#10-阶段七数据持久化与队列系统) +11. [阶段八:测试策略与质量保障](#11-阶段八测试策略与质量保障) +12. [阶段九:高级主题与工程实践](#12-阶段九高级主题与工程实践) +13. [推荐学习顺序](#13-推荐学习顺序) +14. [实战练习建议](#14-实战练习建议) + +--- + +## 1. 项目概览 + +**LLM Wiki** 是一个基于 Tauri v2 + React + Rust 构建的跨平台桌面知识库应用。核心功能是将用户的文档通过 LLM 自动转化为结构化、互联的 Wiki 知识网络。 + +### 核心特性 + +- **双步思维链 Ingest**:LLM 先分析后生成,带 SHA256 增量缓存 +- **4 信号知识图谱**:直接链接、源重叠、Adamic-Adar、类型亲和度 +- **Louvain 社区检测**:自动发现知识聚类 +- **混合搜索**:关键词分词 + 向量语义检索 (LanceDB) +- **多 LLM Provider 支持**:OpenAI, Anthropic, Google, Azure, Ollama, Custom +- **Chrome Web Clipper**:一键网页捕获 +- **本地 HTTP API**:127.0.0.1:19828,支持 AI Agent 集成 + +### 技术栈全景 + +| 层级 | 技术 | +|------|------| +| 桌面框架 | Tauri v2 (Rust) | +| 前端 | React 19 + TypeScript + Vite | +| UI | shadcn/ui + Tailwind CSS v4 | +| 编辑器 | Milkdown (ProseMirror) | +| 状态管理 | Zustand | +| 图可视化 | sigma.js + graphology + ForceAtlas2 | +| 搜索 | Tokenized + Vector (LanceDB) | +| i18n | react-i18next | +| 测试 | Vitest + fast-check | + +--- + +## 2. 前置知识要求 + +### 必备基础 + +- **TypeScript/JavaScript**:中级水平,理解泛型、类型推断、异步编程 +- **React**:Hooks、组件生命周期、Context API +- **Rust**:基础语法、所有权、生命周期、错误处理 (`Result`) +- **Git**:分支管理、合并、基本工作流 + +### 加分项 + +- 图论基础(节点、边、邻接矩阵) +- 信息检索基础(TF-IDF、向量空间模型) +- LLM API 使用经验(OpenAI/Claude) + +--- + +## 3. 学习阶段总览 + +``` +阶段一 (1-2周) → 阶段二 (1-2周) → 阶段三 (2-3周) + ↓ ↓ ↓ +阶段六 (2周) → 阶段四 (1-2周) → 阶段五 (1-2周) + ↓ ↓ ↓ +阶段七 (1周) → 阶段八 (1周) → 阶段九 (持续) +``` + +--- + +## 4. 阶段一:技术栈基础 + +### 4.1 Tauri v2 桌面应用框架 + +**学习目标**:理解 Tauri 的架构模式(Rust 后端 + Web 前端) + +**核心文件**: +- `src-tauri/src/lib.rs` — Tauri 应用入口,命令注册、插件初始化 +- `src-tauri/src/main.rs` — 二进制入口 +- `src-tauri/Cargo.toml` — Rust 依赖管理 + +**学习要点**: +1. `tauri::Builder` 配置模式 +2. `#[tauri::command]` 宏定义前后端通信接口 +3. `invoke_handler` 注册前端可调用的 Rust 命令 +4. Tauri v2 插件系统 (`tauri-plugin-http`, `tauri-plugin-store`, `tauri-plugin-dialog`) +5. 窗口事件处理(macOS close-to-hide vs Windows/Linux 确认退出) + +**参考代码**: +```rust +// src-tauri/src/lib.rs 核心模式 +tauri::Builder::default() + .plugin(tauri_plugin_http::init()) + .setup(|app| { /* 初始化逻辑 */ }) + .invoke_handler(tauri::generate_handler![...]) + .on_window_event(|window, event| { /* 窗口事件 */ }) +``` + +### 4.2 Vite + React 19 + TypeScript + +**学习目标**:掌握现代前端构建工具链 + +**核心文件**: +- `vite.config.ts` — Vite 配置,含 Tauri 开发适配 +- `tsconfig.json` / `tsconfig.app.json` — TypeScript 配置 + +**学习要点**: +1. `defineConfig` 中的环境变量注入(`__APP_VERSION__`) +2. `resolve.alias` 路径别名配置 (`@/ → ./src`) +3. Vite 测试环境配置 (`test.environment: "node"`) +4. TypeScript 严格模式与模块解析 + +### 4.3 Tailwind CSS v4 + shadcn/ui + +**学习目标**:理解原子化 CSS 与组件库集成 + +**核心文件**: +- `components.json` — shadcn/ui 配置 +- `src/components/ui/*.tsx` — 基础 UI 组件 + +**学习要点**: +1. Tailwind v4 的新特性(与 v3 的区别) +2. `class-variance-authority` (CVA) 组件变体管理 +3. `tailwind-merge` + `clsx` 类名合并模式 +4. shadcn/ui 的可复制组件模式(非 npm 包,直接复制源码) + +--- + +## 5. 阶段二:前端架构与状态管理 + +### 5.1 Zustand 状态管理 + +**学习目标**:掌握轻量级全局状态管理 + +**核心文件**: +- `src/stores/wiki-store.ts` — 核心 Wiki 状态 +- `src/stores/chat-store.ts` — 聊天状态 +- `src/stores/activity-store.ts` — 活动面板状态 +- `src/stores/review-store.ts` — Review 队列状态 +- `src/stores/research-store.ts` — 深度研究状态 + +**学习要点**: +1. `create()` 函数创建 Store +2. Selector 模式避免不必要的重渲染 (`useWikiStore((s) => s.project)`) +3. Store 组合与派生状态 +4. 状态持久化策略(与 `project-store.ts` 配合) + +**参考代码**: +```typescript +import { create } from "zustand" + +interface WikiStore { + project: WikiProject | null + fileTree: FileNode[] + setProject: (p: WikiProject | null) => void + setFileTree: (tree: FileNode[]) => void +} + +export const useWikiStore = create((set) => ({ + project: null, + fileTree: [], + setProject: (project) => set({ project }), + setFileTree: (fileTree) => set({ fileTree }), +})) +``` + +### 5.2 组件架构与布局 + +**学习目标**:理解复杂桌面应用的组件组织 + +**核心文件**: +- `src/App.tsx` — 应用根组件,项目加载生命周期 +- `src/components/layout/app-layout.tsx` — 三栏布局(可拖拽调整) +- `src/components/layout/icon-sidebar.tsx` — 图标侧边栏导航 + +**学习要点**: +1. **三栏布局模式**:左(知识树/文件树)+ 中(聊天)+ 右(预览) +2. **可拖拽面板实现**:`useRef` + mouse event 监听 + `userSelect: none` +3. **Error Boundary**:`src/components/error-boundary.tsx` 错误边界处理 +4. **条件渲染**:基于 `activeView` 的状态驱动视图切换 + +### 5.3 Milkdown 编辑器集成 + +**学习目标**:理解 ProseMirror 架构的 Markdown 编辑器 + +**核心文件**: +- `src/components/editor/wiki-editor.tsx` +- `src/components/editor/wiki-reader.tsx` + +**学习要点**: +1. Milkdown 的插件化架构 +2. `@milkdown/plugin-math` KaTeX 数学公式支持 +3. 自定义主题集成 (`@milkdown/theme-nord`) + +--- + +## 6. 阶段三:LLM 集成与流式处理 + +### 6.1 多 Provider LLM 客户端 + +**学习目标**:抽象多供应商 LLM API 差异 + +**核心文件**: +- `src/lib/llm-client.ts` — 统一流式聊天接口 +- `src/lib/llm-providers.ts` — Provider 配置与请求构建 +- `src/lib/tauri-fetch.ts` — Tauri HTTP 封装 + +**学习要点**: +1. **统一接口设计**:`streamChat(config, messages, callbacks, signal)` +2. **Provider 抽象**:每个 provider 实现 `buildBody()`、`buildHeaders()`、`parseStream()` +3. **流式响应解析**:SSE (Server-Sent Events) 格式解析 +4. **AbortController 超时控制**:30 分钟超长超时 + 用户取消 +5. **Reasoning Token 处理**:DeepSeek/QwQ 的 `` 块检测与流式展示 + +**参考代码**(流式解析模式): +```typescript +const DECODER = new TextDecoder() + +function parseLines(chunk: Uint8Array, buffer: string): [string[], string] { + const text = buffer + DECODER.decode(chunk, { stream: true }) + const lines = text.split("\n") + const remaining = lines.pop() ?? "" + return [lines, remaining] +} +``` + +### 6.2 CLI 子进程传输 + +**学习目标**:集成 Claude Code / Codex CLI 作为 LLM Provider + +**核心文件**: +- `src/lib/claude-cli-transport.ts` +- `src/lib/codex-cli-transport.ts` +- `src-tauri/src/commands/claude_cli.rs` +- `src-tauri/src/commands/codex_cli.rs` + +**学习要点**: +1. **子进程管理**:`tokio::process::Command` 启动 CLI +2. **行级流式输出**:stdout 逐行读取,实时返回前端 +3. **进程生命周期管理**:spawn / kill / 状态检测 +4. **跨平台路径解析**:`which` crate 查找可执行文件 + +### 6.3 上下文预算管理 + +**学习目标**:LLM 上下文窗口的智能分配 + +**核心文件**: +- `src/lib/context-budget.ts` + +**学习要点**: +1. **预算分配策略**:Index 5% + Pages 50% + History+System ~30% + Response Reserve 15% +2. **Per-page 截断**:`maxPageSize = max(PER_PAGE_FLOOR, pageBudget * PER_PAGE_FRAC)` +3. **可配置 Context Window**:4K ~ 1M tokens 滑杆配置 +4. **降级策略**:小配置下的最小可用保证 + +--- + +## 7. 阶段四:知识图谱与图算法 + +### 7.1 图数据模型构建 + +**学习目标**:从 Markdown 文件构建图结构 + +**核心文件**: +- `src/lib/graph-relevance.ts` — 图构建与相关性计算 +- `src/lib/wiki-graph.ts` — 图数据模型 + 社区检测 + +**学习要点**: +1. **节点模型**:`RetrievalNode` = id + title + type + sources + outLinks + inLinks +2. **边提取**:Wikilink 正则 `\[\[([^\]|]+?)(?:\|[^\]]+?)?\]\]` +3. **Frontmatter 解析**:YAML 解析 title, type, sources 数组 +4. **模块级缓存**:`cachedGraph` 避免重复构建 + +### 7.2 4-Signal 相关性模型 + +**学习目标**:多信号融合的图相关性算法 + +**核心文件**:`src/lib/graph-relevance.ts` + +**学习要点**: + +| 信号 | 权重 | 计算方式 | +|------|------|----------| +| Direct Link | ×3.0 | `[[wikilinks]]` 直接链接 | +| Source Overlap | ×4.0 | Frontmatter `sources[]` 共享源 | +| Adamic-Adar | ×1.5 | 共享邻居的加权相似度 | +| Type Affinity | ×1.0 | 同类型页面亲和度矩阵 | + +**算法细节**: +- Adamic-Adar: `score = Σ(1 / log(|N(u)|))`,共享邻居的度越小权重越高 +- 2-hop 遍历 + 衰减因子 +- 相关性分数归一化与阈值过滤 + +### 7.3 Louvain 社区检测 + +**学习目标**:图聚类算法在知识管理中的应用 + +**核心文件**:`src/lib/wiki-graph.ts` + +**学习要点**: +1. **graphology-communities-louvain** 库使用 +2. **Resolution 参数调优**:控制社区粒度 +3. **Cohesion 计算**:`intraEdges / possibleEdges` +4. **社区信息展示**:Top nodes、Member count、Cohesion score + +### 7.4 图可视化 (sigma.js) + +**学习目标**:大规模图的前端渲染 + +**核心文件**:`src/components/graph/graph-view.tsx` + +**学习要点**: +1. **sigma.js + @react-sigma/core** React 集成 +2. **ForceAtlas2 布局**:`graphology-layout-forceatlas2` +3. **节点样式**:颜色(按类型/社区)、大小(√linkCount) +4. **边样式**:粗细/颜色按相关性权重(绿=强,灰=弱) +5. **交互**:Hover 高亮邻居、Zoom 控制、位置缓存 + +--- + +## 8. 阶段五:搜索与向量检索 + +### 8.1 分词搜索 + +**学习目标**:CJK/英文混合文本检索 + +**核心文件**: +- `src/lib/search.ts` — 前端搜索接口 +- `src-tauri/src/commands/search.rs` — Rust 后端搜索实现 + +**学习要点**: +1. **英文分词**:空格分隔 + 停用词过滤 +2. **CJK Bigram 分词**:`每个 → [每个, 个…]` + 单字补充 +3. **停用词表**:中英文混合停用词 +4. **评分机制**: + - 标题匹配加成 (+50~200) + - 内容词频加成 (per occurrence +20, max 10) + - Token 权重:Title ×5, Content ×1 + +**参考代码**(CJK Bigram): +```typescript +const hasCJK = /[\u4e00-\u9fff\u3400-\u4dbf]/.test(token) +if (hasCJK && token.length > 2) { + const chars = [...token] + for (let i = 0; i < chars.length - 1; i++) { + tokens.push(chars[i] + chars[i + 1]) // Bigram + } + for (const ch of chars) { + if (!STOP_WORDS.has(ch)) tokens.push(ch) // 单字 + } + tokens.push(token) // 完整词 +} +``` + +### 8.2 向量语义搜索 + +**学习目标**:Embedding-based 语义检索 + +**核心文件**: +- `src/lib/embedding.ts` — Embedding 生成与管理 +- `src-tauri/src/commands/vectorstore.rs` — LanceDB 向量存储 + +**学习要点**: +1. **OpenAI-compatible Embedding API**:`/v1/embeddings` +2. **LanceDB**:Rust 嵌入式向量数据库 +3. **文本分块**:`text-chunker.ts` 配置 (targetChars: 1000, overlap: 200) +4. **混合检索 RRF**:Reciprocal Rank Fusion 合并关键词+向量结果 +5. **Cosine Similarity**:余弦相似度计算 + +### 8.3 检索管道设计 + +**学习目标**:多阶段检索架构 + +``` +Phase 1: Tokenized Search (关键词) + ↓ +Phase 1.5: Vector Search (语义,可选) + ↓ +Phase 2: Graph Expansion (图相关性扩展) + ↓ +Phase 3: Budget Control (上下文预算分配) + ↓ +Phase 4: Context Assembly (组装 LLM 上下文) +``` + +--- + +## 9. 阶段六:Rust 后端与桌面应用 + +### 9.1 Tauri Commands 模式 + +**学习目标**:Rust 命令的设计与实现 + +**核心文件**: +- `src-tauri/src/commands/fs.rs` — 文件系统操作 +- `src-tauri/src/commands/search.rs` — 搜索命令 +- `src-tauri/src/commands/project.rs` — 项目管理 + +**学习要点**: +1. **`#[tauri::command]`** 宏标记 +2. **`spawn_blocking`**:同步 I/O(PDF/Office 解析)放到阻塞线程池 +3. **`run_guarded`** / **`run_guarded_async`**:Panic 捕获,防止单文件错误崩溃整个应用 +4. **文件类型检测与分发**:根据扩展名路由到不同解析器 + +### 9.2 多格式文档解析 + +**学习目标**:PDF/Office/图片等格式处理 + +**核心文件**:`src-tauri/src/commands/fs.rs` + +**学习要点**: + +| 格式 | 解析方法 | Rust Crate | +|------|----------|------------| +| PDF | pdfium-render (FFI) | `pdfium-render` | +| DOCX | XML 结构化解析 | `docx-rs` | +| PPTX | ZIP + XML 提取 | `zip` | +| XLSX/ODS | 表格数据提取 | `calamine` | +| ODT/ODP | ZIP 文本提取 | `zip` | +| 图片 | 元数据展示 | `image` | + +**缓存策略**:`.cache/{filename}.txt` 预处理缓存 + +### 9.3 内嵌 HTTP API Server + +**学习目标**:桌面应用内嵌 REST API + +**核心文件**:`src-tauri/src/api_server.rs` + +**学习要点**: +1. **`tiny_http`** 库构建轻量 HTTP 服务器 +2. **端口冲突处理**:自动重试绑定 (port 19828) +3. **速率限制**:滑动窗口限流 (120 req/s) +4. **并发控制**:最大 64 个在途请求 +5. **Panic 隔离**:每个请求在 `catch_unwind` 中执行 +6. **路径安全**:防止目录遍历攻击 (`../` 过滤) + +### 9.4 向量存储 (LanceDB) + +**学习目标**:Rust 中的向量数据库操作 + +**核心文件**:`src-tauri/src/commands/vectorstore.rs` + +**学习要点**: +1. **Arrow 数据模型**:`arrow-array` + `arrow-schema` +2. **向量表设计**:page-level + chunk-level 双表结构 +3. **CRUD 操作**:Upsert / Search / Delete / Count +4. **Embedding 超时**:8 秒超时回退 + +### 9.5 Panic Guard 模式 + +**学习目标**:Rust 错误处理的最佳实践 + +**核心文件**:`src-tauri/src/panic_guard.rs` + +**学习要点**: +- 用 `std::panic::catch_unwind` 捕获第三方库 panic +- 将 panic 转为 `Result` 返回给前端 +- `panic = "unwind"` 的 release 配置(非 abort) + +--- + +## 10. 阶段七:数据持久化与队列系统 + +### 10.1 持久化队列设计 + +**学习目标**:可靠的任务队列实现 + +**核心文件**: +- `src/lib/ingest-queue.ts` — Ingest 队列 +- `src/lib/dedup-queue.ts` — 去重合并队列 + +**学习要点**: +1. **队列状态**:pending → processing → done / failed +2. **持久化**:JSON 文件存盘 (`{project}/.llm-wiki/queue.json`) +3. **重试策略**:最多 3 次自动重试 +4. **项目隔离**:按 `projectId` 隔离队列 +5. **取消支持**:`AbortController` 中断处理 +6. **串行处理**:防止并发文件写入冲突 + +### 10.2 项目状态管理 + +**学习目标**:多项目配置持久化 + +**核心文件**:`src/lib/project-store.ts` + +**学习要点**: +1. **Tauri Store Plugin**:`tauri-plugin-store` 键值存储 +2. **配置分层**:App 级 (全局) + Project 级 (项目内) +3. **最近项目列表**:快速切换 +4. **LLM 配置持久化**:Provider / API Key / Model / Context Size + +### 10.3 自动保存机制 + +**学习目标**:前端状态自动持久化 + +**核心文件**:`src/lib/auto-save.ts` + +**学习要点**: +1. **防抖保存**:变更后延迟写入 +2. **批量合并**:减少 I/O 次数 +3. **错误恢复**:写入失败不重试,避免循环 + +--- + +## 11. 阶段八:测试策略与质量保障 + +### 11.1 测试金字塔 + +**学习目标**:全面的测试覆盖策略 + +``` + /\ E2E / Integration (real-llm) + / \ ↓ 慢,成本高 + /----\ Scenarios (业务场景) + /------\ Property-based (fast-check) + /--------\ Unit Tests (vitest) +``` + +### 11.2 单元测试 + +**核心文件**:`*.test.ts` 遍布各模块 + +**学习要点**: +1. **Vitest** 测试框架配置 (`vite.config.ts` 中 `test.environment: "node"`) +2. **测试文件命名**:`{module}.test.ts` / `{module}.property.test.ts` +3. **Mock 策略**:`mock-stream-chat.ts` 模拟 LLM 流式响应 + +### 11.3 属性测试 (Property-based Testing) + +**学习目标**:基于 fast-check 的随机测试 + +**核心文件**: +- `src/lib/path-utils.property.test.ts` +- `src/lib/review-utils.property.test.ts` + +**学习要点**: +1. **Arbitrary 生成**:随机输入数据生成 +2. **不变量断言**:对任意输入都成立的性质 +3. **Shrink 缩小**:失败时自动最小化复现用例 + +### 11.4 场景测试 (Scenario Testing) + +**学习目标**:业务场景端到端测试 + +**核心文件**:`src/test-helpers/scenarios/*.ts` + +**学习要点**: +1. **Scenario DSL**:定义输入→操作→断言的场景 +2. **Materialize**:将场景转化为实际文件系统状态 +3. **LLM 场景测试**:`*.real-llm.test.ts` 使用真实 LLM API + +### 11.5 Real-LLM 集成测试 + +**学习目标**:与真实 LLM 的集成验证 + +**核心文件**:`*.real-llm.test.ts` + +**学习要点**: +1. **环境隔离**:`.env.test.local` 加载 API Key +2. **超时配置**:长耗时测试(LLM 调用) +3. **串行执行**:`--no-file-parallelism` 避免并发费用爆炸 +4. **条件跳过**:无 API Key 时优雅跳过 + +--- + +## 12. 阶段九:高级主题与工程实践 + +### 12.1 Ingest 流水线设计 + +**学习目标**:复杂的 LLM 驱动数据处理管道 + +**核心文件**:`src/lib/ingest.ts` (1833 行) + +**学习要点**: +1. **双步 Ingest**: + - Step 1: Analysis(LLM 分析源文件 → 结构化分析) + - Step 2: Generation(LLM 基于分析生成 Wiki 页面) +2. **增量缓存**:SHA256 内容哈希,未变更文件跳过 +3. **文件块解析**:`---FILE: path---\ncontent\n---END FILE---` 格式 +4. **路径安全**:防止 `../../../etc/passwd` 等路径遍历 +5. **Source Identity**:稳定的源文件标识与映射 +6. **图片提取与 Caption**:PDF/Office 图片提取 → VLM Caption 生成 + +### 12.2 国际化 (i18n) + +**学习目标**:多语言桌面应用 + +**核心文件**:`src/i18n/index.ts` + +**学习要点**: +1. **react-i18next** 集成 +2. **语言检测**:`detectLanguage.ts` 基于字符集和关键词 +3. **双语界面**:English + Chinese +4. **语言指令**:LLM Prompt 中注入语言要求 + +### 12.3 跨平台兼容 + +**学习目标**:Windows / macOS / Linux 差异处理 + +**学习要点**: +1. **路径规范化**:`normalizePath()` 统一正反斜杠 +2. **Unicode 安全**:字符级切片(防 CJK 截断) +3. **macOS 特性**:Close → Hide(Dock 图标恢复) +4. **Windows/Linux**:退出确认对话框 +5. **CI/CD**:GitHub Actions 多平台构建 + +### 12.4 Chrome Extension (Web Clipper) + +**学习目标**:浏览器扩展开发 + +**核心目录**:`extension/` + +**学习要点**: +1. **Manifest V3**:Chrome 扩展清单 +2. **Readability.js**:文章正文提取 +3. **Turndown.js**:HTML → Markdown 转换 +4. **本地 HTTP 通信**:Extension ↔ App (port 19827) +5. **Project Picker**:多项目选择 + +### 12.5 代码组织模式 + +**学习目标**:大型前端项目的目录结构 + +``` +src/ +├── commands/ # Tauri 命令封装(前端侧) +├── components/ # React 组件(按功能分组) +│ ├── chat/ # 聊天相关 +│ ├── editor/ # 编辑器 +│ ├── graph/ # 图谱 +│ ├── layout/ # 布局 +│ ├── settings/ # 设置 +│ └── ui/ # 基础 UI 组件 +├── lib/ # 业务逻辑(核心!) +│ ├── __tests__/ # 集成测试 +│ ├── ingest*.ts # Ingest 流水线 +│ ├── graph*.ts # 图算法 +│ ├── search*.ts # 搜索 +│ ├── llm*.ts # LLM 客户端 +│ └── ... # 其他业务模块 +├── stores/ # Zustand 状态管理 +├── test-helpers/ # 测试工具与场景 +├── types/ # TypeScript 类型定义 +├── i18n/ # 国际化 +└── App.tsx # 应用入口 +``` + +--- + +## 13. 推荐学习顺序 + +### 快速上手路径(2 周) + +适合想快速理解项目全貌的开发者: + +1. **Day 1-2**: 技术栈基础(Tauri + Vite + React) +2. **Day 3-4**: 状态管理(Zustand)+ 组件架构 +3. **Day 5-7**: LLM 客户端(llm-client.ts, llm-providers.ts) +4. **Day 8-10**: 搜索系统(search.ts + Rust search.rs) +5. **Day 11-14**: Ingest 流水线(ingest.ts) + +### 深度学习路径(6-8 周) + +适合想全面掌握项目工程实践的开发者: + +| 周次 | 主题 | 核心产出 | +|------|------|----------| +| 1 | Tauri + Rust 基础 | 能独立添加一个 Tauri Command | +| 2 | React + Zustand 架构 | 理解状态流,能添加新 Store | +| 3 | LLM 流式处理 | 能集成新的 LLM Provider | +| 4 | 搜索与分词 | 理解 RRF,能优化搜索评分 | +| 5 | 图算法 | 能修改相关性权重或添加新信号 | +| 6 | Rust 后端 | 能添加文件格式支持或 API 端点 | +| 7 | 队列与持久化 | 能设计新的任务队列 | +| 8 | 测试与优化 | 能编写 Property-based 测试 | + +--- + +## 14. 实战练习建议 + +### 练习 1:添加新 LLM Provider +**目标**:在 `llm-providers.ts` 中添加一个自定义 Provider(如 Groq 或 Mistral) +**涉及**:Provider 配置、请求构建、流式解析 + +### 练习 2:优化图相关性算法 +**目标**:在 `graph-relevance.ts` 中添加第 5 个信号(如 TF-IDF 内容相似度) +**涉及**:图遍历、权重计算、缓存策略 + +### 练习 3:实现新的文件格式支持 +**目标**:在 `fs.rs` 中添加 `.epub` 格式解析 +**涉及**:Rust 文件类型检测、第三方 crate 集成、缓存 + +### 练习 4:扩展 Chrome Extension +**目标**:在 Extension 中添加右键菜单"添加到 Wiki" +**涉及**:Manifest V3、Content Script、Background Service Worker + +### 练习 5:添加新的图布局算法 +**目标**:在 `graph-view.tsx` 中切换 ForceAtlas2 和 circular 布局 +**涉及**:sigma.js 布局、React 状态同步、动画过渡 + +### 练习 6:编写 Property-based 测试 +**目标**:为 `tokenizeQuery` 函数编写 fast-check 属性测试 +**涉及**:Arbitrary 生成、不变量定义、Shrink 验证 + +### 练习 7:实现本地 Embedding 端点 +**目标**:在 `embedding.ts` 中添加 Ollama Embedding 支持 +**涉及**:HTTP 请求、向量验证、错误回退 + +--- + +## 附录:关键文件速查表 + +| 主题 | 文件路径 | 说明 | +|------|----------|------| +| Tauri 入口 | `src-tauri/src/lib.rs` | 应用初始化、命令注册 | +| Tauri 命令 | `src-tauri/src/commands/fs.rs` | 文件读写、格式解析 | +| API Server | `src-tauri/src/api_server.rs` | HTTP API、速率限制 | +| 向量存储 | `src-tauri/src/commands/vectorstore.rs` | LanceDB 向量操作 | +| 搜索后端 | `src-tauri/src/commands/search.rs` | 关键词+向量搜索 | +| 前端入口 | `src/App.tsx` | 项目加载、初始化 | +| 布局组件 | `src/components/layout/app-layout.tsx` | 三栏拖拽布局 | +| 状态管理 | `src/stores/wiki-store.ts` | 全局状态 | +| LLM 客户端 | `src/lib/llm-client.ts` | 统一流式接口 | +| Provider | `src/lib/llm-providers.ts` | 多供应商配置 | +| Ingest | `src/lib/ingest.ts` | 双步 Ingest 流水线 | +| 图相关性 | `src/lib/graph-relevance.ts` | 4-Signal 模型 | +| 图可视化 | `src/components/graph/graph-view.tsx` | sigma.js 渲染 | +| 搜索前端 | `src/lib/search.ts` | 分词搜索接口 | +| Embedding | `src/lib/embedding.ts` | 向量生成 | +| 上下文预算 | `src/lib/context-budget.ts` | 预算分配算法 | +| 队列系统 | `src/lib/ingest-queue.ts` | 持久化任务队列 | +| i18n | `src/i18n/index.ts` | 国际化配置 | +| Vite 配置 | `vite.config.ts` | 构建配置 | + +--- + +*本文档由代码分析自动生成,建议结合实际代码阅读以获得最佳学习效果。* diff --git a/src-tauri/vendor/soup3-0.5.0/.cargo-ok b/src-tauri/vendor/soup3-0.5.0/.cargo-ok new file mode 100644 index 00000000..5f8b7958 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/.cargo-ok @@ -0,0 +1 @@ +{"v":1} \ No newline at end of file diff --git a/src-tauri/vendor/soup3-0.5.0/.cargo_vcs_info.json b/src-tauri/vendor/soup3-0.5.0/.cargo_vcs_info.json new file mode 100644 index 00000000..1490835b --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "d68d8bd68b2b0c6730ccfab9490bffdef38839c1" + }, + "path_in_vcs": "" +} \ No newline at end of file diff --git a/src-tauri/vendor/soup3-0.5.0/.gitignore b/src-tauri/vendor/soup3-0.5.0/.gitignore new file mode 100644 index 00000000..a9d37c56 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/src-tauri/vendor/soup3-0.5.0/.gitlab-ci.yml b/src-tauri/vendor/soup3-0.5.0/.gitlab-ci.yml new file mode 100644 index 00000000..d8d5168e --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/.gitlab-ci.yml @@ -0,0 +1,65 @@ +variables: + # format is = + # the name is used in the URL + # latest release must be at the top + # (only relevant on main branch) + RELEASES: | + v0.4=0.4 + +image: "debian:testing" + +before_script: + - apt update; apt install -y --no-install-recommends git build-essential libsoup-3.0-dev libglib2.0-dev ca-certificates meson cmake libnghttp2-dev libsqlite3-dev libpsl-dev glib-networking curl + # compile libsoup3 + - git clone --recursive https://gitlab.gnome.org/GNOME/libsoup + - cd libsoup + - meson build -Dprefix=/usr -Dbrotli=enabled -Ddocs=disabled -Dinstalled_tests=false -Dvapi=disabled + - cd build + - ninja install + - cd ../../ + + - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y + - source $HOME/.cargo/env + - rustup toolchain install nightly --profile minimal --allow-downgrade -c rustfmt + + - git submodule update --init + - curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py + https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py + - chmod +x gir-rustdoc.py + +build: + script: + - cargo build --all-features --examples + - cargo test + +docs: + stage: test + variables: + GIT_SUBMODULE_STRATEGY: recursive + RUSTFLAGS: --cfg docsrs + script: + # generate the docs + - cargo install rustdoc-stripper + - ./generator.py --embed-docs + - rustup default nightly + - eval $(./gir-rustdoc.py pre-docs) + - cargo doc --all-features --no-deps + - mv target/doc/ docs + artifacts: + paths: + - docs + +pages: + stage: deploy + script: + - ./gir-rustdoc.py html-index + # main docs + - mkdir public/git + - mv docs public/git/docs + # stable docs + # - ./gir-rustdoc.py docs-from-artifacts + artifacts: + paths: + - public + rules: + - if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH diff --git a/src-tauri/vendor/soup3-0.5.0/.gitmodules b/src-tauri/vendor/soup3-0.5.0/.gitmodules new file mode 100644 index 00000000..7647c6e8 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/.gitmodules @@ -0,0 +1,6 @@ +[submodule "gir-files"] + path = gir-files + url = https://github.com/gtk-rs/gir-files +[submodule "gir"] + path = gir + url = https://github.com/gtk-rs/gir diff --git a/src-tauri/vendor/soup3-0.5.0/Cargo.toml b/src-tauri/vendor/soup3-0.5.0/Cargo.toml new file mode 100644 index 00000000..9fbaedfe --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/Cargo.toml @@ -0,0 +1,78 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.70" +name = "soup3" +version = "0.5.0" +exclude = [ + "gir", + "gir-files", + "generator.py", + "Soup-3.0.gir", +] +description = "Soup crate for Rust" +readme = "README.md" +keywords = [ + "soup", + "gtk-rs", + "gnome", +] +license = "MIT" +repository = "https://gitlab.gnome.org/World/Rust/soup3-rs" + +[package.metadata.docs.rs] +all-features = true +rustc-args = [ + "--cfg", + "docsrs", +] +rustdoc-args = [ + "--cfg", + "docsrs", +] + +[lib] +name = "soup" + +[dependencies.ffi] +version = "0.5" +package = "soup3-sys" + +[dependencies.futures-channel] +version = "0.3" + +[dependencies.gio] +version = "0.18" +features = ["v2_68"] + +[dependencies.glib] +version = "0.18" +features = ["v2_66"] + +[dependencies.libc] +version = "0.2" + +[dev-dependencies.gir-format-check] +version = "^0.1" + +[dev-dependencies.rustdoc-stripper] +version = "^0.1.5" + +[features] +default = ["ffi/v3_0"] +v2_70 = ["gio/v2_70"] +v3_2 = ["ffi/v3_2"] +v3_4 = [ + "v3_2", + "ffi/v3_4", +] diff --git a/src-tauri/vendor/soup3-0.5.0/Cargo.toml.orig b/src-tauri/vendor/soup3-0.5.0/Cargo.toml.orig new file mode 100644 index 00000000..f482988b --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/Cargo.toml.orig @@ -0,0 +1,48 @@ +[package] +name = "soup3" +version = "0.5.0" +edition = "2021" +rust-version = "1.70" +description = "Soup crate for Rust" +repository = "https://gitlab.gnome.org/World/Rust/soup3-rs" +license = "MIT" +keywords = ["soup", "gtk-rs", "gnome"] +exclude = ["gir", "gir-files", "generator.py", "Soup-3.0.gir"] + +[package.metadata.docs.rs] +all-features = true +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs"] + +[lib] +name = "soup" + +[dependencies] +libc = "0.2" +futures-channel = "0.3" + +[dependencies.ffi] +package = "soup3-sys" +path = "sys" +version = "0.5" + +[dependencies.glib] +git = "https://github.com/gtk-rs/gtk-rs-core" +branch = "0.18" +version = "0.18" +features = [ "v2_66" ] + +[dependencies.gio] +git = "https://github.com/gtk-rs/gtk-rs-core" +branch = "0.18" +version = "0.18" +features = [ "v2_70" ] + +[features] +default = ["ffi/v3_0"] +v3_2 = ["ffi/v3_2"] +v3_4 = ["v3_2", "ffi/v3_4"] + +[dev-dependencies] +rustdoc-stripper = "^0.1.5" +gir-format-check = "^0.1" diff --git a/src-tauri/vendor/soup3-0.5.0/Gir.toml b/src-tauri/vendor/soup3-0.5.0/Gir.toml new file mode 100644 index 00000000..e3298cd3 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/Gir.toml @@ -0,0 +1,329 @@ +[external_libraries] +Gio = {min_version = "2.66"} + +[options] +girs_directories = [".", "./gir-files"] +library = "Soup" +version = "3.0" +min_cfg_version = "3.0" +target_path = "." +work_mode = "normal" +generate_safety_asserts = true +deprecate_by_min_version = true +single_version_file = true +use_gi_docgen = true + +external_libraries = [ + "GLib", + "GObject", +] + +generate = [ + # "Soup.*", + "Soup.Auth", + "Soup.AuthBasic", + "Soup.AuthDigest", + "Soup.AuthDomainBasicAuthCallback", + "Soup.AuthDomainFilter", + "Soup.AuthDomainGenericAuthCallback", + "Soup.AuthManager", + "Soup.AuthNegotiate", + "Soup.AuthNTLM", + "Soup.Cache", + "Soup.Cacheability", + "Soup.CacheType", + "Soup.ContentDecoder", + "Soup.ContentSniffer", + "Soup.CookieJarAcceptPolicy", + "Soup.CookieJarDB", + "Soup.CookieJarText", + "Soup.DateFormat", + "Soup.Encoding", + "Soup.Expectation", + "Soup.HSTSEnforcer", + "Soup.HSTSEnforcerDB", + # "Soup.HSTSPolicy", + "Soup.HTTPVersion", + # "Soup.Logger", + "Soup.LoggerFilter", + "Soup.LoggerLogLevel", + "Soup.LoggerPrinter", + "Soup.MemoryUse", + # "Soup.Message", + # "Soup.MessageBody", + "Soup.MessageFlags", + # "Soup.MessageHeadersIter", + "Soup.MessageHeadersType", + "Soup.MessageMetrics", + "Soup.MessagePriority", + "Soup.Multipart", + # "Soup.MultipartInputStream", + # "Soup.Range", + "Soup.SameSitePolicy", + "Soup.ServerMessage", + "Soup.ServerListenOptions", + "Soup.SessionError", + "Soup.SessionFeature", + "Soup.Status", + "Soup.TLDError", + "Soup.URIComponent", + "Soup.WebsocketCloseCode", + # "Soup.WebsocketConnection", + "Soup.WebsocketConnectionType", + "Soup.WebsocketDataType", + "Soup.WebsocketError", + "Soup.WebsocketExtension", + # "Soup.WebsocketExtensionDeflate", + "Soup.WebsocketExtensionManager", + "Soup.WebsocketState", +] + +manual = [ + "Gio.AsyncResult", + "Gio.Cancellable", + "Gio.File", + "Gio.FilterInputStream", + "Gio.InputStream", + "Gio.IOStream", + "Gio.InetSocketAddress", + "Gio.OutputStream", + "Gio.OutputStreamSpliceFlags", + "Gio.PollableInputStream", + "Gio.ProxyResolver", + "Gio.Socket", + "Gio.SocketAddress", + "Gio.SocketClientEvent", + "Gio.SocketConnectable", + "Gio.TlsCertificate", + "Gio.TlsCertificateFlags", + "Gio.TlsClientConnection", + "Gio.TlsDatabase", + "Gio.TlsInteraction", + "Gio.TlsAuthenticationMode", + "Gio.TlsPassword", + "Gio.TlsProtocolVersion", + "GLib.Bytes", + "GLib.DateTime", + "GLib.DestroyNotify", + "GLib.Error", + "GLib.HashTable", + "GLib.IOChannel", + "GLib.IOCondition", + "GLib.IOFunc", + "GLib.List", + "GLib.MainContext", + "GLib.Priority", + "GLib.PtrArray", + "GLib.Quark", + "GLib.SList", + "GLib.Source", + "GLib.SourceFunc", + "GLib.Uri", + # "GLib.Value", + # "GLib.ValueArray", + "GLib.Variant", + "GObject.Object" + # "GLib.Data", + # "GLib.TimeVal", +] + +[[object]] +name="Soup.Cookie" +status = "generate" + [[object.function]] + name = "equal" + [[object.function.parameter]] + name = "cookie1" + const = true + [[object.function.parameter]] + name = "cookie2" + const = true + +[[object]] +name="Soup.CookieJar" +status = "generate" +manual_traits = ["CookieJarExtManual"] + [[object.function]] + name = "add_cookie" + manual = true + [[object.function]] + name = "add_cookie_full" + manual = true + [[object.function]] + name = "add_cookie_with_first_party" + manual = true + [[object.function]] + name = "delete_cookie" + manual = true + +[[object]] +name="Soup.AuthDomain" +status="generate" + [[object.property]] + name="filter" + ignore=true + [[object.property]] + name="generic-auth-callback" + ignore=true + +[[object]] +name="Soup.AuthDomainBasic" +status="generate" + [[object.property]] + name="auth-callback" + ignore=true + +[[object]] +name="Soup.AuthDomainDigest" +status="generate" + [[object.property]] + name="auth-callback" + ignore=true + +[[object]] +name="Soup.Server" +manual_traits = ["ServerExtManual"] +status="generate" + [[object.function]] + name="add_early_handler" + manual = true + [[object.function]] + name="add_handler" + manual = true + [[object.function]] + name="add_websocket_handler" + manual = true + +[[object]] +name = "Soup.Session" +status = "generate" +generate_builder = true +manual_traits = ["SessionExtManual"] + [[object.function]] + name = "websocket_connect_async" + ignore = true + +[[object]] +name="Soup.Logger" +status = "generate" + [[object.function]] + name = "set_printer" + manual = true + +[[object]] +name="Soup.MessageBody" +status = "generate" + [[object.function]] + name = "append" + ignore = true + + +# [[object]] +# name="Soup.CookieJar" +# status = "generate" +# [[object.function]] +# name = "add_cookie" +# ignore= true +# [[object.function]] +# name = "add_cookie_with_first_party" +# ignore= true +# [[object.function]] +# name = "add_cookie_full" +# ignore= true +# [[object.function]] +# name = "get_cookie_list_with_same_site_info" +# ignore= true + +[[object]] +name="Soup.WebsocketConnection" +manual_traits = ["WebsocketConnectionExtManual"] +status="generate" + [[object.function]] + name = "new" + manual = true + [[object.function]] + name = "send_binary" + ignore = true + [[object.function]] + name = "send_message" + ignore = true + +[[object]] +name="Soup.WebsocketExtensionDeflate" +version="2.68" +status="generate" + +[[object]] +name="Soup.MultipartInputStream" +status="generate" + [[object.function]] + name="next_part_async" + ignore=true + +[[object]] +name="Soup.Message" +status="generate" + [[object.function]] + name="new" + [object.function.return] + nullable_return_is_error = "Invalid URL" + [[object.function]] + name="new_from_encoded_form" + [object.function.return] + nullable_return_is_error = "Invalid URL" + [[object.function]] + name="new_from_multipart" + [object.function.return] + nullable_return_is_error = "Invalid URL" + [[object.function]] + name = "get_site_for_cookies" + ignore = true + [[object.function]] + name = "set_site_for_cookies" + ignore = true + [[object.function]] + name="set_chunk_allocator" + ignore=true + +[[object]] +name="Soup.MessageHeaders" +status="generate" + [[object.function]] + name = "get_content_disposition" + manual = true + [[object.function]] + name = "set_content_disposition" + manual = true + [[object.function]] + name = "get_content_type" + manual = true + [[object.function]] + name = "set_content_type" + manual = true + +[[object]] +name="Soup.HSTSPolicy" +status="generate" + [[object.function]] + name="equal" + ignore=true + +[[object]] +name="Soup.*" +status="generate" + [[object.function]] + name = "(header_g_string_append_param|soup_header_g_string_append_param_quoted)" + manual = true + [[object.function]] + name = "cookies_free" + ignore = true + [[object.function]] + name = "cookies_to_cookie_header" + ignore = true + [[object.function]] + name = "cookies_to_request" + ignore = true + [[object.function]] + name = "cookies_to_response" + ignore = true + diff --git a/src-tauri/vendor/soup3-0.5.0/LICENSE b/src-tauri/vendor/soup3-0.5.0/LICENSE new file mode 100644 index 00000000..09f3e726 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2013-2017, The Gtk-rs Project Developers. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/src-tauri/vendor/soup3-0.5.0/README.md b/src-tauri/vendor/soup3-0.5.0/README.md new file mode 100644 index 00000000..cd552a91 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/README.md @@ -0,0 +1,41 @@ +# Soup3-rs + +[Project site](https://gitlab.gnome.org/World/Rust/soup3-rs) | [Online documentation](https://world.pages.gitlab.gnome.org/Rust/soup3-rs/git/docs/soup/) + +__Rust__ bindings and wrappers for __libsoup__ v3. + +## Using + +We recommend using [crates from crates.io](https://crates.io/crates/soup3). + +If you want to track the bleeding edge, use the git dependency instead: + +```toml +[dependencies] +soup3 = { git = "https://gitlab.gnome.org/World/Rust/soup3-rs" } +``` + +Avoid mixing versioned and git crates like this: + +```toml +# This will not compile +[dependencies] +gtk3 = "0.15" +soup3 = { git = "https://gitlab.gnome.org/World/Rust/soup3-rs" } +``` + +## Minimum supported Rust version + +Currently, the minimum supported Rust version is `1.56.0`. + +## Documentation + +https://world.pages.gitlab.gnome.org/Rust/soup3-rs/git/docs/soup + +## Contribute + +Contributor you're welcome! + +## License + +__soup3-rs__ is available under the MIT License, please refer to it. diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth.rs new file mode 100644 index 00000000..74f3e007 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth.rs @@ -0,0 +1,328 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::Message; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupAuth")] + pub struct Auth(Object); + + match fn { + type_ => || ffi::soup_auth_get_type(), + } +} + +impl Auth { + pub const NONE: Option<&'static Auth> = None; + + #[doc(alias = "soup_auth_new")] + pub fn new(type_: glib::types::Type, msg: &Message, auth_header: &str) -> Option { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::soup_auth_new( + type_.into_glib(), + msg.to_glib_none().0, + auth_header.to_glib_none().0, + )) + } + } +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait AuthExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_auth_authenticate")] + fn authenticate(&self, username: &str, password: &str) { + unsafe { + ffi::soup_auth_authenticate( + self.as_ref().to_glib_none().0, + username.to_glib_none().0, + password.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_auth_can_authenticate")] + fn can_authenticate(&self) -> bool { + unsafe { + from_glib(ffi::soup_auth_can_authenticate( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_cancel")] + fn cancel(&self) { + unsafe { + ffi::soup_auth_cancel(self.as_ref().to_glib_none().0); + } + } + + //#[doc(alias = "soup_auth_free_protection_space")] + //fn free_protection_space(&self, space: /*Unimplemented*/&[&Basic: Pointer]) { + // unsafe { TODO: call ffi:soup_auth_free_protection_space() } + //} + + #[doc(alias = "soup_auth_get_authority")] + #[doc(alias = "get_authority")] + fn authority(&self) -> Option { + unsafe { from_glib_none(ffi::soup_auth_get_authority(self.as_ref().to_glib_none().0)) } + } + + #[doc(alias = "soup_auth_get_authorization")] + #[doc(alias = "get_authorization")] + fn authorization(&self, msg: &Message) -> Option { + unsafe { + from_glib_full(ffi::soup_auth_get_authorization( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_get_info")] + #[doc(alias = "get_info")] + fn info(&self) -> Option { + unsafe { from_glib_full(ffi::soup_auth_get_info(self.as_ref().to_glib_none().0)) } + } + + #[doc(alias = "soup_auth_get_protection_space")] + #[doc(alias = "get_protection_space")] + fn protection_space(&self, source_uri: &glib::Uri) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_auth_get_protection_space( + self.as_ref().to_glib_none().0, + source_uri.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_get_realm")] + #[doc(alias = "get_realm")] + fn realm(&self) -> Option { + unsafe { from_glib_none(ffi::soup_auth_get_realm(self.as_ref().to_glib_none().0)) } + } + + #[doc(alias = "soup_auth_get_scheme_name")] + #[doc(alias = "get_scheme_name")] + fn scheme_name(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_auth_get_scheme_name( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_is_authenticated")] + fn is_authenticated(&self) -> bool { + unsafe { + from_glib(ffi::soup_auth_is_authenticated( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_is_cancelled")] + fn is_cancelled(&self) -> bool { + unsafe { from_glib(ffi::soup_auth_is_cancelled(self.as_ref().to_glib_none().0)) } + } + + #[doc(alias = "soup_auth_is_for_proxy")] + fn is_for_proxy(&self) -> bool { + unsafe { from_glib(ffi::soup_auth_is_for_proxy(self.as_ref().to_glib_none().0)) } + } + + #[doc(alias = "soup_auth_is_ready")] + fn is_ready(&self, msg: &Message) -> bool { + unsafe { + from_glib(ffi::soup_auth_is_ready( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_update")] + fn update(&self, msg: &Message, auth_header: &str) -> bool { + unsafe { + from_glib(ffi::soup_auth_update( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + auth_header.to_glib_none().0, + )) + } + } + + fn set_authority(&self, authority: Option<&str>) { + ObjectExt::set_property(self.as_ref(), "authority", authority) + } + + #[doc(alias = "is-for-proxy")] + fn set_is_for_proxy(&self, is_for_proxy: bool) { + ObjectExt::set_property(self.as_ref(), "is-for-proxy", is_for_proxy) + } + + fn set_realm(&self, realm: Option<&str>) { + ObjectExt::set_property(self.as_ref(), "realm", realm) + } + + #[doc(alias = "authority")] + fn connect_authority_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_authority_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupAuth, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Auth::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::authority\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_authority_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "is-authenticated")] + fn connect_is_authenticated_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_is_authenticated_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupAuth, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Auth::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-authenticated\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_is_authenticated_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "is-cancelled")] + fn connect_is_cancelled_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_is_cancelled_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupAuth, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Auth::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-cancelled\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_is_cancelled_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "is-for-proxy")] + fn connect_is_for_proxy_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_is_for_proxy_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupAuth, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Auth::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-for-proxy\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_is_for_proxy_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "realm")] + fn connect_realm_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_realm_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupAuth, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Auth::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::realm\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_realm_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "scheme-name")] + fn connect_scheme_name_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_scheme_name_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupAuth, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Auth::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::scheme-name\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_scheme_name_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl> AuthExt for O {} + +impl fmt::Display for Auth { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("Auth") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_basic.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_basic.rs new file mode 100644 index 00000000..1cb98f68 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_basic.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::Auth; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupAuthBasic")] + pub struct AuthBasic(Object) @extends Auth; + + match fn { + type_ => || ffi::soup_auth_basic_get_type(), + } +} + +impl AuthBasic {} + +impl fmt::Display for AuthBasic { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthBasic") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_digest.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_digest.rs new file mode 100644 index 00000000..c5af4c1f --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_digest.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::Auth; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupAuthDigest")] + pub struct AuthDigest(Object) @extends Auth; + + match fn { + type_ => || ffi::soup_auth_digest_get_type(), + } +} + +impl AuthDigest {} + +impl fmt::Display for AuthDigest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthDigest") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain.rs new file mode 100644 index 00000000..f6c1bbd5 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain.rs @@ -0,0 +1,253 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::ServerMessage; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupAuthDomain")] + pub struct AuthDomain(Object); + + match fn { + type_ => || ffi::soup_auth_domain_get_type(), + } +} + +impl AuthDomain { + pub const NONE: Option<&'static AuthDomain> = None; +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait AuthDomainExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_auth_domain_accepts")] + fn accepts(&self, msg: &ServerMessage) -> Option { + unsafe { + from_glib_full(ffi::soup_auth_domain_accepts( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_domain_add_path")] + fn add_path(&self, path: &str) { + unsafe { + ffi::soup_auth_domain_add_path(self.as_ref().to_glib_none().0, path.to_glib_none().0); + } + } + + #[doc(alias = "soup_auth_domain_challenge")] + fn challenge(&self, msg: &ServerMessage) { + unsafe { + ffi::soup_auth_domain_challenge(self.as_ref().to_glib_none().0, msg.to_glib_none().0); + } + } + + #[doc(alias = "soup_auth_domain_check_password")] + fn check_password(&self, msg: &ServerMessage, username: &str, password: &str) -> bool { + unsafe { + from_glib(ffi::soup_auth_domain_check_password( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + username.to_glib_none().0, + password.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_domain_covers")] + fn covers(&self, msg: &ServerMessage) -> bool { + unsafe { + from_glib(ffi::soup_auth_domain_covers( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_domain_get_realm")] + #[doc(alias = "get_realm")] + fn realm(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_auth_domain_get_realm( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_auth_domain_remove_path")] + fn remove_path(&self, path: &str) { + unsafe { + ffi::soup_auth_domain_remove_path( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_auth_domain_set_filter")] + fn set_filter bool + 'static>(&self, filter: P) { + let filter_data: Box_

= Box_::new(filter); + unsafe extern "C" fn filter_func bool + 'static>( + domain: *mut ffi::SoupAuthDomain, + msg: *mut ffi::SoupServerMessage, + user_data: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let domain = from_glib_borrow(domain); + let msg = from_glib_borrow(msg); + let callback: &P = &*(user_data as *mut _); + (*callback)(&domain, &msg).into_glib() + } + let filter = Some(filter_func::

as _); + unsafe extern "C" fn dnotify_func bool + 'static>( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call3 = Some(dnotify_func::

as _); + let super_callback0: Box_

= filter_data; + unsafe { + ffi::soup_auth_domain_set_filter( + self.as_ref().to_glib_none().0, + filter, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + ); + } + } + + #[doc(alias = "soup_auth_domain_set_generic_auth_callback")] + fn set_generic_auth_callback bool + 'static>( + &self, + auth_callback: P, + ) { + let auth_callback_data: Box_

= Box_::new(auth_callback); + unsafe extern "C" fn auth_callback_func< + P: Fn(&AuthDomain, &ServerMessage, &str) -> bool + 'static, + >( + domain: *mut ffi::SoupAuthDomain, + msg: *mut ffi::SoupServerMessage, + username: *const libc::c_char, + user_data: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let domain = from_glib_borrow(domain); + let msg = from_glib_borrow(msg); + let username: Borrowed = from_glib_borrow(username); + let callback: &P = &*(user_data as *mut _); + (*callback)(&domain, &msg, username.as_str()).into_glib() + } + let auth_callback = Some(auth_callback_func::

as _); + unsafe extern "C" fn dnotify_func< + P: Fn(&AuthDomain, &ServerMessage, &str) -> bool + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call3 = Some(dnotify_func::

as _); + let super_callback0: Box_

= auth_callback_data; + unsafe { + ffi::soup_auth_domain_set_generic_auth_callback( + self.as_ref().to_glib_none().0, + auth_callback, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + ); + } + } + + //#[doc(alias = "filter-data")] + //fn filter_data(&self) -> /*Unimplemented*/Basic: Pointer { + // ObjectExt::property(self.as_ref(), "filter-data") + //} + + //#[doc(alias = "filter-data")] + //fn set_filter_data(&self, filter_data: /*Unimplemented*/Basic: Pointer) { + // ObjectExt::set_property(self.as_ref(),"filter-data", filter_data) + //} + + //#[doc(alias = "generic-auth-data")] + //fn generic_auth_data(&self) -> /*Unimplemented*/Basic: Pointer { + // ObjectExt::property(self.as_ref(), "generic-auth-data") + //} + + //#[doc(alias = "generic-auth-data")] + //fn set_generic_auth_data(&self, generic_auth_data: /*Unimplemented*/Basic: Pointer) { + // ObjectExt::set_property(self.as_ref(),"generic-auth-data", generic_auth_data) + //} + + fn is_proxy(&self) -> bool { + ObjectExt::property(self.as_ref(), "proxy") + } + + #[doc(alias = "filter-data")] + fn connect_filter_data_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_filter_data_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupAuthDomain, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(AuthDomain::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::filter-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_filter_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "generic-auth-data")] + fn connect_generic_auth_data_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_generic_auth_data_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupAuthDomain, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(AuthDomain::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::generic-auth-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_generic_auth_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl> AuthDomainExt for O {} + +impl fmt::Display for AuthDomain { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthDomain") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_basic.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_basic.rs new file mode 100644 index 00000000..0c6c1e67 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_basic.rs @@ -0,0 +1,111 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{AuthDomain, ServerMessage}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupAuthDomainBasic")] + pub struct AuthDomainBasic(Object) @extends AuthDomain; + + match fn { + type_ => || ffi::soup_auth_domain_basic_get_type(), + } +} + +impl AuthDomainBasic { + //#[doc(alias = "soup_auth_domain_basic_new")] + //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> AuthDomainBasic { + // unsafe { TODO: call ffi:soup_auth_domain_basic_new() } + //} + + #[doc(alias = "soup_auth_domain_basic_set_auth_callback")] + pub fn set_auth_callback< + P: Fn(&AuthDomainBasic, &ServerMessage, &str, &str) -> bool + 'static, + >( + &self, + callback: P, + ) { + let callback_data: Box_

= Box_::new(callback); + unsafe extern "C" fn callback_func< + P: Fn(&AuthDomainBasic, &ServerMessage, &str, &str) -> bool + 'static, + >( + domain: *mut ffi::SoupAuthDomainBasic, + msg: *mut ffi::SoupServerMessage, + username: *const libc::c_char, + password: *const libc::c_char, + user_data: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let domain = from_glib_borrow(domain); + let msg = from_glib_borrow(msg); + let username: Borrowed = from_glib_borrow(username); + let password: Borrowed = from_glib_borrow(password); + let callback: &P = &*(user_data as *mut _); + (*callback)(&domain, &msg, username.as_str(), password.as_str()).into_glib() + } + let callback = Some(callback_func::

as _); + unsafe extern "C" fn dnotify_func< + P: Fn(&AuthDomainBasic, &ServerMessage, &str, &str) -> bool + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call3 = Some(dnotify_func::

as _); + let super_callback0: Box_

= callback_data; + unsafe { + ffi::soup_auth_domain_basic_set_auth_callback( + self.to_glib_none().0, + callback, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + ); + } + } + + //#[doc(alias = "auth-data")] + //pub fn auth_data(&self) -> /*Unimplemented*/Basic: Pointer { + // ObjectExt::property(self, "auth-data") + //} + + //#[doc(alias = "auth-data")] + //pub fn set_auth_data(&self, auth_data: /*Unimplemented*/Basic: Pointer) { + // ObjectExt::set_property(self,"auth-data", auth_data) + //} + + #[doc(alias = "auth-data")] + pub fn connect_auth_data_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_auth_data_trampoline( + this: *mut ffi::SoupAuthDomainBasic, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::auth-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_auth_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl fmt::Display for AuthDomainBasic { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthDomainBasic") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_digest.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_digest.rs new file mode 100644 index 00000000..91bc7c59 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_domain_digest.rs @@ -0,0 +1,121 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{AuthDomain, ServerMessage}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupAuthDomainDigest")] + pub struct AuthDomainDigest(Object) @extends AuthDomain; + + match fn { + type_ => || ffi::soup_auth_domain_digest_get_type(), + } +} + +impl AuthDomainDigest { + //#[doc(alias = "soup_auth_domain_digest_new")] + //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> AuthDomainDigest { + // unsafe { TODO: call ffi:soup_auth_domain_digest_new() } + //} + + #[doc(alias = "soup_auth_domain_digest_set_auth_callback")] + pub fn set_auth_callback< + P: Fn(&AuthDomainDigest, &ServerMessage, &str) -> Option + 'static, + >( + &self, + callback: P, + ) { + let callback_data: Box_

= Box_::new(callback); + unsafe extern "C" fn callback_func< + P: Fn(&AuthDomainDigest, &ServerMessage, &str) -> Option + 'static, + >( + domain: *mut ffi::SoupAuthDomainDigest, + msg: *mut ffi::SoupServerMessage, + username: *const libc::c_char, + user_data: glib::ffi::gpointer, + ) -> *mut libc::c_char { + let domain = from_glib_borrow(domain); + let msg = from_glib_borrow(msg); + let username: Borrowed = from_glib_borrow(username); + let callback: &P = &*(user_data as *mut _); + (*callback)(&domain, &msg, username.as_str()).to_glib_full() + } + let callback = Some(callback_func::

as _); + unsafe extern "C" fn dnotify_func< + P: Fn(&AuthDomainDigest, &ServerMessage, &str) -> Option + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call3 = Some(dnotify_func::

as _); + let super_callback0: Box_

= callback_data; + unsafe { + ffi::soup_auth_domain_digest_set_auth_callback( + self.to_glib_none().0, + callback, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + ); + } + } + + //#[doc(alias = "auth-data")] + //pub fn auth_data(&self) -> /*Unimplemented*/Basic: Pointer { + // ObjectExt::property(self, "auth-data") + //} + + //#[doc(alias = "auth-data")] + //pub fn set_auth_data(&self, auth_data: /*Unimplemented*/Basic: Pointer) { + // ObjectExt::set_property(self,"auth-data", auth_data) + //} + + #[doc(alias = "soup_auth_domain_digest_encode_password")] + pub fn encode_password(username: &str, realm: &str, password: &str) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_auth_domain_digest_encode_password( + username.to_glib_none().0, + realm.to_glib_none().0, + password.to_glib_none().0, + )) + } + } + + #[doc(alias = "auth-data")] + pub fn connect_auth_data_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_auth_data_trampoline( + this: *mut ffi::SoupAuthDomainDigest, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::auth-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_auth_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl fmt::Display for AuthDomainDigest { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthDomainDigest") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_manager.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_manager.rs new file mode 100644 index 00000000..12db3c74 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_manager.rs @@ -0,0 +1,43 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{Auth, SessionFeature}; +use glib::{prelude::*, translate::*}; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupAuthManager")] + pub struct AuthManager(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_auth_manager_get_type(), + } +} + +impl AuthManager { + #[doc(alias = "soup_auth_manager_clear_cached_credentials")] + pub fn clear_cached_credentials(&self) { + unsafe { + ffi::soup_auth_manager_clear_cached_credentials(self.to_glib_none().0); + } + } + + #[doc(alias = "soup_auth_manager_use_auth")] + pub fn use_auth(&self, uri: &glib::Uri, auth: &impl IsA) { + unsafe { + ffi::soup_auth_manager_use_auth( + self.to_glib_none().0, + uri.to_glib_none().0, + auth.as_ref().to_glib_none().0, + ); + } + } +} + +impl fmt::Display for AuthManager { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthManager") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_negotiate.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_negotiate.rs new file mode 100644 index 00000000..cf4aed9a --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_negotiate.rs @@ -0,0 +1,31 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::Auth; +use glib::translate::*; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupAuthNegotiate")] + pub struct AuthNegotiate(Object) @extends Auth; + + match fn { + type_ => || ffi::soup_auth_negotiate_get_type(), + } +} + +impl AuthNegotiate { + #[doc(alias = "soup_auth_negotiate_supported")] + pub fn supported() -> bool { + assert_initialized_main_thread!(); + unsafe { from_glib(ffi::soup_auth_negotiate_supported()) } + } +} + +impl fmt::Display for AuthNegotiate { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthNegotiate") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/auth_ntlm.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_ntlm.rs new file mode 100644 index 00000000..e929151f --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/auth_ntlm.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::Auth; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupAuthNTLM")] + pub struct AuthNTLM(Object) @extends Auth; + + match fn { + type_ => || ffi::soup_auth_ntlm_get_type(), + } +} + +impl AuthNTLM {} + +impl fmt::Display for AuthNTLM { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("AuthNTLM") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/cache.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/cache.rs new file mode 100644 index 00000000..b93b3a46 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/cache.rs @@ -0,0 +1,98 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{CacheType, SessionFeature}; +use glib::{prelude::*, translate::*}; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupCache")] + pub struct Cache(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_cache_get_type(), + } +} + +impl Cache { + pub const NONE: Option<&'static Cache> = None; + + #[doc(alias = "soup_cache_new")] + pub fn new(cache_dir: Option<&str>, cache_type: CacheType) -> Cache { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_cache_new( + cache_dir.to_glib_none().0, + cache_type.into_glib(), + )) + } + } +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait CacheExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_cache_clear")] + fn clear(&self) { + unsafe { + ffi::soup_cache_clear(self.as_ref().to_glib_none().0); + } + } + + #[doc(alias = "soup_cache_dump")] + fn dump(&self) { + unsafe { + ffi::soup_cache_dump(self.as_ref().to_glib_none().0); + } + } + + #[doc(alias = "soup_cache_flush")] + fn flush(&self) { + unsafe { + ffi::soup_cache_flush(self.as_ref().to_glib_none().0); + } + } + + #[doc(alias = "soup_cache_get_max_size")] + #[doc(alias = "get_max_size")] + fn max_size(&self) -> u32 { + unsafe { ffi::soup_cache_get_max_size(self.as_ref().to_glib_none().0) } + } + + #[doc(alias = "soup_cache_load")] + fn load(&self) { + unsafe { + ffi::soup_cache_load(self.as_ref().to_glib_none().0); + } + } + + #[doc(alias = "soup_cache_set_max_size")] + fn set_max_size(&self, max_size: u32) { + unsafe { + ffi::soup_cache_set_max_size(self.as_ref().to_glib_none().0, max_size); + } + } + + #[doc(alias = "cache-dir")] + fn cache_dir(&self) -> Option { + ObjectExt::property(self.as_ref(), "cache-dir") + } + + #[doc(alias = "cache-type")] + fn cache_type(&self) -> CacheType { + ObjectExt::property(self.as_ref(), "cache-type") + } +} + +impl> CacheExt for O {} + +impl fmt::Display for Cache { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("Cache") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/constants.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/constants.rs new file mode 100644 index 00000000..ec72a739 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/constants.rs @@ -0,0 +1,13 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::GStr; + +#[doc(alias = "SOUP_FORM_MIME_TYPE_MULTIPART")] +pub static FORM_MIME_TYPE_MULTIPART: &GStr = + unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SOUP_FORM_MIME_TYPE_MULTIPART) }; +#[doc(alias = "SOUP_FORM_MIME_TYPE_URLENCODED")] +pub static FORM_MIME_TYPE_URLENCODED: &GStr = + unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SOUP_FORM_MIME_TYPE_URLENCODED) }; diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/content_decoder.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/content_decoder.rs new file mode 100644 index 00000000..18851754 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/content_decoder.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::SessionFeature; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupContentDecoder")] + pub struct ContentDecoder(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_content_decoder_get_type(), + } +} + +impl ContentDecoder {} + +impl fmt::Display for ContentDecoder { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("ContentDecoder") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/content_sniffer.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/content_sniffer.rs new file mode 100644 index 00000000..de4a7a16 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/content_sniffer.rs @@ -0,0 +1,42 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::SessionFeature; +use glib::translate::*; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupContentSniffer")] + pub struct ContentSniffer(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_content_sniffer_get_type(), + } +} + +impl ContentSniffer { + #[doc(alias = "soup_content_sniffer_new")] + pub fn new() -> ContentSniffer { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_content_sniffer_new()) } + } + + //#[doc(alias = "soup_content_sniffer_sniff")] + //pub fn sniff(&self, msg: &Message, buffer: &glib::Bytes, params: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) -> Option { + // unsafe { TODO: call ffi:soup_content_sniffer_sniff() } + //} +} + +impl Default for ContentSniffer { + fn default() -> Self { + Self::new() + } +} + +impl fmt::Display for ContentSniffer { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("ContentSniffer") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/cookie.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie.rs new file mode 100644 index 00000000..8d70abc5 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie.rs @@ -0,0 +1,213 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::SameSitePolicy; +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialOrd, Ord, Hash)] + pub struct Cookie(Boxed); + + match fn { + copy => |ptr| ffi::soup_cookie_copy(mut_override(ptr)), + free => |ptr| ffi::soup_cookie_free(ptr), + type_ => || ffi::soup_cookie_get_type(), + } +} + +impl Cookie { + #[doc(alias = "soup_cookie_new")] + pub fn new(name: &str, value: &str, domain: &str, path: &str, max_age: i32) -> Cookie { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_cookie_new( + name.to_glib_none().0, + value.to_glib_none().0, + domain.to_glib_none().0, + path.to_glib_none().0, + max_age, + )) + } + } + + #[doc(alias = "soup_cookie_applies_to_uri")] + pub fn applies_to_uri(&mut self, uri: &glib::Uri) -> bool { + unsafe { + from_glib(ffi::soup_cookie_applies_to_uri( + self.to_glib_none_mut().0, + uri.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_cookie_domain_matches")] + pub fn domain_matches(&mut self, host: &str) -> bool { + unsafe { + from_glib(ffi::soup_cookie_domain_matches( + self.to_glib_none_mut().0, + host.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_cookie_equal")] + fn equal(&self, cookie2: &Cookie) -> bool { + unsafe { + from_glib(ffi::soup_cookie_equal( + mut_override(self.to_glib_none().0), + mut_override(cookie2.to_glib_none().0), + )) + } + } + + #[doc(alias = "soup_cookie_get_domain")] + #[doc(alias = "get_domain")] + pub fn domain(&mut self) -> Option { + unsafe { from_glib_none(ffi::soup_cookie_get_domain(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_get_expires")] + #[doc(alias = "get_expires")] + pub fn expires(&mut self) -> Option { + unsafe { from_glib_none(ffi::soup_cookie_get_expires(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_get_http_only")] + #[doc(alias = "get_http_only")] + pub fn is_http_only(&mut self) -> bool { + unsafe { from_glib(ffi::soup_cookie_get_http_only(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_get_name")] + #[doc(alias = "get_name")] + pub fn name(&mut self) -> Option { + unsafe { from_glib_none(ffi::soup_cookie_get_name(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_get_path")] + #[doc(alias = "get_path")] + pub fn path(&mut self) -> Option { + unsafe { from_glib_none(ffi::soup_cookie_get_path(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_get_same_site_policy")] + #[doc(alias = "get_same_site_policy")] + pub fn same_site_policy(&mut self) -> SameSitePolicy { + unsafe { + from_glib(ffi::soup_cookie_get_same_site_policy( + self.to_glib_none_mut().0, + )) + } + } + + #[doc(alias = "soup_cookie_get_secure")] + #[doc(alias = "get_secure")] + pub fn is_secure(&mut self) -> bool { + unsafe { from_glib(ffi::soup_cookie_get_secure(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_get_value")] + #[doc(alias = "get_value")] + pub fn value(&mut self) -> Option { + unsafe { from_glib_none(ffi::soup_cookie_get_value(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_set_domain")] + pub fn set_domain(&mut self, domain: &str) { + unsafe { + ffi::soup_cookie_set_domain(self.to_glib_none_mut().0, domain.to_glib_none().0); + } + } + + #[doc(alias = "soup_cookie_set_expires")] + pub fn set_expires(&mut self, expires: &glib::DateTime) { + unsafe { + ffi::soup_cookie_set_expires(self.to_glib_none_mut().0, expires.to_glib_none().0); + } + } + + #[doc(alias = "soup_cookie_set_http_only")] + pub fn set_http_only(&mut self, http_only: bool) { + unsafe { + ffi::soup_cookie_set_http_only(self.to_glib_none_mut().0, http_only.into_glib()); + } + } + + #[doc(alias = "soup_cookie_set_max_age")] + pub fn set_max_age(&mut self, max_age: i32) { + unsafe { + ffi::soup_cookie_set_max_age(self.to_glib_none_mut().0, max_age); + } + } + + #[doc(alias = "soup_cookie_set_name")] + pub fn set_name(&mut self, name: &str) { + unsafe { + ffi::soup_cookie_set_name(self.to_glib_none_mut().0, name.to_glib_none().0); + } + } + + #[doc(alias = "soup_cookie_set_path")] + pub fn set_path(&mut self, path: &str) { + unsafe { + ffi::soup_cookie_set_path(self.to_glib_none_mut().0, path.to_glib_none().0); + } + } + + #[doc(alias = "soup_cookie_set_same_site_policy")] + pub fn set_same_site_policy(&mut self, policy: SameSitePolicy) { + unsafe { + ffi::soup_cookie_set_same_site_policy(self.to_glib_none_mut().0, policy.into_glib()); + } + } + + #[doc(alias = "soup_cookie_set_secure")] + pub fn set_secure(&mut self, secure: bool) { + unsafe { + ffi::soup_cookie_set_secure(self.to_glib_none_mut().0, secure.into_glib()); + } + } + + #[doc(alias = "soup_cookie_set_value")] + pub fn set_value(&mut self, value: &str) { + unsafe { + ffi::soup_cookie_set_value(self.to_glib_none_mut().0, value.to_glib_none().0); + } + } + + #[doc(alias = "soup_cookie_to_cookie_header")] + pub fn to_cookie_header(&mut self) -> Option { + unsafe { from_glib_full(ffi::soup_cookie_to_cookie_header(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_cookie_to_set_cookie_header")] + pub fn to_set_cookie_header(&mut self) -> Option { + unsafe { + from_glib_full(ffi::soup_cookie_to_set_cookie_header( + self.to_glib_none_mut().0, + )) + } + } + + #[doc(alias = "soup_cookie_parse")] + pub fn parse(header: &str, origin: Option<&glib::Uri>) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_cookie_parse( + header.to_glib_none().0, + origin.to_glib_none().0, + )) + } + } +} + +impl PartialEq for Cookie { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.equal(other) + } +} + +impl Eq for Cookie {} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar.rs new file mode 100644 index 00000000..98f7db86 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar.rs @@ -0,0 +1,225 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{Cookie, CookieJarAcceptPolicy, SessionFeature}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupCookieJar")] + pub struct CookieJar(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_cookie_jar_get_type(), + } +} + +impl CookieJar { + pub const NONE: Option<&'static CookieJar> = None; + + #[doc(alias = "soup_cookie_jar_new")] + pub fn new() -> CookieJar { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_cookie_jar_new()) } + } +} + +impl Default for CookieJar { + fn default() -> Self { + Self::new() + } +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait CookieJarExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_cookie_jar_all_cookies")] + fn all_cookies(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_cookie_jar_all_cookies( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_cookie_jar_get_accept_policy")] + #[doc(alias = "get_accept_policy")] + fn accept_policy(&self) -> CookieJarAcceptPolicy { + unsafe { + from_glib(ffi::soup_cookie_jar_get_accept_policy( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_cookie_jar_get_cookie_list")] + #[doc(alias = "get_cookie_list")] + fn cookie_list(&self, uri: &glib::Uri, for_http: bool) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_cookie_jar_get_cookie_list( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + for_http.into_glib(), + )) + } + } + + #[doc(alias = "soup_cookie_jar_get_cookie_list_with_same_site_info")] + #[doc(alias = "get_cookie_list_with_same_site_info")] + fn cookie_list_with_same_site_info( + &self, + uri: &glib::Uri, + top_level: Option<&glib::Uri>, + site_for_cookies: Option<&glib::Uri>, + for_http: bool, + is_safe_method: bool, + is_top_level_navigation: bool, + ) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full( + ffi::soup_cookie_jar_get_cookie_list_with_same_site_info( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + top_level.to_glib_none().0, + site_for_cookies.to_glib_none().0, + for_http.into_glib(), + is_safe_method.into_glib(), + is_top_level_navigation.into_glib(), + ), + ) + } + } + + #[doc(alias = "soup_cookie_jar_get_cookies")] + #[doc(alias = "get_cookies")] + fn cookies(&self, uri: &glib::Uri, for_http: bool) -> Option { + unsafe { + from_glib_full(ffi::soup_cookie_jar_get_cookies( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + for_http.into_glib(), + )) + } + } + + #[doc(alias = "soup_cookie_jar_is_persistent")] + fn is_persistent(&self) -> bool { + unsafe { + from_glib(ffi::soup_cookie_jar_is_persistent( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_cookie_jar_set_accept_policy")] + fn set_accept_policy(&self, policy: CookieJarAcceptPolicy) { + unsafe { + ffi::soup_cookie_jar_set_accept_policy( + self.as_ref().to_glib_none().0, + policy.into_glib(), + ); + } + } + + #[doc(alias = "soup_cookie_jar_set_cookie")] + fn set_cookie(&self, uri: &glib::Uri, cookie: &str) { + unsafe { + ffi::soup_cookie_jar_set_cookie( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + cookie.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_cookie_jar_set_cookie_with_first_party")] + fn set_cookie_with_first_party(&self, uri: &glib::Uri, first_party: &glib::Uri, cookie: &str) { + unsafe { + ffi::soup_cookie_jar_set_cookie_with_first_party( + self.as_ref().to_glib_none().0, + uri.to_glib_none().0, + first_party.to_glib_none().0, + cookie.to_glib_none().0, + ); + } + } + + #[doc(alias = "read-only")] + fn is_read_only(&self) -> bool { + ObjectExt::property(self.as_ref(), "read-only") + } + + #[doc(alias = "changed")] + fn connect_changed(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn changed_trampoline< + P: IsA, + F: Fn(&P, &Cookie, &Cookie) + 'static, + >( + this: *mut ffi::SoupCookieJar, + old_cookie: *mut ffi::SoupCookie, + new_cookie: *mut ffi::SoupCookie, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + CookieJar::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(old_cookie), + &from_glib_borrow(new_cookie), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"changed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + changed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "accept-policy")] + fn connect_accept_policy_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_accept_policy_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupCookieJar, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(CookieJar::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::accept-policy\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_accept_policy_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl> CookieJarExt for O {} + +impl fmt::Display for CookieJar { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("CookieJar") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_db.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_db.rs new file mode 100644 index 00000000..b6e64c8c --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_db.rs @@ -0,0 +1,41 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{CookieJar, SessionFeature}; +use glib::{prelude::*, translate::*}; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupCookieJarDB")] + pub struct CookieJarDB(Object) @extends CookieJar, @implements SessionFeature; + + match fn { + type_ => || ffi::soup_cookie_jar_db_get_type(), + } +} + +impl CookieJarDB { + #[doc(alias = "soup_cookie_jar_db_new")] + pub fn new(filename: &str, read_only: bool) -> CookieJarDB { + assert_initialized_main_thread!(); + unsafe { + CookieJar::from_glib_full(ffi::soup_cookie_jar_db_new( + filename.to_glib_none().0, + read_only.into_glib(), + )) + .unsafe_cast() + } + } + + pub fn filename(&self) -> Option { + ObjectExt::property(self, "filename") + } +} + +impl fmt::Display for CookieJarDB { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("CookieJarDB") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_text.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_text.rs new file mode 100644 index 00000000..6b8f8a15 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/cookie_jar_text.rs @@ -0,0 +1,41 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{CookieJar, SessionFeature}; +use glib::{prelude::*, translate::*}; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupCookieJarText")] + pub struct CookieJarText(Object) @extends CookieJar, @implements SessionFeature; + + match fn { + type_ => || ffi::soup_cookie_jar_text_get_type(), + } +} + +impl CookieJarText { + #[doc(alias = "soup_cookie_jar_text_new")] + pub fn new(filename: &str, read_only: bool) -> CookieJarText { + assert_initialized_main_thread!(); + unsafe { + CookieJar::from_glib_full(ffi::soup_cookie_jar_text_new( + filename.to_glib_none().0, + read_only.into_glib(), + )) + .unsafe_cast() + } + } + + pub fn filename(&self) -> Option { + ObjectExt::property(self, "filename") + } +} + +impl fmt::Display for CookieJarText { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("CookieJarText") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/enums.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/enums.rs new file mode 100644 index 00000000..6041f0d1 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/enums.rs @@ -0,0 +1,2625 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::{prelude::*, translate::*}; +use std::fmt; + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupCacheType")] +pub enum CacheType { + #[doc(alias = "SOUP_CACHE_SINGLE_USER")] + SingleUser, + #[doc(alias = "SOUP_CACHE_SHARED")] + Shared, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for CacheType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "CacheType::{}", + match *self { + Self::SingleUser => "SingleUser", + Self::Shared => "Shared", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for CacheType { + type GlibType = ffi::SoupCacheType; + + #[inline] + fn into_glib(self) -> ffi::SoupCacheType { + match self { + Self::SingleUser => ffi::SOUP_CACHE_SINGLE_USER, + Self::Shared => ffi::SOUP_CACHE_SHARED, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for CacheType { + #[inline] + unsafe fn from_glib(value: ffi::SoupCacheType) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_CACHE_SINGLE_USER => Self::SingleUser, + ffi::SOUP_CACHE_SHARED => Self::Shared, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for CacheType { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_cache_type_get_type()) } + } +} + +impl glib::HasParamSpec for CacheType { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for CacheType { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for CacheType { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for CacheType { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: CacheType) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupCookieJarAcceptPolicy")] +pub enum CookieJarAcceptPolicy { + #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_ALWAYS")] + Always, + #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_NEVER")] + Never, + #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY")] + NoThirdParty, + #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY")] + GrandfatheredThirdParty, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for CookieJarAcceptPolicy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "CookieJarAcceptPolicy::{}", + match *self { + Self::Always => "Always", + Self::Never => "Never", + Self::NoThirdParty => "NoThirdParty", + Self::GrandfatheredThirdParty => "GrandfatheredThirdParty", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for CookieJarAcceptPolicy { + type GlibType = ffi::SoupCookieJarAcceptPolicy; + + #[inline] + fn into_glib(self) -> ffi::SoupCookieJarAcceptPolicy { + match self { + Self::Always => ffi::SOUP_COOKIE_JAR_ACCEPT_ALWAYS, + Self::Never => ffi::SOUP_COOKIE_JAR_ACCEPT_NEVER, + Self::NoThirdParty => ffi::SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY, + Self::GrandfatheredThirdParty => ffi::SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for CookieJarAcceptPolicy { + #[inline] + unsafe fn from_glib(value: ffi::SoupCookieJarAcceptPolicy) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_COOKIE_JAR_ACCEPT_ALWAYS => Self::Always, + ffi::SOUP_COOKIE_JAR_ACCEPT_NEVER => Self::Never, + ffi::SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY => Self::NoThirdParty, + ffi::SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY => Self::GrandfatheredThirdParty, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for CookieJarAcceptPolicy { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_cookie_jar_accept_policy_get_type()) } + } +} + +impl glib::HasParamSpec for CookieJarAcceptPolicy { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for CookieJarAcceptPolicy { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for CookieJarAcceptPolicy { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for CookieJarAcceptPolicy { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: CookieJarAcceptPolicy) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupDateFormat")] +pub enum DateFormat { + #[doc(alias = "SOUP_DATE_HTTP")] + Http, + #[doc(alias = "SOUP_DATE_COOKIE")] + Cookie, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for DateFormat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "DateFormat::{}", + match *self { + Self::Http => "Http", + Self::Cookie => "Cookie", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for DateFormat { + type GlibType = ffi::SoupDateFormat; + + #[inline] + fn into_glib(self) -> ffi::SoupDateFormat { + match self { + Self::Http => ffi::SOUP_DATE_HTTP, + Self::Cookie => ffi::SOUP_DATE_COOKIE, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for DateFormat { + #[inline] + unsafe fn from_glib(value: ffi::SoupDateFormat) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_DATE_HTTP => Self::Http, + ffi::SOUP_DATE_COOKIE => Self::Cookie, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for DateFormat { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_date_format_get_type()) } + } +} + +impl glib::HasParamSpec for DateFormat { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for DateFormat { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for DateFormat { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for DateFormat { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: DateFormat) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupEncoding")] +pub enum Encoding { + #[doc(alias = "SOUP_ENCODING_UNRECOGNIZED")] + Unrecognized, + #[doc(alias = "SOUP_ENCODING_NONE")] + None, + #[doc(alias = "SOUP_ENCODING_CONTENT_LENGTH")] + ContentLength, + #[doc(alias = "SOUP_ENCODING_EOF")] + Eof, + #[doc(alias = "SOUP_ENCODING_CHUNKED")] + Chunked, + #[doc(alias = "SOUP_ENCODING_BYTERANGES")] + Byteranges, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for Encoding { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "Encoding::{}", + match *self { + Self::Unrecognized => "Unrecognized", + Self::None => "None", + Self::ContentLength => "ContentLength", + Self::Eof => "Eof", + Self::Chunked => "Chunked", + Self::Byteranges => "Byteranges", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for Encoding { + type GlibType = ffi::SoupEncoding; + + #[inline] + fn into_glib(self) -> ffi::SoupEncoding { + match self { + Self::Unrecognized => ffi::SOUP_ENCODING_UNRECOGNIZED, + Self::None => ffi::SOUP_ENCODING_NONE, + Self::ContentLength => ffi::SOUP_ENCODING_CONTENT_LENGTH, + Self::Eof => ffi::SOUP_ENCODING_EOF, + Self::Chunked => ffi::SOUP_ENCODING_CHUNKED, + Self::Byteranges => ffi::SOUP_ENCODING_BYTERANGES, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for Encoding { + #[inline] + unsafe fn from_glib(value: ffi::SoupEncoding) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_ENCODING_UNRECOGNIZED => Self::Unrecognized, + ffi::SOUP_ENCODING_NONE => Self::None, + ffi::SOUP_ENCODING_CONTENT_LENGTH => Self::ContentLength, + ffi::SOUP_ENCODING_EOF => Self::Eof, + ffi::SOUP_ENCODING_CHUNKED => Self::Chunked, + ffi::SOUP_ENCODING_BYTERANGES => Self::Byteranges, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for Encoding { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_encoding_get_type()) } + } +} + +impl glib::HasParamSpec for Encoding { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for Encoding { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for Encoding { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for Encoding { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: Encoding) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupHTTPVersion")] +pub enum HTTPVersion { + #[doc(alias = "SOUP_HTTP_1_0")] + Http10, + #[doc(alias = "SOUP_HTTP_1_1")] + Http11, + #[doc(alias = "SOUP_HTTP_2_0")] + Http20, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for HTTPVersion { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "HTTPVersion::{}", + match *self { + Self::Http10 => "Http10", + Self::Http11 => "Http11", + Self::Http20 => "Http20", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for HTTPVersion { + type GlibType = ffi::SoupHTTPVersion; + + #[inline] + fn into_glib(self) -> ffi::SoupHTTPVersion { + match self { + Self::Http10 => ffi::SOUP_HTTP_1_0, + Self::Http11 => ffi::SOUP_HTTP_1_1, + Self::Http20 => ffi::SOUP_HTTP_2_0, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for HTTPVersion { + #[inline] + unsafe fn from_glib(value: ffi::SoupHTTPVersion) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_HTTP_1_0 => Self::Http10, + ffi::SOUP_HTTP_1_1 => Self::Http11, + ffi::SOUP_HTTP_2_0 => Self::Http20, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for HTTPVersion { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_http_version_get_type()) } + } +} + +impl glib::HasParamSpec for HTTPVersion { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for HTTPVersion { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for HTTPVersion { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for HTTPVersion { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: HTTPVersion) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupLoggerLogLevel")] +pub enum LoggerLogLevel { + #[doc(alias = "SOUP_LOGGER_LOG_NONE")] + None, + #[doc(alias = "SOUP_LOGGER_LOG_MINIMAL")] + Minimal, + #[doc(alias = "SOUP_LOGGER_LOG_HEADERS")] + Headers, + #[doc(alias = "SOUP_LOGGER_LOG_BODY")] + Body, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for LoggerLogLevel { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "LoggerLogLevel::{}", + match *self { + Self::None => "None", + Self::Minimal => "Minimal", + Self::Headers => "Headers", + Self::Body => "Body", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for LoggerLogLevel { + type GlibType = ffi::SoupLoggerLogLevel; + + #[inline] + fn into_glib(self) -> ffi::SoupLoggerLogLevel { + match self { + Self::None => ffi::SOUP_LOGGER_LOG_NONE, + Self::Minimal => ffi::SOUP_LOGGER_LOG_MINIMAL, + Self::Headers => ffi::SOUP_LOGGER_LOG_HEADERS, + Self::Body => ffi::SOUP_LOGGER_LOG_BODY, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for LoggerLogLevel { + #[inline] + unsafe fn from_glib(value: ffi::SoupLoggerLogLevel) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_LOGGER_LOG_NONE => Self::None, + ffi::SOUP_LOGGER_LOG_MINIMAL => Self::Minimal, + ffi::SOUP_LOGGER_LOG_HEADERS => Self::Headers, + ffi::SOUP_LOGGER_LOG_BODY => Self::Body, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for LoggerLogLevel { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_logger_log_level_get_type()) } + } +} + +impl glib::HasParamSpec for LoggerLogLevel { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for LoggerLogLevel { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for LoggerLogLevel { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for LoggerLogLevel { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: LoggerLogLevel) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupMemoryUse")] +pub enum MemoryUse { + #[doc(alias = "SOUP_MEMORY_STATIC")] + Static, + #[doc(alias = "SOUP_MEMORY_TAKE")] + Take, + #[doc(alias = "SOUP_MEMORY_COPY")] + Copy, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for MemoryUse { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "MemoryUse::{}", + match *self { + Self::Static => "Static", + Self::Take => "Take", + Self::Copy => "Copy", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for MemoryUse { + type GlibType = ffi::SoupMemoryUse; + + #[inline] + fn into_glib(self) -> ffi::SoupMemoryUse { + match self { + Self::Static => ffi::SOUP_MEMORY_STATIC, + Self::Take => ffi::SOUP_MEMORY_TAKE, + Self::Copy => ffi::SOUP_MEMORY_COPY, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for MemoryUse { + #[inline] + unsafe fn from_glib(value: ffi::SoupMemoryUse) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_MEMORY_STATIC => Self::Static, + ffi::SOUP_MEMORY_TAKE => Self::Take, + ffi::SOUP_MEMORY_COPY => Self::Copy, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for MemoryUse { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_memory_use_get_type()) } + } +} + +impl glib::HasParamSpec for MemoryUse { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for MemoryUse { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for MemoryUse { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for MemoryUse { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: MemoryUse) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupMessageHeadersType")] +pub enum MessageHeadersType { + #[doc(alias = "SOUP_MESSAGE_HEADERS_REQUEST")] + Request, + #[doc(alias = "SOUP_MESSAGE_HEADERS_RESPONSE")] + Response, + #[doc(alias = "SOUP_MESSAGE_HEADERS_MULTIPART")] + Multipart, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for MessageHeadersType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "MessageHeadersType::{}", + match *self { + Self::Request => "Request", + Self::Response => "Response", + Self::Multipart => "Multipart", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for MessageHeadersType { + type GlibType = ffi::SoupMessageHeadersType; + + #[inline] + fn into_glib(self) -> ffi::SoupMessageHeadersType { + match self { + Self::Request => ffi::SOUP_MESSAGE_HEADERS_REQUEST, + Self::Response => ffi::SOUP_MESSAGE_HEADERS_RESPONSE, + Self::Multipart => ffi::SOUP_MESSAGE_HEADERS_MULTIPART, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for MessageHeadersType { + #[inline] + unsafe fn from_glib(value: ffi::SoupMessageHeadersType) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_MESSAGE_HEADERS_REQUEST => Self::Request, + ffi::SOUP_MESSAGE_HEADERS_RESPONSE => Self::Response, + ffi::SOUP_MESSAGE_HEADERS_MULTIPART => Self::Multipart, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for MessageHeadersType { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_message_headers_type_get_type()) } + } +} + +impl glib::HasParamSpec for MessageHeadersType { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for MessageHeadersType { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for MessageHeadersType { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for MessageHeadersType { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: MessageHeadersType) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupMessagePriority")] +pub enum MessagePriority { + #[doc(alias = "SOUP_MESSAGE_PRIORITY_VERY_LOW")] + VeryLow, + #[doc(alias = "SOUP_MESSAGE_PRIORITY_LOW")] + Low, + #[doc(alias = "SOUP_MESSAGE_PRIORITY_NORMAL")] + Normal, + #[doc(alias = "SOUP_MESSAGE_PRIORITY_HIGH")] + High, + #[doc(alias = "SOUP_MESSAGE_PRIORITY_VERY_HIGH")] + VeryHigh, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for MessagePriority { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "MessagePriority::{}", + match *self { + Self::VeryLow => "VeryLow", + Self::Low => "Low", + Self::Normal => "Normal", + Self::High => "High", + Self::VeryHigh => "VeryHigh", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for MessagePriority { + type GlibType = ffi::SoupMessagePriority; + + #[inline] + fn into_glib(self) -> ffi::SoupMessagePriority { + match self { + Self::VeryLow => ffi::SOUP_MESSAGE_PRIORITY_VERY_LOW, + Self::Low => ffi::SOUP_MESSAGE_PRIORITY_LOW, + Self::Normal => ffi::SOUP_MESSAGE_PRIORITY_NORMAL, + Self::High => ffi::SOUP_MESSAGE_PRIORITY_HIGH, + Self::VeryHigh => ffi::SOUP_MESSAGE_PRIORITY_VERY_HIGH, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for MessagePriority { + #[inline] + unsafe fn from_glib(value: ffi::SoupMessagePriority) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_MESSAGE_PRIORITY_VERY_LOW => Self::VeryLow, + ffi::SOUP_MESSAGE_PRIORITY_LOW => Self::Low, + ffi::SOUP_MESSAGE_PRIORITY_NORMAL => Self::Normal, + ffi::SOUP_MESSAGE_PRIORITY_HIGH => Self::High, + ffi::SOUP_MESSAGE_PRIORITY_VERY_HIGH => Self::VeryHigh, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for MessagePriority { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_message_priority_get_type()) } + } +} + +impl glib::HasParamSpec for MessagePriority { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for MessagePriority { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for MessagePriority { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for MessagePriority { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: MessagePriority) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupSameSitePolicy")] +pub enum SameSitePolicy { + #[doc(alias = "SOUP_SAME_SITE_POLICY_NONE")] + None, + #[doc(alias = "SOUP_SAME_SITE_POLICY_LAX")] + Lax, + #[doc(alias = "SOUP_SAME_SITE_POLICY_STRICT")] + Strict, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for SameSitePolicy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "SameSitePolicy::{}", + match *self { + Self::None => "None", + Self::Lax => "Lax", + Self::Strict => "Strict", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for SameSitePolicy { + type GlibType = ffi::SoupSameSitePolicy; + + #[inline] + fn into_glib(self) -> ffi::SoupSameSitePolicy { + match self { + Self::None => ffi::SOUP_SAME_SITE_POLICY_NONE, + Self::Lax => ffi::SOUP_SAME_SITE_POLICY_LAX, + Self::Strict => ffi::SOUP_SAME_SITE_POLICY_STRICT, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for SameSitePolicy { + #[inline] + unsafe fn from_glib(value: ffi::SoupSameSitePolicy) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_SAME_SITE_POLICY_NONE => Self::None, + ffi::SOUP_SAME_SITE_POLICY_LAX => Self::Lax, + ffi::SOUP_SAME_SITE_POLICY_STRICT => Self::Strict, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for SameSitePolicy { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_same_site_policy_get_type()) } + } +} + +impl glib::HasParamSpec for SameSitePolicy { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for SameSitePolicy { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for SameSitePolicy { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for SameSitePolicy { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: SameSitePolicy) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupSessionError")] +pub enum SessionError { + #[doc(alias = "SOUP_SESSION_ERROR_PARSING")] + Parsing, + #[doc(alias = "SOUP_SESSION_ERROR_ENCODING")] + Encoding, + #[doc(alias = "SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS")] + TooManyRedirects, + #[doc(alias = "SOUP_SESSION_ERROR_TOO_MANY_RESTARTS")] + TooManyRestarts, + #[doc(alias = "SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION")] + RedirectNoLocation, + #[doc(alias = "SOUP_SESSION_ERROR_REDIRECT_BAD_URI")] + RedirectBadUri, + #[doc(alias = "SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE")] + MessageAlreadyInQueue, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for SessionError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "SessionError::{}", + match *self { + Self::Parsing => "Parsing", + Self::Encoding => "Encoding", + Self::TooManyRedirects => "TooManyRedirects", + Self::TooManyRestarts => "TooManyRestarts", + Self::RedirectNoLocation => "RedirectNoLocation", + Self::RedirectBadUri => "RedirectBadUri", + Self::MessageAlreadyInQueue => "MessageAlreadyInQueue", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for SessionError { + type GlibType = ffi::SoupSessionError; + + #[inline] + fn into_glib(self) -> ffi::SoupSessionError { + match self { + Self::Parsing => ffi::SOUP_SESSION_ERROR_PARSING, + Self::Encoding => ffi::SOUP_SESSION_ERROR_ENCODING, + Self::TooManyRedirects => ffi::SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS, + Self::TooManyRestarts => ffi::SOUP_SESSION_ERROR_TOO_MANY_RESTARTS, + Self::RedirectNoLocation => ffi::SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION, + Self::RedirectBadUri => ffi::SOUP_SESSION_ERROR_REDIRECT_BAD_URI, + Self::MessageAlreadyInQueue => ffi::SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for SessionError { + #[inline] + unsafe fn from_glib(value: ffi::SoupSessionError) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_SESSION_ERROR_PARSING => Self::Parsing, + ffi::SOUP_SESSION_ERROR_ENCODING => Self::Encoding, + ffi::SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS => Self::TooManyRedirects, + ffi::SOUP_SESSION_ERROR_TOO_MANY_RESTARTS => Self::TooManyRestarts, + ffi::SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION => Self::RedirectNoLocation, + ffi::SOUP_SESSION_ERROR_REDIRECT_BAD_URI => Self::RedirectBadUri, + ffi::SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE => Self::MessageAlreadyInQueue, + value => Self::__Unknown(value), + } + } +} + +impl glib::error::ErrorDomain for SessionError { + #[inline] + fn domain() -> glib::Quark { + skip_assert_initialized!(); + + unsafe { from_glib(ffi::soup_session_error_quark()) } + } + + #[inline] + fn code(self) -> i32 { + self.into_glib() + } + + #[inline] + #[allow(clippy::match_single_binding)] + fn from(code: i32) -> Option { + skip_assert_initialized!(); + match unsafe { from_glib(code) } { + value => Some(value), + } + } +} + +impl StaticType for SessionError { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_session_error_get_type()) } + } +} + +impl glib::HasParamSpec for SessionError { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for SessionError { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for SessionError { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for SessionError { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: SessionError) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupStatus")] +pub enum Status { + #[doc(alias = "SOUP_STATUS_NONE")] + None, + #[doc(alias = "SOUP_STATUS_CONTINUE")] + Continue, + #[doc(alias = "SOUP_STATUS_SWITCHING_PROTOCOLS")] + SwitchingProtocols, + #[doc(alias = "SOUP_STATUS_PROCESSING")] + Processing, + #[doc(alias = "SOUP_STATUS_OK")] + Ok, + #[doc(alias = "SOUP_STATUS_CREATED")] + Created, + #[doc(alias = "SOUP_STATUS_ACCEPTED")] + Accepted, + #[doc(alias = "SOUP_STATUS_NON_AUTHORITATIVE")] + NonAuthoritative, + #[doc(alias = "SOUP_STATUS_NO_CONTENT")] + NoContent, + #[doc(alias = "SOUP_STATUS_RESET_CONTENT")] + ResetContent, + #[doc(alias = "SOUP_STATUS_PARTIAL_CONTENT")] + PartialContent, + #[doc(alias = "SOUP_STATUS_MULTI_STATUS")] + MultiStatus, + #[doc(alias = "SOUP_STATUS_MULTIPLE_CHOICES")] + MultipleChoices, + #[doc(alias = "SOUP_STATUS_MOVED_PERMANENTLY")] + MovedPermanently, + #[doc(alias = "SOUP_STATUS_FOUND")] + Found, + #[doc(alias = "SOUP_STATUS_SEE_OTHER")] + SeeOther, + #[doc(alias = "SOUP_STATUS_NOT_MODIFIED")] + NotModified, + #[doc(alias = "SOUP_STATUS_USE_PROXY")] + UseProxy, + #[doc(alias = "SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL")] + NotAppearingInThisProtocol, + #[doc(alias = "SOUP_STATUS_TEMPORARY_REDIRECT")] + TemporaryRedirect, + #[doc(alias = "SOUP_STATUS_PERMANENT_REDIRECT")] + PermanentRedirect, + #[doc(alias = "SOUP_STATUS_BAD_REQUEST")] + BadRequest, + #[doc(alias = "SOUP_STATUS_UNAUTHORIZED")] + Unauthorized, + #[doc(alias = "SOUP_STATUS_PAYMENT_REQUIRED")] + PaymentRequired, + #[doc(alias = "SOUP_STATUS_FORBIDDEN")] + Forbidden, + #[doc(alias = "SOUP_STATUS_NOT_FOUND")] + NotFound, + #[doc(alias = "SOUP_STATUS_METHOD_NOT_ALLOWED")] + MethodNotAllowed, + #[doc(alias = "SOUP_STATUS_NOT_ACCEPTABLE")] + NotAcceptable, + #[doc(alias = "SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED")] + ProxyAuthenticationRequired, + #[doc(alias = "SOUP_STATUS_REQUEST_TIMEOUT")] + RequestTimeout, + #[doc(alias = "SOUP_STATUS_CONFLICT")] + Conflict, + #[doc(alias = "SOUP_STATUS_GONE")] + Gone, + #[doc(alias = "SOUP_STATUS_LENGTH_REQUIRED")] + LengthRequired, + #[doc(alias = "SOUP_STATUS_PRECONDITION_FAILED")] + PreconditionFailed, + #[doc(alias = "SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE")] + RequestEntityTooLarge, + #[doc(alias = "SOUP_STATUS_REQUEST_URI_TOO_LONG")] + RequestUriTooLong, + #[doc(alias = "SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE")] + UnsupportedMediaType, + #[doc(alias = "SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE")] + RequestedRangeNotSatisfiable, + #[doc(alias = "SOUP_STATUS_EXPECTATION_FAILED")] + ExpectationFailed, + #[doc(alias = "SOUP_STATUS_MISDIRECTED_REQUEST")] + MisdirectedRequest, + #[doc(alias = "SOUP_STATUS_UNPROCESSABLE_ENTITY")] + UnprocessableEntity, + #[doc(alias = "SOUP_STATUS_LOCKED")] + Locked, + #[doc(alias = "SOUP_STATUS_FAILED_DEPENDENCY")] + FailedDependency, + #[doc(alias = "SOUP_STATUS_INTERNAL_SERVER_ERROR")] + InternalServerError, + #[doc(alias = "SOUP_STATUS_NOT_IMPLEMENTED")] + NotImplemented, + #[doc(alias = "SOUP_STATUS_BAD_GATEWAY")] + BadGateway, + #[doc(alias = "SOUP_STATUS_SERVICE_UNAVAILABLE")] + ServiceUnavailable, + #[doc(alias = "SOUP_STATUS_GATEWAY_TIMEOUT")] + GatewayTimeout, + #[doc(alias = "SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED")] + HttpVersionNotSupported, + #[doc(alias = "SOUP_STATUS_INSUFFICIENT_STORAGE")] + InsufficientStorage, + #[doc(alias = "SOUP_STATUS_NOT_EXTENDED")] + NotExtended, + #[doc(hidden)] + __Unknown(i32), +} + +impl Status { + #[doc(alias = "soup_status_get_phrase")] + #[doc(alias = "get_phrase")] + pub fn phrase(status_code: u32) -> Option { + assert_initialized_main_thread!(); + unsafe { from_glib_none(ffi::soup_status_get_phrase(status_code)) } + } +} + +impl fmt::Display for Status { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "Status::{}", + match *self { + Self::None => "None", + Self::Continue => "Continue", + Self::SwitchingProtocols => "SwitchingProtocols", + Self::Processing => "Processing", + Self::Ok => "Ok", + Self::Created => "Created", + Self::Accepted => "Accepted", + Self::NonAuthoritative => "NonAuthoritative", + Self::NoContent => "NoContent", + Self::ResetContent => "ResetContent", + Self::PartialContent => "PartialContent", + Self::MultiStatus => "MultiStatus", + Self::MultipleChoices => "MultipleChoices", + Self::MovedPermanently => "MovedPermanently", + Self::Found => "Found", + Self::SeeOther => "SeeOther", + Self::NotModified => "NotModified", + Self::UseProxy => "UseProxy", + Self::NotAppearingInThisProtocol => "NotAppearingInThisProtocol", + Self::TemporaryRedirect => "TemporaryRedirect", + Self::PermanentRedirect => "PermanentRedirect", + Self::BadRequest => "BadRequest", + Self::Unauthorized => "Unauthorized", + Self::PaymentRequired => "PaymentRequired", + Self::Forbidden => "Forbidden", + Self::NotFound => "NotFound", + Self::MethodNotAllowed => "MethodNotAllowed", + Self::NotAcceptable => "NotAcceptable", + Self::ProxyAuthenticationRequired => "ProxyAuthenticationRequired", + Self::RequestTimeout => "RequestTimeout", + Self::Conflict => "Conflict", + Self::Gone => "Gone", + Self::LengthRequired => "LengthRequired", + Self::PreconditionFailed => "PreconditionFailed", + Self::RequestEntityTooLarge => "RequestEntityTooLarge", + Self::RequestUriTooLong => "RequestUriTooLong", + Self::UnsupportedMediaType => "UnsupportedMediaType", + Self::RequestedRangeNotSatisfiable => "RequestedRangeNotSatisfiable", + Self::ExpectationFailed => "ExpectationFailed", + Self::MisdirectedRequest => "MisdirectedRequest", + Self::UnprocessableEntity => "UnprocessableEntity", + Self::Locked => "Locked", + Self::FailedDependency => "FailedDependency", + Self::InternalServerError => "InternalServerError", + Self::NotImplemented => "NotImplemented", + Self::BadGateway => "BadGateway", + Self::ServiceUnavailable => "ServiceUnavailable", + Self::GatewayTimeout => "GatewayTimeout", + Self::HttpVersionNotSupported => "HttpVersionNotSupported", + Self::InsufficientStorage => "InsufficientStorage", + Self::NotExtended => "NotExtended", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for Status { + type GlibType = ffi::SoupStatus; + + fn into_glib(self) -> ffi::SoupStatus { + match self { + Self::None => ffi::SOUP_STATUS_NONE, + Self::Continue => ffi::SOUP_STATUS_CONTINUE, + Self::SwitchingProtocols => ffi::SOUP_STATUS_SWITCHING_PROTOCOLS, + Self::Processing => ffi::SOUP_STATUS_PROCESSING, + Self::Ok => ffi::SOUP_STATUS_OK, + Self::Created => ffi::SOUP_STATUS_CREATED, + Self::Accepted => ffi::SOUP_STATUS_ACCEPTED, + Self::NonAuthoritative => ffi::SOUP_STATUS_NON_AUTHORITATIVE, + Self::NoContent => ffi::SOUP_STATUS_NO_CONTENT, + Self::ResetContent => ffi::SOUP_STATUS_RESET_CONTENT, + Self::PartialContent => ffi::SOUP_STATUS_PARTIAL_CONTENT, + Self::MultiStatus => ffi::SOUP_STATUS_MULTI_STATUS, + Self::MultipleChoices => ffi::SOUP_STATUS_MULTIPLE_CHOICES, + Self::MovedPermanently => ffi::SOUP_STATUS_MOVED_PERMANENTLY, + Self::Found => ffi::SOUP_STATUS_FOUND, + Self::SeeOther => ffi::SOUP_STATUS_SEE_OTHER, + Self::NotModified => ffi::SOUP_STATUS_NOT_MODIFIED, + Self::UseProxy => ffi::SOUP_STATUS_USE_PROXY, + Self::NotAppearingInThisProtocol => ffi::SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL, + Self::TemporaryRedirect => ffi::SOUP_STATUS_TEMPORARY_REDIRECT, + Self::PermanentRedirect => ffi::SOUP_STATUS_PERMANENT_REDIRECT, + Self::BadRequest => ffi::SOUP_STATUS_BAD_REQUEST, + Self::Unauthorized => ffi::SOUP_STATUS_UNAUTHORIZED, + Self::PaymentRequired => ffi::SOUP_STATUS_PAYMENT_REQUIRED, + Self::Forbidden => ffi::SOUP_STATUS_FORBIDDEN, + Self::NotFound => ffi::SOUP_STATUS_NOT_FOUND, + Self::MethodNotAllowed => ffi::SOUP_STATUS_METHOD_NOT_ALLOWED, + Self::NotAcceptable => ffi::SOUP_STATUS_NOT_ACCEPTABLE, + Self::ProxyAuthenticationRequired => ffi::SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED, + Self::RequestTimeout => ffi::SOUP_STATUS_REQUEST_TIMEOUT, + Self::Conflict => ffi::SOUP_STATUS_CONFLICT, + Self::Gone => ffi::SOUP_STATUS_GONE, + Self::LengthRequired => ffi::SOUP_STATUS_LENGTH_REQUIRED, + Self::PreconditionFailed => ffi::SOUP_STATUS_PRECONDITION_FAILED, + Self::RequestEntityTooLarge => ffi::SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE, + Self::RequestUriTooLong => ffi::SOUP_STATUS_REQUEST_URI_TOO_LONG, + Self::UnsupportedMediaType => ffi::SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE, + Self::RequestedRangeNotSatisfiable => ffi::SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, + Self::ExpectationFailed => ffi::SOUP_STATUS_EXPECTATION_FAILED, + Self::MisdirectedRequest => ffi::SOUP_STATUS_MISDIRECTED_REQUEST, + Self::UnprocessableEntity => ffi::SOUP_STATUS_UNPROCESSABLE_ENTITY, + Self::Locked => ffi::SOUP_STATUS_LOCKED, + Self::FailedDependency => ffi::SOUP_STATUS_FAILED_DEPENDENCY, + Self::InternalServerError => ffi::SOUP_STATUS_INTERNAL_SERVER_ERROR, + Self::NotImplemented => ffi::SOUP_STATUS_NOT_IMPLEMENTED, + Self::BadGateway => ffi::SOUP_STATUS_BAD_GATEWAY, + Self::ServiceUnavailable => ffi::SOUP_STATUS_SERVICE_UNAVAILABLE, + Self::GatewayTimeout => ffi::SOUP_STATUS_GATEWAY_TIMEOUT, + Self::HttpVersionNotSupported => ffi::SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED, + Self::InsufficientStorage => ffi::SOUP_STATUS_INSUFFICIENT_STORAGE, + Self::NotExtended => ffi::SOUP_STATUS_NOT_EXTENDED, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for Status { + unsafe fn from_glib(value: ffi::SoupStatus) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_STATUS_NONE => Self::None, + ffi::SOUP_STATUS_CONTINUE => Self::Continue, + ffi::SOUP_STATUS_SWITCHING_PROTOCOLS => Self::SwitchingProtocols, + ffi::SOUP_STATUS_PROCESSING => Self::Processing, + ffi::SOUP_STATUS_OK => Self::Ok, + ffi::SOUP_STATUS_CREATED => Self::Created, + ffi::SOUP_STATUS_ACCEPTED => Self::Accepted, + ffi::SOUP_STATUS_NON_AUTHORITATIVE => Self::NonAuthoritative, + ffi::SOUP_STATUS_NO_CONTENT => Self::NoContent, + ffi::SOUP_STATUS_RESET_CONTENT => Self::ResetContent, + ffi::SOUP_STATUS_PARTIAL_CONTENT => Self::PartialContent, + ffi::SOUP_STATUS_MULTI_STATUS => Self::MultiStatus, + ffi::SOUP_STATUS_MULTIPLE_CHOICES => Self::MultipleChoices, + ffi::SOUP_STATUS_MOVED_PERMANENTLY => Self::MovedPermanently, + ffi::SOUP_STATUS_FOUND => Self::Found, + ffi::SOUP_STATUS_SEE_OTHER => Self::SeeOther, + ffi::SOUP_STATUS_NOT_MODIFIED => Self::NotModified, + ffi::SOUP_STATUS_USE_PROXY => Self::UseProxy, + ffi::SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL => Self::NotAppearingInThisProtocol, + ffi::SOUP_STATUS_TEMPORARY_REDIRECT => Self::TemporaryRedirect, + ffi::SOUP_STATUS_PERMANENT_REDIRECT => Self::PermanentRedirect, + ffi::SOUP_STATUS_BAD_REQUEST => Self::BadRequest, + ffi::SOUP_STATUS_UNAUTHORIZED => Self::Unauthorized, + ffi::SOUP_STATUS_PAYMENT_REQUIRED => Self::PaymentRequired, + ffi::SOUP_STATUS_FORBIDDEN => Self::Forbidden, + ffi::SOUP_STATUS_NOT_FOUND => Self::NotFound, + ffi::SOUP_STATUS_METHOD_NOT_ALLOWED => Self::MethodNotAllowed, + ffi::SOUP_STATUS_NOT_ACCEPTABLE => Self::NotAcceptable, + ffi::SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED => Self::ProxyAuthenticationRequired, + ffi::SOUP_STATUS_REQUEST_TIMEOUT => Self::RequestTimeout, + ffi::SOUP_STATUS_CONFLICT => Self::Conflict, + ffi::SOUP_STATUS_GONE => Self::Gone, + ffi::SOUP_STATUS_LENGTH_REQUIRED => Self::LengthRequired, + ffi::SOUP_STATUS_PRECONDITION_FAILED => Self::PreconditionFailed, + ffi::SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE => Self::RequestEntityTooLarge, + ffi::SOUP_STATUS_REQUEST_URI_TOO_LONG => Self::RequestUriTooLong, + ffi::SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE => Self::UnsupportedMediaType, + ffi::SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE => Self::RequestedRangeNotSatisfiable, + ffi::SOUP_STATUS_EXPECTATION_FAILED => Self::ExpectationFailed, + ffi::SOUP_STATUS_MISDIRECTED_REQUEST => Self::MisdirectedRequest, + ffi::SOUP_STATUS_UNPROCESSABLE_ENTITY => Self::UnprocessableEntity, + ffi::SOUP_STATUS_LOCKED => Self::Locked, + ffi::SOUP_STATUS_FAILED_DEPENDENCY => Self::FailedDependency, + ffi::SOUP_STATUS_INTERNAL_SERVER_ERROR => Self::InternalServerError, + ffi::SOUP_STATUS_NOT_IMPLEMENTED => Self::NotImplemented, + ffi::SOUP_STATUS_BAD_GATEWAY => Self::BadGateway, + ffi::SOUP_STATUS_SERVICE_UNAVAILABLE => Self::ServiceUnavailable, + ffi::SOUP_STATUS_GATEWAY_TIMEOUT => Self::GatewayTimeout, + ffi::SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED => Self::HttpVersionNotSupported, + ffi::SOUP_STATUS_INSUFFICIENT_STORAGE => Self::InsufficientStorage, + ffi::SOUP_STATUS_NOT_EXTENDED => Self::NotExtended, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for Status { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_status_get_type()) } + } +} + +impl glib::HasParamSpec for Status { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for Status { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for Status { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for Status { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: Status) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupTLDError")] +pub enum TLDError { + #[doc(alias = "SOUP_TLD_ERROR_INVALID_HOSTNAME")] + InvalidHostname, + #[doc(alias = "SOUP_TLD_ERROR_IS_IP_ADDRESS")] + IsIpAddress, + #[doc(alias = "SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS")] + NotEnoughDomains, + #[doc(alias = "SOUP_TLD_ERROR_NO_BASE_DOMAIN")] + NoBaseDomain, + #[doc(alias = "SOUP_TLD_ERROR_NO_PSL_DATA")] + NoPslData, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for TLDError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "TLDError::{}", + match *self { + Self::InvalidHostname => "InvalidHostname", + Self::IsIpAddress => "IsIpAddress", + Self::NotEnoughDomains => "NotEnoughDomains", + Self::NoBaseDomain => "NoBaseDomain", + Self::NoPslData => "NoPslData", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for TLDError { + type GlibType = ffi::SoupTLDError; + + #[inline] + fn into_glib(self) -> ffi::SoupTLDError { + match self { + Self::InvalidHostname => ffi::SOUP_TLD_ERROR_INVALID_HOSTNAME, + Self::IsIpAddress => ffi::SOUP_TLD_ERROR_IS_IP_ADDRESS, + Self::NotEnoughDomains => ffi::SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS, + Self::NoBaseDomain => ffi::SOUP_TLD_ERROR_NO_BASE_DOMAIN, + Self::NoPslData => ffi::SOUP_TLD_ERROR_NO_PSL_DATA, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for TLDError { + #[inline] + unsafe fn from_glib(value: ffi::SoupTLDError) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_TLD_ERROR_INVALID_HOSTNAME => Self::InvalidHostname, + ffi::SOUP_TLD_ERROR_IS_IP_ADDRESS => Self::IsIpAddress, + ffi::SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS => Self::NotEnoughDomains, + ffi::SOUP_TLD_ERROR_NO_BASE_DOMAIN => Self::NoBaseDomain, + ffi::SOUP_TLD_ERROR_NO_PSL_DATA => Self::NoPslData, + value => Self::__Unknown(value), + } + } +} + +impl glib::error::ErrorDomain for TLDError { + #[inline] + fn domain() -> glib::Quark { + skip_assert_initialized!(); + + unsafe { from_glib(ffi::soup_tld_error_quark()) } + } + + #[inline] + fn code(self) -> i32 { + self.into_glib() + } + + #[inline] + #[allow(clippy::match_single_binding)] + fn from(code: i32) -> Option { + skip_assert_initialized!(); + match unsafe { from_glib(code) } { + value => Some(value), + } + } +} + +impl StaticType for TLDError { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_tld_error_get_type()) } + } +} + +impl glib::HasParamSpec for TLDError { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for TLDError { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for TLDError { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for TLDError { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: TLDError) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupURIComponent")] +pub enum URIComponent { + #[doc(alias = "SOUP_URI_NONE")] + None, + #[doc(alias = "SOUP_URI_SCHEME")] + Scheme, + #[doc(alias = "SOUP_URI_USER")] + User, + #[doc(alias = "SOUP_URI_PASSWORD")] + Password, + #[doc(alias = "SOUP_URI_AUTH_PARAMS")] + AuthParams, + #[doc(alias = "SOUP_URI_HOST")] + Host, + #[doc(alias = "SOUP_URI_PORT")] + Port, + #[doc(alias = "SOUP_URI_PATH")] + Path, + #[doc(alias = "SOUP_URI_QUERY")] + Query, + #[doc(alias = "SOUP_URI_FRAGMENT")] + Fragment, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for URIComponent { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "URIComponent::{}", + match *self { + Self::None => "None", + Self::Scheme => "Scheme", + Self::User => "User", + Self::Password => "Password", + Self::AuthParams => "AuthParams", + Self::Host => "Host", + Self::Port => "Port", + Self::Path => "Path", + Self::Query => "Query", + Self::Fragment => "Fragment", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for URIComponent { + type GlibType = ffi::SoupURIComponent; + + #[inline] + fn into_glib(self) -> ffi::SoupURIComponent { + match self { + Self::None => ffi::SOUP_URI_NONE, + Self::Scheme => ffi::SOUP_URI_SCHEME, + Self::User => ffi::SOUP_URI_USER, + Self::Password => ffi::SOUP_URI_PASSWORD, + Self::AuthParams => ffi::SOUP_URI_AUTH_PARAMS, + Self::Host => ffi::SOUP_URI_HOST, + Self::Port => ffi::SOUP_URI_PORT, + Self::Path => ffi::SOUP_URI_PATH, + Self::Query => ffi::SOUP_URI_QUERY, + Self::Fragment => ffi::SOUP_URI_FRAGMENT, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for URIComponent { + #[inline] + unsafe fn from_glib(value: ffi::SoupURIComponent) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_URI_NONE => Self::None, + ffi::SOUP_URI_SCHEME => Self::Scheme, + ffi::SOUP_URI_USER => Self::User, + ffi::SOUP_URI_PASSWORD => Self::Password, + ffi::SOUP_URI_AUTH_PARAMS => Self::AuthParams, + ffi::SOUP_URI_HOST => Self::Host, + ffi::SOUP_URI_PORT => Self::Port, + ffi::SOUP_URI_PATH => Self::Path, + ffi::SOUP_URI_QUERY => Self::Query, + ffi::SOUP_URI_FRAGMENT => Self::Fragment, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for URIComponent { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_uri_component_get_type()) } + } +} + +impl glib::HasParamSpec for URIComponent { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for URIComponent { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for URIComponent { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for URIComponent { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: URIComponent) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupWebsocketCloseCode")] +pub enum WebsocketCloseCode { + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_NORMAL")] + Normal, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_GOING_AWAY")] + GoingAway, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR")] + ProtocolError, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA")] + UnsupportedData, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_NO_STATUS")] + NoStatus, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_ABNORMAL")] + Abnormal, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_BAD_DATA")] + BadData, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION")] + PolicyViolation, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_TOO_BIG")] + TooBig, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_NO_EXTENSION")] + NoExtension, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_SERVER_ERROR")] + ServerError, + #[doc(alias = "SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE")] + TlsHandshake, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for WebsocketCloseCode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "WebsocketCloseCode::{}", + match *self { + Self::Normal => "Normal", + Self::GoingAway => "GoingAway", + Self::ProtocolError => "ProtocolError", + Self::UnsupportedData => "UnsupportedData", + Self::NoStatus => "NoStatus", + Self::Abnormal => "Abnormal", + Self::BadData => "BadData", + Self::PolicyViolation => "PolicyViolation", + Self::TooBig => "TooBig", + Self::NoExtension => "NoExtension", + Self::ServerError => "ServerError", + Self::TlsHandshake => "TlsHandshake", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for WebsocketCloseCode { + type GlibType = ffi::SoupWebsocketCloseCode; + + #[inline] + fn into_glib(self) -> ffi::SoupWebsocketCloseCode { + match self { + Self::Normal => ffi::SOUP_WEBSOCKET_CLOSE_NORMAL, + Self::GoingAway => ffi::SOUP_WEBSOCKET_CLOSE_GOING_AWAY, + Self::ProtocolError => ffi::SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR, + Self::UnsupportedData => ffi::SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA, + Self::NoStatus => ffi::SOUP_WEBSOCKET_CLOSE_NO_STATUS, + Self::Abnormal => ffi::SOUP_WEBSOCKET_CLOSE_ABNORMAL, + Self::BadData => ffi::SOUP_WEBSOCKET_CLOSE_BAD_DATA, + Self::PolicyViolation => ffi::SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION, + Self::TooBig => ffi::SOUP_WEBSOCKET_CLOSE_TOO_BIG, + Self::NoExtension => ffi::SOUP_WEBSOCKET_CLOSE_NO_EXTENSION, + Self::ServerError => ffi::SOUP_WEBSOCKET_CLOSE_SERVER_ERROR, + Self::TlsHandshake => ffi::SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for WebsocketCloseCode { + #[inline] + unsafe fn from_glib(value: ffi::SoupWebsocketCloseCode) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_WEBSOCKET_CLOSE_NORMAL => Self::Normal, + ffi::SOUP_WEBSOCKET_CLOSE_GOING_AWAY => Self::GoingAway, + ffi::SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR => Self::ProtocolError, + ffi::SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA => Self::UnsupportedData, + ffi::SOUP_WEBSOCKET_CLOSE_NO_STATUS => Self::NoStatus, + ffi::SOUP_WEBSOCKET_CLOSE_ABNORMAL => Self::Abnormal, + ffi::SOUP_WEBSOCKET_CLOSE_BAD_DATA => Self::BadData, + ffi::SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION => Self::PolicyViolation, + ffi::SOUP_WEBSOCKET_CLOSE_TOO_BIG => Self::TooBig, + ffi::SOUP_WEBSOCKET_CLOSE_NO_EXTENSION => Self::NoExtension, + ffi::SOUP_WEBSOCKET_CLOSE_SERVER_ERROR => Self::ServerError, + ffi::SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE => Self::TlsHandshake, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for WebsocketCloseCode { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_websocket_close_code_get_type()) } + } +} + +impl glib::HasParamSpec for WebsocketCloseCode { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for WebsocketCloseCode { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for WebsocketCloseCode { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for WebsocketCloseCode { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: WebsocketCloseCode) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupWebsocketConnectionType")] +pub enum WebsocketConnectionType { + #[doc(alias = "SOUP_WEBSOCKET_CONNECTION_UNKNOWN")] + Unknown, + #[doc(alias = "SOUP_WEBSOCKET_CONNECTION_CLIENT")] + Client, + #[doc(alias = "SOUP_WEBSOCKET_CONNECTION_SERVER")] + Server, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for WebsocketConnectionType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "WebsocketConnectionType::{}", + match *self { + Self::Unknown => "Unknown", + Self::Client => "Client", + Self::Server => "Server", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for WebsocketConnectionType { + type GlibType = ffi::SoupWebsocketConnectionType; + + #[inline] + fn into_glib(self) -> ffi::SoupWebsocketConnectionType { + match self { + Self::Unknown => ffi::SOUP_WEBSOCKET_CONNECTION_UNKNOWN, + Self::Client => ffi::SOUP_WEBSOCKET_CONNECTION_CLIENT, + Self::Server => ffi::SOUP_WEBSOCKET_CONNECTION_SERVER, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for WebsocketConnectionType { + #[inline] + unsafe fn from_glib(value: ffi::SoupWebsocketConnectionType) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_WEBSOCKET_CONNECTION_UNKNOWN => Self::Unknown, + ffi::SOUP_WEBSOCKET_CONNECTION_CLIENT => Self::Client, + ffi::SOUP_WEBSOCKET_CONNECTION_SERVER => Self::Server, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for WebsocketConnectionType { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_websocket_connection_type_get_type()) } + } +} + +impl glib::HasParamSpec for WebsocketConnectionType { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for WebsocketConnectionType { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for WebsocketConnectionType { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for WebsocketConnectionType { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: WebsocketConnectionType) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupWebsocketDataType")] +pub enum WebsocketDataType { + #[doc(alias = "SOUP_WEBSOCKET_DATA_TEXT")] + Text, + #[doc(alias = "SOUP_WEBSOCKET_DATA_BINARY")] + Binary, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for WebsocketDataType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "WebsocketDataType::{}", + match *self { + Self::Text => "Text", + Self::Binary => "Binary", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for WebsocketDataType { + type GlibType = ffi::SoupWebsocketDataType; + + #[inline] + fn into_glib(self) -> ffi::SoupWebsocketDataType { + match self { + Self::Text => ffi::SOUP_WEBSOCKET_DATA_TEXT, + Self::Binary => ffi::SOUP_WEBSOCKET_DATA_BINARY, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for WebsocketDataType { + #[inline] + unsafe fn from_glib(value: ffi::SoupWebsocketDataType) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_WEBSOCKET_DATA_TEXT => Self::Text, + ffi::SOUP_WEBSOCKET_DATA_BINARY => Self::Binary, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for WebsocketDataType { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_websocket_data_type_get_type()) } + } +} + +impl glib::HasParamSpec for WebsocketDataType { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for WebsocketDataType { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for WebsocketDataType { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for WebsocketDataType { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: WebsocketDataType) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupWebsocketError")] +pub enum WebsocketError { + #[doc(alias = "SOUP_WEBSOCKET_ERROR_FAILED")] + Failed, + #[doc(alias = "SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET")] + NotWebsocket, + #[doc(alias = "SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE")] + BadHandshake, + #[doc(alias = "SOUP_WEBSOCKET_ERROR_BAD_ORIGIN")] + BadOrigin, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for WebsocketError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "WebsocketError::{}", + match *self { + Self::Failed => "Failed", + Self::NotWebsocket => "NotWebsocket", + Self::BadHandshake => "BadHandshake", + Self::BadOrigin => "BadOrigin", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for WebsocketError { + type GlibType = ffi::SoupWebsocketError; + + #[inline] + fn into_glib(self) -> ffi::SoupWebsocketError { + match self { + Self::Failed => ffi::SOUP_WEBSOCKET_ERROR_FAILED, + Self::NotWebsocket => ffi::SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET, + Self::BadHandshake => ffi::SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE, + Self::BadOrigin => ffi::SOUP_WEBSOCKET_ERROR_BAD_ORIGIN, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for WebsocketError { + #[inline] + unsafe fn from_glib(value: ffi::SoupWebsocketError) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_WEBSOCKET_ERROR_FAILED => Self::Failed, + ffi::SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET => Self::NotWebsocket, + ffi::SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE => Self::BadHandshake, + ffi::SOUP_WEBSOCKET_ERROR_BAD_ORIGIN => Self::BadOrigin, + value => Self::__Unknown(value), + } + } +} + +impl glib::error::ErrorDomain for WebsocketError { + #[inline] + fn domain() -> glib::Quark { + skip_assert_initialized!(); + + unsafe { from_glib(ffi::soup_websocket_error_quark()) } + } + + #[inline] + fn code(self) -> i32 { + self.into_glib() + } + + #[inline] + #[allow(clippy::match_single_binding)] + fn from(code: i32) -> Option { + skip_assert_initialized!(); + match unsafe { from_glib(code) } { + Self::__Unknown(_) => Some(Self::Failed), + value => Some(value), + } + } +} + +impl StaticType for WebsocketError { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_websocket_error_get_type()) } + } +} + +impl glib::HasParamSpec for WebsocketError { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for WebsocketError { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for WebsocketError { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for WebsocketError { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: WebsocketError) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "SoupWebsocketState")] +pub enum WebsocketState { + #[doc(alias = "SOUP_WEBSOCKET_STATE_OPEN")] + Open, + #[doc(alias = "SOUP_WEBSOCKET_STATE_CLOSING")] + Closing, + #[doc(alias = "SOUP_WEBSOCKET_STATE_CLOSED")] + Closed, + #[doc(hidden)] + __Unknown(i32), +} + +impl fmt::Display for WebsocketState { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "WebsocketState::{}", + match *self { + Self::Open => "Open", + Self::Closing => "Closing", + Self::Closed => "Closed", + _ => "Unknown", + } + ) + } +} + +#[doc(hidden)] +impl IntoGlib for WebsocketState { + type GlibType = ffi::SoupWebsocketState; + + #[inline] + fn into_glib(self) -> ffi::SoupWebsocketState { + match self { + Self::Open => ffi::SOUP_WEBSOCKET_STATE_OPEN, + Self::Closing => ffi::SOUP_WEBSOCKET_STATE_CLOSING, + Self::Closed => ffi::SOUP_WEBSOCKET_STATE_CLOSED, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for WebsocketState { + #[inline] + unsafe fn from_glib(value: ffi::SoupWebsocketState) -> Self { + skip_assert_initialized!(); + + match value { + ffi::SOUP_WEBSOCKET_STATE_OPEN => Self::Open, + ffi::SOUP_WEBSOCKET_STATE_CLOSING => Self::Closing, + ffi::SOUP_WEBSOCKET_STATE_CLOSED => Self::Closed, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for WebsocketState { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_websocket_state_get_type()) } + } +} + +impl glib::HasParamSpec for WebsocketState { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name, default_value| Self::ParamSpec::builder_with_default(name, default_value) + } +} + +impl glib::value::ValueType for WebsocketState { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for WebsocketState { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for WebsocketState { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: WebsocketState) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/flags.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/flags.rs new file mode 100644 index 00000000..cadc7154 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/flags.rs @@ -0,0 +1,383 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::{bitflags::bitflags, prelude::*, translate::*}; +use std::fmt; + +bitflags! { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] + #[doc(alias = "SoupCacheability")] + pub struct Cacheability: u32 { + #[doc(alias = "SOUP_CACHE_CACHEABLE")] + const CACHEABLE = ffi::SOUP_CACHE_CACHEABLE as _; + #[doc(alias = "SOUP_CACHE_UNCACHEABLE")] + const UNCACHEABLE = ffi::SOUP_CACHE_UNCACHEABLE as _; + #[doc(alias = "SOUP_CACHE_INVALIDATES")] + const INVALIDATES = ffi::SOUP_CACHE_INVALIDATES as _; + #[doc(alias = "SOUP_CACHE_VALIDATES")] + const VALIDATES = ffi::SOUP_CACHE_VALIDATES as _; + } +} + +impl fmt::Display for Cacheability { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + ::fmt(self, f) + } +} + +#[doc(hidden)] +impl IntoGlib for Cacheability { + type GlibType = ffi::SoupCacheability; + + #[inline] + fn into_glib(self) -> ffi::SoupCacheability { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for Cacheability { + #[inline] + unsafe fn from_glib(value: ffi::SoupCacheability) -> Self { + skip_assert_initialized!(); + Self::from_bits_truncate(value) + } +} + +impl StaticType for Cacheability { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_cacheability_get_type()) } + } +} + +impl glib::HasParamSpec for Cacheability { + type ParamSpec = glib::ParamSpecFlags; + type SetValue = Self; + type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name| Self::ParamSpec::builder(name) + } +} + +impl glib::value::ValueType for Cacheability { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for Cacheability { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl ToValue for Cacheability { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: Cacheability) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +bitflags! { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] + #[doc(alias = "SoupExpectation")] + pub struct Expectation: u32 { + #[doc(alias = "SOUP_EXPECTATION_UNRECOGNIZED")] + const UNRECOGNIZED = ffi::SOUP_EXPECTATION_UNRECOGNIZED as _; + #[doc(alias = "SOUP_EXPECTATION_CONTINUE")] + const CONTINUE = ffi::SOUP_EXPECTATION_CONTINUE as _; + } +} + +impl fmt::Display for Expectation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + ::fmt(self, f) + } +} + +#[doc(hidden)] +impl IntoGlib for Expectation { + type GlibType = ffi::SoupExpectation; + + #[inline] + fn into_glib(self) -> ffi::SoupExpectation { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for Expectation { + #[inline] + unsafe fn from_glib(value: ffi::SoupExpectation) -> Self { + skip_assert_initialized!(); + Self::from_bits_truncate(value) + } +} + +impl StaticType for Expectation { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_expectation_get_type()) } + } +} + +impl glib::HasParamSpec for Expectation { + type ParamSpec = glib::ParamSpecFlags; + type SetValue = Self; + type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name| Self::ParamSpec::builder(name) + } +} + +impl glib::value::ValueType for Expectation { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for Expectation { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl ToValue for Expectation { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: Expectation) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +bitflags! { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] + #[doc(alias = "SoupMessageFlags")] + pub struct MessageFlags: u32 { + #[doc(alias = "SOUP_MESSAGE_NO_REDIRECT")] + const NO_REDIRECT = ffi::SOUP_MESSAGE_NO_REDIRECT as _; + #[doc(alias = "SOUP_MESSAGE_NEW_CONNECTION")] + const NEW_CONNECTION = ffi::SOUP_MESSAGE_NEW_CONNECTION as _; + #[doc(alias = "SOUP_MESSAGE_IDEMPOTENT")] + const IDEMPOTENT = ffi::SOUP_MESSAGE_IDEMPOTENT as _; + #[doc(alias = "SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE")] + const DO_NOT_USE_AUTH_CACHE = ffi::SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE as _; + #[doc(alias = "SOUP_MESSAGE_COLLECT_METRICS")] + const COLLECT_METRICS = ffi::SOUP_MESSAGE_COLLECT_METRICS as _; + } +} + +impl fmt::Display for MessageFlags { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + ::fmt(self, f) + } +} + +#[doc(hidden)] +impl IntoGlib for MessageFlags { + type GlibType = ffi::SoupMessageFlags; + + #[inline] + fn into_glib(self) -> ffi::SoupMessageFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for MessageFlags { + #[inline] + unsafe fn from_glib(value: ffi::SoupMessageFlags) -> Self { + skip_assert_initialized!(); + Self::from_bits_truncate(value) + } +} + +impl StaticType for MessageFlags { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_message_flags_get_type()) } + } +} + +impl glib::HasParamSpec for MessageFlags { + type ParamSpec = glib::ParamSpecFlags; + type SetValue = Self; + type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name| Self::ParamSpec::builder(name) + } +} + +impl glib::value::ValueType for MessageFlags { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for MessageFlags { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl ToValue for MessageFlags { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: MessageFlags) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +bitflags! { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] + #[doc(alias = "SoupServerListenOptions")] + pub struct ServerListenOptions: u32 { + #[doc(alias = "SOUP_SERVER_LISTEN_HTTPS")] + const HTTPS = ffi::SOUP_SERVER_LISTEN_HTTPS as _; + #[doc(alias = "SOUP_SERVER_LISTEN_IPV4_ONLY")] + const IPV4_ONLY = ffi::SOUP_SERVER_LISTEN_IPV4_ONLY as _; + #[doc(alias = "SOUP_SERVER_LISTEN_IPV6_ONLY")] + const IPV6_ONLY = ffi::SOUP_SERVER_LISTEN_IPV6_ONLY as _; + } +} + +impl fmt::Display for ServerListenOptions { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + ::fmt(self, f) + } +} + +#[doc(hidden)] +impl IntoGlib for ServerListenOptions { + type GlibType = ffi::SoupServerListenOptions; + + #[inline] + fn into_glib(self) -> ffi::SoupServerListenOptions { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for ServerListenOptions { + #[inline] + unsafe fn from_glib(value: ffi::SoupServerListenOptions) -> Self { + skip_assert_initialized!(); + Self::from_bits_truncate(value) + } +} + +impl StaticType for ServerListenOptions { + #[inline] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::soup_server_listen_options_get_type()) } + } +} + +impl glib::HasParamSpec for ServerListenOptions { + type ParamSpec = glib::ParamSpecFlags; + type SetValue = Self; + type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + |name| Self::ParamSpec::builder(name) + } +} + +impl glib::value::ValueType for ServerListenOptions { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for ServerListenOptions { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl ToValue for ServerListenOptions { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: ServerListenOptions) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/functions.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/functions.rs new file mode 100644 index 00000000..19c20535 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/functions.rs @@ -0,0 +1,336 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{Cookie, DateFormat, HTTPVersion, Message, MessageHeaders}; +use glib::translate::*; +use std::{mem, ptr}; + +#[doc(alias = "soup_check_version")] +pub fn check_version(major: u32, minor: u32, micro: u32) -> bool { + assert_initialized_main_thread!(); + unsafe { from_glib(ffi::soup_check_version(major, minor, micro)) } +} + +#[doc(alias = "soup_cookies_from_request")] +pub fn cookies_from_request(msg: &Message) -> Vec { + skip_assert_initialized!(); + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_cookies_from_request(msg.to_glib_none().0)) + } +} + +#[doc(alias = "soup_cookies_from_response")] +pub fn cookies_from_response(msg: &Message) -> Vec { + skip_assert_initialized!(); + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_cookies_from_response(msg.to_glib_none().0)) + } +} + +#[doc(alias = "soup_date_time_new_from_http_string")] +pub fn date_time_new_from_http_string(date_string: &str) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_date_time_new_from_http_string( + date_string.to_glib_none().0, + )) + } +} + +#[doc(alias = "soup_date_time_to_string")] +pub fn date_time_to_string(date: &glib::DateTime, format: DateFormat) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_date_time_to_string( + date.to_glib_none().0, + format.into_glib(), + )) + } +} + +//#[doc(alias = "soup_form_decode")] +//pub fn form_decode(encoded_form: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { +// unsafe { TODO: call ffi:soup_form_decode() } +//} + +//#[doc(alias = "soup_form_decode_multipart")] +//pub fn form_decode_multipart(multipart: &mut Multipart, file_control_name: Option<&str>) -> (/*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, glib::GString, glib::GString, glib::Bytes) { +// unsafe { TODO: call ffi:soup_form_decode_multipart() } +//} + +//#[doc(alias = "soup_form_encode")] +//pub fn form_encode(first_field: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option { +// unsafe { TODO: call ffi:soup_form_encode() } +//} + +//#[doc(alias = "soup_form_encode_datalist")] +//pub fn form_encode_datalist(form_data_set: /*Ignored*/&mut glib::Data) -> Option { +// unsafe { TODO: call ffi:soup_form_encode_datalist() } +//} + +//#[doc(alias = "soup_form_encode_hash")] +//pub fn form_encode_hash(form_data_set: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) -> Option { +// unsafe { TODO: call ffi:soup_form_encode_hash() } +//} + +//#[doc(alias = "soup_form_encode_valist")] +//pub fn form_encode_valist(first_field: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option { +// unsafe { TODO: call ffi:soup_form_encode_valist() } +//} + +#[doc(alias = "soup_get_major_version")] +#[doc(alias = "get_major_version")] +pub fn major_version() -> u32 { + assert_initialized_main_thread!(); + unsafe { ffi::soup_get_major_version() } +} + +#[doc(alias = "soup_get_micro_version")] +#[doc(alias = "get_micro_version")] +pub fn micro_version() -> u32 { + assert_initialized_main_thread!(); + unsafe { ffi::soup_get_micro_version() } +} + +#[doc(alias = "soup_get_minor_version")] +#[doc(alias = "get_minor_version")] +pub fn minor_version() -> u32 { + assert_initialized_main_thread!(); + unsafe { ffi::soup_get_minor_version() } +} + +#[doc(alias = "soup_header_contains")] +pub fn header_contains(header: &str, token: &str) -> bool { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::soup_header_contains( + header.to_glib_none().0, + token.to_glib_none().0, + )) + } +} + +//#[doc(alias = "soup_header_free_list")] +//pub fn header_free_list(list: /*Unimplemented*/&[&Basic: Pointer]) { +// unsafe { TODO: call ffi:soup_header_free_list() } +//} + +//#[doc(alias = "soup_header_free_param_list")] +//pub fn header_free_param_list(param_list: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) { +// unsafe { TODO: call ffi:soup_header_free_param_list() } +//} + +//#[doc(alias = "soup_header_g_string_append_param")] +//pub fn header_g_string_append_param(string: /*Ignored*/&mut glib::String, name: &str, value: Option<&str>) { +// unsafe { TODO: call ffi:soup_header_g_string_append_param() } +//} + +//#[doc(alias = "soup_header_g_string_append_param_quoted")] +//pub fn header_g_string_append_param_quoted(string: /*Ignored*/&mut glib::String, name: &str, value: &str) { +// unsafe { TODO: call ffi:soup_header_g_string_append_param_quoted() } +//} + +#[doc(alias = "soup_header_parse_list")] +pub fn header_parse_list(header: &str) -> Vec { + assert_initialized_main_thread!(); + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_header_parse_list(header.to_glib_none().0)) + } +} + +//#[doc(alias = "soup_header_parse_param_list")] +//pub fn header_parse_param_list(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { +// unsafe { TODO: call ffi:soup_header_parse_param_list() } +//} + +//#[doc(alias = "soup_header_parse_param_list_strict")] +//pub fn header_parse_param_list_strict(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { +// unsafe { TODO: call ffi:soup_header_parse_param_list_strict() } +//} + +//#[doc(alias = "soup_header_parse_quality_list")] +//pub fn header_parse_quality_list(header: &str, unacceptable: /*Unimplemented*/Vec) -> Vec { +// unsafe { TODO: call ffi:soup_header_parse_quality_list() } +//} + +//#[doc(alias = "soup_header_parse_semi_param_list")] +//pub fn header_parse_semi_param_list(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { +// unsafe { TODO: call ffi:soup_header_parse_semi_param_list() } +//} + +//#[doc(alias = "soup_header_parse_semi_param_list_strict")] +//pub fn header_parse_semi_param_list_strict(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { +// unsafe { TODO: call ffi:soup_header_parse_semi_param_list_strict() } +//} + +#[doc(alias = "soup_headers_parse")] +pub fn headers_parse(str: &str, dest: &MessageHeaders) -> bool { + assert_initialized_main_thread!(); + let len = str.len() as _; + unsafe { + from_glib(ffi::soup_headers_parse( + str.to_glib_none().0, + len, + dest.to_glib_none().0, + )) + } +} + +#[doc(alias = "soup_headers_parse_request")] +pub fn headers_parse_request( + str: &str, + req_headers: &MessageHeaders, +) -> (u32, glib::GString, glib::GString, HTTPVersion) { + assert_initialized_main_thread!(); + let len = str.len() as _; + unsafe { + let mut req_method = ptr::null_mut(); + let mut req_path = ptr::null_mut(); + let mut ver = mem::MaybeUninit::uninit(); + let ret = ffi::soup_headers_parse_request( + str.to_glib_none().0, + len, + req_headers.to_glib_none().0, + &mut req_method, + &mut req_path, + ver.as_mut_ptr(), + ); + ( + ret, + from_glib_full(req_method), + from_glib_full(req_path), + from_glib(ver.assume_init()), + ) + } +} + +#[doc(alias = "soup_headers_parse_response")] +pub fn headers_parse_response( + str: &str, + headers: &MessageHeaders, +) -> Option<(HTTPVersion, u32, glib::GString)> { + assert_initialized_main_thread!(); + let len = str.len() as _; + unsafe { + let mut ver = mem::MaybeUninit::uninit(); + let mut status_code = mem::MaybeUninit::uninit(); + let mut reason_phrase = ptr::null_mut(); + let ret = from_glib(ffi::soup_headers_parse_response( + str.to_glib_none().0, + len, + headers.to_glib_none().0, + ver.as_mut_ptr(), + status_code.as_mut_ptr(), + &mut reason_phrase, + )); + if ret { + Some(( + from_glib(ver.assume_init()), + status_code.assume_init(), + from_glib_full(reason_phrase), + )) + } else { + None + } + } +} + +#[doc(alias = "soup_headers_parse_status_line")] +pub fn headers_parse_status_line(status_line: &str) -> Option<(HTTPVersion, u32, glib::GString)> { + assert_initialized_main_thread!(); + unsafe { + let mut ver = mem::MaybeUninit::uninit(); + let mut status_code = mem::MaybeUninit::uninit(); + let mut reason_phrase = ptr::null_mut(); + let ret = from_glib(ffi::soup_headers_parse_status_line( + status_line.to_glib_none().0, + ver.as_mut_ptr(), + status_code.as_mut_ptr(), + &mut reason_phrase, + )); + if ret { + Some(( + from_glib(ver.assume_init()), + status_code.assume_init(), + from_glib_full(reason_phrase), + )) + } else { + None + } + } +} + +#[doc(alias = "soup_tld_domain_is_public_suffix")] +pub fn tld_domain_is_public_suffix(domain: &str) -> bool { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::soup_tld_domain_is_public_suffix( + domain.to_glib_none().0, + )) + } +} + +#[doc(alias = "soup_tld_get_base_domain")] +pub fn tld_get_base_domain(hostname: &str) -> Result { + assert_initialized_main_thread!(); + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_tld_get_base_domain(hostname.to_glib_none().0, &mut error); + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } + } +} + +//#[doc(alias = "soup_uri_copy")] +//pub fn uri_copy(uri: &glib::Uri, first_component: URIComponent, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option { +// unsafe { TODO: call ffi:soup_uri_copy() } +//} + +#[doc(alias = "soup_uri_decode_data_uri")] +pub fn uri_decode_data_uri(uri: &str) -> (glib::Bytes, Option) { + assert_initialized_main_thread!(); + unsafe { + let mut content_type = ptr::null_mut(); + let ret = from_glib_full(ffi::soup_uri_decode_data_uri( + uri.to_glib_none().0, + &mut content_type, + )); + (ret, from_glib_full(content_type)) + } +} + +#[doc(alias = "soup_uri_equal")] +pub fn uri_equal(uri1: &glib::Uri, uri2: &glib::Uri) -> bool { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::soup_uri_equal( + uri1.to_glib_none().0, + uri2.to_glib_none().0, + )) + } +} + +//#[doc(alias = "soup_websocket_client_prepare_handshake")] +//pub fn websocket_client_prepare_handshake(msg: &Message, origin: Option<&str>, protocols: &[&str], supported_extensions: /*Ignored*/&[&glib::TypeClass]) { +// unsafe { TODO: call ffi:soup_websocket_client_prepare_handshake() } +//} + +//#[doc(alias = "soup_websocket_client_verify_handshake")] +//pub fn websocket_client_verify_handshake(msg: &Message, supported_extensions: /*Ignored*/&[&glib::TypeClass], accepted_extensions: /*Unimplemented*/Vec) -> Result<(), glib::Error> { +// unsafe { TODO: call ffi:soup_websocket_client_verify_handshake() } +//} + +//#[doc(alias = "soup_websocket_server_check_handshake")] +//pub fn websocket_server_check_handshake(msg: &ServerMessage, origin: Option<&str>, protocols: &[&str], supported_extensions: /*Ignored*/&[&glib::TypeClass]) -> Result<(), glib::Error> { +// unsafe { TODO: call ffi:soup_websocket_server_check_handshake() } +//} + +//#[doc(alias = "soup_websocket_server_process_handshake")] +//pub fn websocket_server_process_handshake(msg: &ServerMessage, expected_origin: Option<&str>, protocols: &[&str], supported_extensions: /*Ignored*/&[&glib::TypeClass], accepted_extensions: /*Unimplemented*/Vec) -> bool { +// unsafe { TODO: call ffi:soup_websocket_server_process_handshake() } +//} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer.rs new file mode 100644 index 00000000..665f9d65 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer.rs @@ -0,0 +1,148 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{HSTSPolicy, SessionFeature}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupHSTSEnforcer")] + pub struct HSTSEnforcer(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_hsts_enforcer_get_type(), + } +} + +impl HSTSEnforcer { + pub const NONE: Option<&'static HSTSEnforcer> = None; + + #[doc(alias = "soup_hsts_enforcer_new")] + pub fn new() -> HSTSEnforcer { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_hsts_enforcer_new()) } + } +} + +impl Default for HSTSEnforcer { + fn default() -> Self { + Self::new() + } +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait HSTSEnforcerExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_hsts_enforcer_get_domains")] + #[doc(alias = "get_domains")] + fn domains(&self, session_policies: bool) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_hsts_enforcer_get_domains( + self.as_ref().to_glib_none().0, + session_policies.into_glib(), + )) + } + } + + #[doc(alias = "soup_hsts_enforcer_get_policies")] + #[doc(alias = "get_policies")] + fn policies(&self, session_policies: bool) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_hsts_enforcer_get_policies( + self.as_ref().to_glib_none().0, + session_policies.into_glib(), + )) + } + } + + #[doc(alias = "soup_hsts_enforcer_has_valid_policy")] + fn has_valid_policy(&self, domain: &str) -> bool { + unsafe { + from_glib(ffi::soup_hsts_enforcer_has_valid_policy( + self.as_ref().to_glib_none().0, + domain.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_hsts_enforcer_is_persistent")] + fn is_persistent(&self) -> bool { + unsafe { + from_glib(ffi::soup_hsts_enforcer_is_persistent( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_hsts_enforcer_set_policy")] + fn set_policy(&self, policy: &mut HSTSPolicy) { + unsafe { + ffi::soup_hsts_enforcer_set_policy( + self.as_ref().to_glib_none().0, + policy.to_glib_none_mut().0, + ); + } + } + + #[doc(alias = "soup_hsts_enforcer_set_session_policy")] + fn set_session_policy(&self, domain: &str, include_subdomains: bool) { + unsafe { + ffi::soup_hsts_enforcer_set_session_policy( + self.as_ref().to_glib_none().0, + domain.to_glib_none().0, + include_subdomains.into_glib(), + ); + } + } + + #[doc(alias = "changed")] + fn connect_changed( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn changed_trampoline< + P: IsA, + F: Fn(&P, &HSTSPolicy, &HSTSPolicy) + 'static, + >( + this: *mut ffi::SoupHSTSEnforcer, + old_policy: *mut ffi::SoupHSTSPolicy, + new_policy: *mut ffi::SoupHSTSPolicy, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + HSTSEnforcer::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(old_policy), + &from_glib_borrow(new_policy), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"changed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + changed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl> HSTSEnforcerExt for O {} + +impl fmt::Display for HSTSEnforcer { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("HSTSEnforcer") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer_db.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer_db.rs new file mode 100644 index 00000000..380d61c0 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_enforcer_db.rs @@ -0,0 +1,38 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{HSTSEnforcer, SessionFeature}; +use glib::{prelude::*, translate::*}; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupHSTSEnforcerDB")] + pub struct HSTSEnforcerDB(Object) @extends HSTSEnforcer, @implements SessionFeature; + + match fn { + type_ => || ffi::soup_hsts_enforcer_db_get_type(), + } +} + +impl HSTSEnforcerDB { + #[doc(alias = "soup_hsts_enforcer_db_new")] + pub fn new(filename: &str) -> HSTSEnforcerDB { + assert_initialized_main_thread!(); + unsafe { + HSTSEnforcer::from_glib_full(ffi::soup_hsts_enforcer_db_new(filename.to_glib_none().0)) + .unsafe_cast() + } + } + + pub fn filename(&self) -> Option { + ObjectExt::property(self, "filename") + } +} + +impl fmt::Display for HSTSEnforcerDB { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("HSTSEnforcerDB") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_policy.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_policy.rs new file mode 100644 index 00000000..8d4ac4c7 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/hsts_policy.rs @@ -0,0 +1,113 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::Message; +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct HSTSPolicy(Boxed); + + match fn { + copy => |ptr| ffi::soup_hsts_policy_copy(mut_override(ptr)), + free => |ptr| ffi::soup_hsts_policy_free(ptr), + type_ => || ffi::soup_hsts_policy_get_type(), + } +} + +impl HSTSPolicy { + #[doc(alias = "soup_hsts_policy_new")] + pub fn new(domain: &str, max_age: libc::c_ulong, include_subdomains: bool) -> HSTSPolicy { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_hsts_policy_new( + domain.to_glib_none().0, + max_age, + include_subdomains.into_glib(), + )) + } + } + + #[doc(alias = "soup_hsts_policy_new_from_response")] + #[doc(alias = "new_from_response")] + pub fn from_response(msg: &Message) -> Option { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::soup_hsts_policy_new_from_response( + msg.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_hsts_policy_new_full")] + pub fn new_full( + domain: &str, + max_age: libc::c_ulong, + expires: &glib::DateTime, + include_subdomains: bool, + ) -> HSTSPolicy { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_hsts_policy_new_full( + domain.to_glib_none().0, + max_age, + expires.to_glib_none().0, + include_subdomains.into_glib(), + )) + } + } + + #[doc(alias = "soup_hsts_policy_new_session_policy")] + pub fn new_session_policy(domain: &str, include_subdomains: bool) -> HSTSPolicy { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_hsts_policy_new_session_policy( + domain.to_glib_none().0, + include_subdomains.into_glib(), + )) + } + } + + #[doc(alias = "soup_hsts_policy_get_domain")] + #[doc(alias = "get_domain")] + pub fn domain(&mut self) -> Option { + unsafe { from_glib_none(ffi::soup_hsts_policy_get_domain(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_hsts_policy_get_expires")] + #[doc(alias = "get_expires")] + pub fn expires(&mut self) -> Option { + unsafe { from_glib_full(ffi::soup_hsts_policy_get_expires(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_hsts_policy_get_max_age")] + #[doc(alias = "get_max_age")] + pub fn max_age(&mut self) -> libc::c_ulong { + unsafe { ffi::soup_hsts_policy_get_max_age(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_hsts_policy_includes_subdomains")] + pub fn includes_subdomains(&mut self) -> bool { + unsafe { + from_glib(ffi::soup_hsts_policy_includes_subdomains( + self.to_glib_none_mut().0, + )) + } + } + + #[doc(alias = "soup_hsts_policy_is_expired")] + pub fn is_expired(&mut self) -> bool { + unsafe { from_glib(ffi::soup_hsts_policy_is_expired(self.to_glib_none_mut().0)) } + } + + #[doc(alias = "soup_hsts_policy_is_session_policy")] + pub fn is_session_policy(&mut self) -> bool { + unsafe { + from_glib(ffi::soup_hsts_policy_is_session_policy( + self.to_glib_none_mut().0, + )) + } + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/logger.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/logger.rs new file mode 100644 index 00000000..0a4c4507 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/logger.rs @@ -0,0 +1,174 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{LoggerLogLevel, Message, SessionFeature}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupLogger")] + pub struct Logger(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_logger_get_type(), + } +} + +impl Logger { + #[doc(alias = "soup_logger_new")] + pub fn new(level: LoggerLogLevel) -> Logger { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_logger_new(level.into_glib())) } + } + + #[doc(alias = "soup_logger_get_max_body_size")] + #[doc(alias = "get_max_body_size")] + pub fn max_body_size(&self) -> i32 { + unsafe { ffi::soup_logger_get_max_body_size(self.to_glib_none().0) } + } + + #[doc(alias = "soup_logger_set_max_body_size")] + pub fn set_max_body_size(&self, max_body_size: i32) { + unsafe { + ffi::soup_logger_set_max_body_size(self.to_glib_none().0, max_body_size); + } + } + + #[doc(alias = "soup_logger_set_request_filter")] + pub fn set_request_filter LoggerLogLevel + 'static>( + &self, + request_filter: P, + ) { + let request_filter_data: Box_

= Box_::new(request_filter); + unsafe extern "C" fn request_filter_func< + P: Fn(&Logger, &Message) -> LoggerLogLevel + 'static, + >( + logger: *mut ffi::SoupLogger, + msg: *mut ffi::SoupMessage, + user_data: glib::ffi::gpointer, + ) -> ffi::SoupLoggerLogLevel { + let logger = from_glib_borrow(logger); + let msg = from_glib_borrow(msg); + let callback: &P = &*(user_data as *mut _); + (*callback)(&logger, &msg).into_glib() + } + let request_filter = Some(request_filter_func::

as _); + unsafe extern "C" fn destroy_func LoggerLogLevel + 'static>( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call3 = Some(destroy_func::

as _); + let super_callback0: Box_

= request_filter_data; + unsafe { + ffi::soup_logger_set_request_filter( + self.to_glib_none().0, + request_filter, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + ); + } + } + + #[doc(alias = "soup_logger_set_response_filter")] + pub fn set_response_filter LoggerLogLevel + 'static>( + &self, + response_filter: P, + ) { + let response_filter_data: Box_

= Box_::new(response_filter); + unsafe extern "C" fn response_filter_func< + P: Fn(&Logger, &Message) -> LoggerLogLevel + 'static, + >( + logger: *mut ffi::SoupLogger, + msg: *mut ffi::SoupMessage, + user_data: glib::ffi::gpointer, + ) -> ffi::SoupLoggerLogLevel { + let logger = from_glib_borrow(logger); + let msg = from_glib_borrow(msg); + let callback: &P = &*(user_data as *mut _); + (*callback)(&logger, &msg).into_glib() + } + let response_filter = Some(response_filter_func::

as _); + unsafe extern "C" fn destroy_func LoggerLogLevel + 'static>( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call3 = Some(destroy_func::

as _); + let super_callback0: Box_

= response_filter_data; + unsafe { + ffi::soup_logger_set_response_filter( + self.to_glib_none().0, + response_filter, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + ); + } + } + + pub fn level(&self) -> LoggerLogLevel { + ObjectExt::property(self, "level") + } + + pub fn set_level(&self, level: LoggerLogLevel) { + ObjectExt::set_property(self, "level", level) + } + + #[doc(alias = "level")] + pub fn connect_level_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_level_trampoline( + this: *mut ffi::SoupLogger, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::level\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_level_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "max-body-size")] + pub fn connect_max_body_size_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_max_body_size_trampoline( + this: *mut ffi::SoupLogger, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-body-size\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_max_body_size_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl fmt::Display for Logger { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("Logger") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/message.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/message.rs new file mode 100644 index 00000000..969d6f64 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/message.rs @@ -0,0 +1,1281 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{ + Auth, HTTPVersion, MessageFlags, MessageHeaders, MessageMetrics, MessagePriority, Multipart, + Status, +}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupMessage")] + pub struct Message(Object); + + match fn { + type_ => || ffi::soup_message_get_type(), + } +} + +impl Message { + #[doc(alias = "soup_message_new")] + pub fn new(method: &str, uri_string: &str) -> Result { + assert_initialized_main_thread!(); + unsafe { + Option::<_>::from_glib_full(ffi::soup_message_new( + method.to_glib_none().0, + uri_string.to_glib_none().0, + )) + .ok_or_else(|| glib::bool_error!("Invalid URL")) + } + } + + #[doc(alias = "soup_message_new_from_encoded_form")] + #[doc(alias = "new_from_encoded_form")] + pub fn from_encoded_form( + method: &str, + uri_string: &str, + encoded_form: glib::GString, + ) -> Result { + assert_initialized_main_thread!(); + unsafe { + Option::<_>::from_glib_full(ffi::soup_message_new_from_encoded_form( + method.to_glib_none().0, + uri_string.to_glib_none().0, + encoded_form.into_glib_ptr(), + )) + .ok_or_else(|| glib::bool_error!("Invalid URL")) + } + } + + #[doc(alias = "soup_message_new_from_multipart")] + #[doc(alias = "new_from_multipart")] + pub fn from_multipart( + uri_string: &str, + multipart: &mut Multipart, + ) -> Result { + assert_initialized_main_thread!(); + unsafe { + Option::<_>::from_glib_full(ffi::soup_message_new_from_multipart( + uri_string.to_glib_none().0, + multipart.to_glib_none_mut().0, + )) + .ok_or_else(|| glib::bool_error!("Invalid URL")) + } + } + + #[doc(alias = "soup_message_new_from_uri")] + #[doc(alias = "new_from_uri")] + pub fn from_uri(method: &str, uri: &glib::Uri) -> Message { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_message_new_from_uri( + method.to_glib_none().0, + uri.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_new_options_ping")] + pub fn new_options_ping(base_uri: &glib::Uri) -> Message { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_message_new_options_ping( + base_uri.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_add_flags")] + pub fn add_flags(&self, flags: MessageFlags) { + unsafe { + ffi::soup_message_add_flags(self.to_glib_none().0, flags.into_glib()); + } + } + + //#[doc(alias = "soup_message_add_header_handler")] + //pub fn add_header_handler(&self, signal: &str, header: &str, callback: P, user_data: /*Unimplemented*/Option) -> u32 { + // unsafe { TODO: call ffi:soup_message_add_header_handler() } + //} + + //#[doc(alias = "soup_message_add_status_code_handler")] + //pub fn add_status_code_handler(&self, signal: &str, status_code: u32, callback: P, user_data: /*Unimplemented*/Option) -> u32 { + // unsafe { TODO: call ffi:soup_message_add_status_code_handler() } + //} + + #[doc(alias = "soup_message_disable_feature")] + pub fn disable_feature(&self, feature_type: glib::types::Type) { + unsafe { + ffi::soup_message_disable_feature(self.to_glib_none().0, feature_type.into_glib()); + } + } + + #[doc(alias = "soup_message_get_connection_id")] + #[doc(alias = "get_connection_id")] + pub fn connection_id(&self) -> u64 { + unsafe { ffi::soup_message_get_connection_id(self.to_glib_none().0) } + } + + #[doc(alias = "soup_message_get_first_party")] + #[doc(alias = "get_first_party")] + pub fn first_party(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_first_party(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_flags")] + #[doc(alias = "get_flags")] + pub fn flags(&self) -> MessageFlags { + unsafe { from_glib(ffi::soup_message_get_flags(self.to_glib_none().0)) } + } + + #[cfg(feature = "v3_4")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] + #[doc(alias = "soup_message_get_force_http1")] + #[doc(alias = "get_force_http1")] + pub fn is_force_http1(&self) -> bool { + unsafe { from_glib(ffi::soup_message_get_force_http1(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_http_version")] + #[doc(alias = "get_http_version")] + pub fn http_version(&self) -> HTTPVersion { + unsafe { from_glib(ffi::soup_message_get_http_version(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_is_options_ping")] + #[doc(alias = "get_is_options_ping")] + pub fn is_options_ping(&self) -> bool { + unsafe { from_glib(ffi::soup_message_get_is_options_ping(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_is_top_level_navigation")] + #[doc(alias = "get_is_top_level_navigation")] + pub fn is_top_level_navigation(&self) -> bool { + unsafe { + from_glib(ffi::soup_message_get_is_top_level_navigation( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_get_method")] + #[doc(alias = "get_method")] + pub fn method(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_method(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_metrics")] + #[doc(alias = "get_metrics")] + pub fn metrics(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_metrics(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_priority")] + #[doc(alias = "get_priority")] + pub fn priority(&self) -> MessagePriority { + unsafe { from_glib(ffi::soup_message_get_priority(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_reason_phrase")] + #[doc(alias = "get_reason_phrase")] + pub fn reason_phrase(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_reason_phrase(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_remote_address")] + #[doc(alias = "get_remote_address")] + pub fn remote_address(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_remote_address(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_request_headers")] + #[doc(alias = "get_request_headers")] + pub fn request_headers(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_request_headers(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_response_headers")] + #[doc(alias = "get_response_headers")] + pub fn response_headers(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_message_get_response_headers( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_get_status")] + #[doc(alias = "get_status")] + pub fn status(&self) -> Status { + unsafe { from_glib(ffi::soup_message_get_status(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_get_tls_ciphersuite_name")] + #[doc(alias = "get_tls_ciphersuite_name")] + pub fn tls_ciphersuite_name(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_message_get_tls_ciphersuite_name( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_get_tls_peer_certificate")] + #[doc(alias = "get_tls_peer_certificate")] + pub fn tls_peer_certificate(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_message_get_tls_peer_certificate( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_get_tls_peer_certificate_errors")] + #[doc(alias = "get_tls_peer_certificate_errors")] + pub fn tls_peer_certificate_errors(&self) -> gio::TlsCertificateFlags { + unsafe { + from_glib(ffi::soup_message_get_tls_peer_certificate_errors( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_get_tls_protocol_version")] + #[doc(alias = "get_tls_protocol_version")] + #[cfg(feature = "v2_70")] + #[cfg_attr(docsrs, doc(cfg(feature = "v2_70")))] + pub fn tls_protocol_version(&self) -> gio::TlsProtocolVersion { + unsafe { + from_glib(ffi::soup_message_get_tls_protocol_version( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_get_uri")] + #[doc(alias = "get_uri")] + pub fn uri(&self) -> Option { + unsafe { from_glib_none(ffi::soup_message_get_uri(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_is_feature_disabled")] + pub fn is_feature_disabled(&self, feature_type: glib::types::Type) -> bool { + unsafe { + from_glib(ffi::soup_message_is_feature_disabled( + self.to_glib_none().0, + feature_type.into_glib(), + )) + } + } + + #[doc(alias = "soup_message_is_keepalive")] + pub fn is_keepalive(&self) -> bool { + unsafe { from_glib(ffi::soup_message_is_keepalive(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_query_flags")] + pub fn query_flags(&self, flags: MessageFlags) -> bool { + unsafe { + from_glib(ffi::soup_message_query_flags( + self.to_glib_none().0, + flags.into_glib(), + )) + } + } + + #[doc(alias = "soup_message_remove_flags")] + pub fn remove_flags(&self, flags: MessageFlags) { + unsafe { + ffi::soup_message_remove_flags(self.to_glib_none().0, flags.into_glib()); + } + } + + #[doc(alias = "soup_message_set_first_party")] + pub fn set_first_party(&self, first_party: &glib::Uri) { + unsafe { + ffi::soup_message_set_first_party(self.to_glib_none().0, first_party.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_set_flags")] + pub fn set_flags(&self, flags: MessageFlags) { + unsafe { + ffi::soup_message_set_flags(self.to_glib_none().0, flags.into_glib()); + } + } + + #[cfg(feature = "v3_4")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] + #[doc(alias = "soup_message_set_force_http1")] + pub fn set_force_http1(&self, value: bool) { + unsafe { + ffi::soup_message_set_force_http1(self.to_glib_none().0, value.into_glib()); + } + } + + #[doc(alias = "soup_message_set_is_options_ping")] + pub fn set_is_options_ping(&self, is_options_ping: bool) { + unsafe { + ffi::soup_message_set_is_options_ping( + self.to_glib_none().0, + is_options_ping.into_glib(), + ); + } + } + + #[doc(alias = "soup_message_set_is_top_level_navigation")] + pub fn set_is_top_level_navigation(&self, is_top_level_navigation: bool) { + unsafe { + ffi::soup_message_set_is_top_level_navigation( + self.to_glib_none().0, + is_top_level_navigation.into_glib(), + ); + } + } + + #[doc(alias = "soup_message_set_method")] + pub fn set_method(&self, method: &str) { + unsafe { + ffi::soup_message_set_method(self.to_glib_none().0, method.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_set_priority")] + pub fn set_priority(&self, priority: MessagePriority) { + unsafe { + ffi::soup_message_set_priority(self.to_glib_none().0, priority.into_glib()); + } + } + + #[doc(alias = "soup_message_set_request_body")] + pub fn set_request_body( + &self, + content_type: Option<&str>, + stream: Option<&impl IsA>, + content_length: isize, + ) { + unsafe { + ffi::soup_message_set_request_body( + self.to_glib_none().0, + content_type.to_glib_none().0, + stream.map(|p| p.as_ref()).to_glib_none().0, + content_length, + ); + } + } + + #[doc(alias = "soup_message_set_request_body_from_bytes")] + pub fn set_request_body_from_bytes( + &self, + content_type: Option<&str>, + bytes: Option<&glib::Bytes>, + ) { + unsafe { + ffi::soup_message_set_request_body_from_bytes( + self.to_glib_none().0, + content_type.to_glib_none().0, + bytes.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_message_set_tls_client_certificate")] + pub fn set_tls_client_certificate(&self, certificate: Option<&impl IsA>) { + unsafe { + ffi::soup_message_set_tls_client_certificate( + self.to_glib_none().0, + certificate.map(|p| p.as_ref()).to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_message_set_uri")] + pub fn set_uri(&self, uri: &glib::Uri) { + unsafe { + ffi::soup_message_set_uri(self.to_glib_none().0, uri.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_tls_client_certificate_password_request_complete")] + pub fn tls_client_certificate_password_request_complete(&self) { + unsafe { + ffi::soup_message_tls_client_certificate_password_request_complete( + self.to_glib_none().0, + ); + } + } + + #[doc(alias = "site-for-cookies")] + pub fn site_for_cookies(&self) -> Option { + ObjectExt::property(self, "site-for-cookies") + } + + #[doc(alias = "site-for-cookies")] + pub fn set_site_for_cookies(&self, site_for_cookies: Option<&glib::Uri>) { + ObjectExt::set_property(self, "site-for-cookies", site_for_cookies) + } + + #[doc(alias = "status-code")] + pub fn status_code(&self) -> u32 { + ObjectExt::property(self, "status-code") + } + + #[doc(alias = "accept-certificate")] + pub fn connect_accept_certificate< + F: Fn(&Self, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn accept_certificate_trampoline< + F: Fn(&Message, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, + >( + this: *mut ffi::SoupMessage, + tls_peer_certificate: *mut gio::ffi::GTlsCertificate, + tls_peer_errors: gio::ffi::GTlsCertificateFlags, + f: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let f: &F = &*(f as *const F); + f( + &from_glib_borrow(this), + &from_glib_borrow(tls_peer_certificate), + from_glib(tls_peer_errors), + ) + .into_glib() + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"accept-certificate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + accept_certificate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "authenticate")] + pub fn connect_authenticate bool + 'static>( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn authenticate_trampoline< + F: Fn(&Message, &Auth, bool) -> bool + 'static, + >( + this: *mut ffi::SoupMessage, + auth: *mut ffi::SoupAuth, + retrying: glib::ffi::gboolean, + f: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let f: &F = &*(f as *const F); + f( + &from_glib_borrow(this), + &from_glib_borrow(auth), + from_glib(retrying), + ) + .into_glib() + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"authenticate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + authenticate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + //#[doc(alias = "content-sniffed")] + //pub fn connect_content_sniffed(&self, f: F) -> SignalHandlerId { + // Empty ctype params: *.HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } + //} + + #[doc(alias = "finished")] + pub fn connect_finished(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn finished_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"finished\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + finished_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "got-body")] + pub fn connect_got_body(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_body_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-body\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_body_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[cfg(feature = "v3_4")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] + #[doc(alias = "got-body-data")] + pub fn connect_got_body_data(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_body_data_trampoline( + this: *mut ffi::SoupMessage, + chunk_size: libc::c_uint, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), chunk_size) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-body-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_body_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "got-headers")] + pub fn connect_got_headers(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_headers_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-headers\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_headers_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "got-informational")] + pub fn connect_got_informational(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_informational_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-informational\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_informational_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "hsts-enforced")] + pub fn connect_hsts_enforced(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn hsts_enforced_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"hsts-enforced\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + hsts_enforced_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "network-event")] + pub fn connect_network_event( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn network_event_trampoline< + F: Fn(&Message, gio::SocketClientEvent, &gio::IOStream) + 'static, + >( + this: *mut ffi::SoupMessage, + event: gio::ffi::GSocketClientEvent, + connection: *mut gio::ffi::GIOStream, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + &from_glib_borrow(this), + from_glib(event), + &from_glib_borrow(connection), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"network-event\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + network_event_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-certificate")] + pub fn connect_request_certificate< + F: Fn(&Self, &gio::TlsClientConnection) -> bool + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn request_certificate_trampoline< + F: Fn(&Message, &gio::TlsClientConnection) -> bool + 'static, + >( + this: *mut ffi::SoupMessage, + tls_connection: *mut gio::ffi::GTlsClientConnection, + f: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), &from_glib_borrow(tls_connection)).into_glib() + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-certificate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_certificate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-certificate-password")] + pub fn connect_request_certificate_password< + F: Fn(&Self, &gio::TlsPassword) -> bool + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn request_certificate_password_trampoline< + F: Fn(&Message, &gio::TlsPassword) -> bool + 'static, + >( + this: *mut ffi::SoupMessage, + tls_password: *mut gio::ffi::GTlsPassword, + f: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), &from_glib_borrow(tls_password)).into_glib() + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-certificate-password\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_certificate_password_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "restarted")] + pub fn connect_restarted(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn restarted_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"restarted\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + restarted_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "starting")] + pub fn connect_starting(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn starting_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"starting\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + starting_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-body")] + pub fn connect_wrote_body(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_body_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-body\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_body_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-body-data")] + pub fn connect_wrote_body_data(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_body_data_trampoline( + this: *mut ffi::SoupMessage, + chunk_size: libc::c_uint, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), chunk_size) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-body-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_body_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-headers")] + pub fn connect_wrote_headers(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_headers_trampoline( + this: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-headers\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_headers_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "first-party")] + pub fn connect_first_party_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_first_party_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::first-party\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_first_party_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "flags")] + pub fn connect_flags_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_flags_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::flags\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_flags_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "http-version")] + pub fn connect_http_version_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_http_version_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::http-version\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_http_version_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "is-options-ping")] + pub fn connect_is_options_ping_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_is_options_ping_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-options-ping\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_is_options_ping_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "is-top-level-navigation")] + pub fn connect_is_top_level_navigation_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_is_top_level_navigation_trampoline< + F: Fn(&Message) + 'static, + >( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::is-top-level-navigation\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_is_top_level_navigation_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "method")] + pub fn connect_method_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_method_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::method\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_method_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "priority")] + pub fn connect_priority_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_priority_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::priority\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_priority_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "reason-phrase")] + pub fn connect_reason_phrase_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_reason_phrase_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::reason-phrase\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_reason_phrase_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "remote-address")] + pub fn connect_remote_address_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_remote_address_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::remote-address\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_remote_address_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-headers")] + pub fn connect_request_headers_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_request_headers_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::request-headers\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_request_headers_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "response-headers")] + pub fn connect_response_headers_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_response_headers_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::response-headers\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_response_headers_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "site-for-cookies")] + pub fn connect_site_for_cookies_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_site_for_cookies_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::site-for-cookies\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_site_for_cookies_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "status-code")] + pub fn connect_status_code_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_status_code_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::status-code\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_status_code_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-ciphersuite-name")] + pub fn connect_tls_ciphersuite_name_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_ciphersuite_name_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-ciphersuite-name\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_ciphersuite_name_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-peer-certificate")] + pub fn connect_tls_peer_certificate_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_peer_certificate_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-peer-certificate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_peer_certificate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-peer-certificate-errors")] + pub fn connect_tls_peer_certificate_errors_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_peer_certificate_errors_trampoline< + F: Fn(&Message) + 'static, + >( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-peer-certificate-errors\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_peer_certificate_errors_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-protocol-version")] + pub fn connect_tls_protocol_version_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_protocol_version_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-protocol-version\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_protocol_version_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "uri")] + pub fn connect_uri_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_uri_trampoline( + this: *mut ffi::SoupMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::uri\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_uri_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl fmt::Display for Message { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("Message") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/message_body.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/message_body.rs new file mode 100644 index 00000000..f0e0eafa --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/message_body.rs @@ -0,0 +1,103 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct MessageBody(Shared); + + match fn { + ref => |ptr| ffi::soup_message_body_ref(ptr), + unref => |ptr| ffi::soup_message_body_unref(ptr), + type_ => || ffi::soup_message_body_get_type(), + } +} + +impl MessageBody { + #[doc(alias = "soup_message_body_new")] + pub fn new() -> MessageBody { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_message_body_new()) } + } + + #[doc(alias = "soup_message_body_append_bytes")] + pub fn append_bytes(&self, buffer: &glib::Bytes) { + unsafe { + ffi::soup_message_body_append_bytes(self.to_glib_none().0, buffer.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_body_append_take")] + pub fn append_take(&self, data: &[u8]) { + let length = data.len() as _; + unsafe { + ffi::soup_message_body_append_take(self.to_glib_none().0, data.to_glib_full(), length); + } + } + + #[doc(alias = "soup_message_body_complete")] + pub fn complete(&self) { + unsafe { + ffi::soup_message_body_complete(self.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_body_flatten")] + pub fn flatten(&self) -> Option { + unsafe { from_glib_full(ffi::soup_message_body_flatten(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_body_get_accumulate")] + #[doc(alias = "get_accumulate")] + pub fn is_accumulate(&self) -> bool { + unsafe { from_glib(ffi::soup_message_body_get_accumulate(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_message_body_get_chunk")] + #[doc(alias = "get_chunk")] + pub fn chunk(&self, offset: i64) -> Option { + unsafe { + from_glib_full(ffi::soup_message_body_get_chunk( + self.to_glib_none().0, + offset, + )) + } + } + + #[doc(alias = "soup_message_body_got_chunk")] + pub fn got_chunk(&self, chunk: &glib::Bytes) { + unsafe { + ffi::soup_message_body_got_chunk(self.to_glib_none().0, chunk.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_body_set_accumulate")] + pub fn set_accumulate(&self, accumulate: bool) { + unsafe { + ffi::soup_message_body_set_accumulate(self.to_glib_none().0, accumulate.into_glib()); + } + } + + #[doc(alias = "soup_message_body_truncate")] + pub fn truncate(&self) { + unsafe { + ffi::soup_message_body_truncate(self.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_body_wrote_chunk")] + pub fn wrote_chunk(&self, chunk: &glib::Bytes) { + unsafe { + ffi::soup_message_body_wrote_chunk(self.to_glib_none().0, chunk.to_glib_none().0); + } + } +} + +impl Default for MessageBody { + fn default() -> Self { + Self::new() + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/message_headers.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/message_headers.rs new file mode 100644 index 00000000..ae85e7d0 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/message_headers.rs @@ -0,0 +1,258 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{Encoding, Expectation, MessageHeadersType}; +use glib::translate::*; +use std::mem; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct MessageHeaders(Shared); + + match fn { + ref => |ptr| ffi::soup_message_headers_ref(ptr), + unref => |ptr| ffi::soup_message_headers_unref(ptr), + type_ => || ffi::soup_message_headers_get_type(), + } +} + +impl MessageHeaders { + #[doc(alias = "soup_message_headers_new")] + pub fn new(type_: MessageHeadersType) -> MessageHeaders { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_message_headers_new(type_.into_glib())) } + } + + #[doc(alias = "soup_message_headers_append")] + pub fn append(&self, name: &str, value: &str) { + unsafe { + ffi::soup_message_headers_append( + self.to_glib_none().0, + name.to_glib_none().0, + value.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_message_headers_clean_connection_headers")] + pub fn clean_connection_headers(&self) { + unsafe { + ffi::soup_message_headers_clean_connection_headers(self.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_headers_clear")] + pub fn clear(&self) { + unsafe { + ffi::soup_message_headers_clear(self.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_headers_foreach")] + pub fn foreach(&self, func: P) { + let func_data: P = func; + unsafe extern "C" fn func_func( + name: *const libc::c_char, + value: *const libc::c_char, + user_data: glib::ffi::gpointer, + ) { + let name: Borrowed = from_glib_borrow(name); + let value: Borrowed = from_glib_borrow(value); + let callback: *mut P = user_data as *const _ as usize as *mut P; + (*callback)(name.as_str(), value.as_str()) + } + let func = Some(func_func::

as _); + let super_callback0: &P = &func_data; + unsafe { + ffi::soup_message_headers_foreach( + self.to_glib_none().0, + func, + super_callback0 as *const _ as usize as *mut _, + ); + } + } + + //#[doc(alias = "soup_message_headers_free_ranges")] + //pub fn free_ranges(&self, ranges: /*Ignored*/&mut Range) { + // unsafe { TODO: call ffi:soup_message_headers_free_ranges() } + //} + + #[doc(alias = "soup_message_headers_get_content_length")] + #[doc(alias = "get_content_length")] + pub fn content_length(&self) -> i64 { + unsafe { ffi::soup_message_headers_get_content_length(self.to_glib_none().0) } + } + + #[doc(alias = "soup_message_headers_get_content_range")] + #[doc(alias = "get_content_range")] + pub fn content_range(&self) -> Option<(i64, i64, i64)> { + unsafe { + let mut start = mem::MaybeUninit::uninit(); + let mut end = mem::MaybeUninit::uninit(); + let mut total_length = mem::MaybeUninit::uninit(); + let ret = from_glib(ffi::soup_message_headers_get_content_range( + self.to_glib_none().0, + start.as_mut_ptr(), + end.as_mut_ptr(), + total_length.as_mut_ptr(), + )); + if ret { + Some(( + start.assume_init(), + end.assume_init(), + total_length.assume_init(), + )) + } else { + None + } + } + } + + #[doc(alias = "soup_message_headers_get_encoding")] + #[doc(alias = "get_encoding")] + pub fn encoding(&self) -> Encoding { + unsafe { + from_glib(ffi::soup_message_headers_get_encoding( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_headers_get_expectations")] + #[doc(alias = "get_expectations")] + pub fn expectations(&self) -> Expectation { + unsafe { + from_glib(ffi::soup_message_headers_get_expectations( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_headers_get_headers_type")] + #[doc(alias = "get_headers_type")] + pub fn headers_type(&self) -> MessageHeadersType { + unsafe { + from_glib(ffi::soup_message_headers_get_headers_type( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_headers_get_list")] + #[doc(alias = "get_list")] + pub fn list(&self, name: &str) -> Option { + unsafe { + from_glib_none(ffi::soup_message_headers_get_list( + self.to_glib_none().0, + name.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_headers_get_one")] + #[doc(alias = "get_one")] + pub fn one(&self, name: &str) -> Option { + unsafe { + from_glib_none(ffi::soup_message_headers_get_one( + self.to_glib_none().0, + name.to_glib_none().0, + )) + } + } + + //#[doc(alias = "soup_message_headers_get_ranges")] + //#[doc(alias = "get_ranges")] + //pub fn ranges(&self, total_length: i64, ranges: /*Ignored*/Vec) -> Option { + // unsafe { TODO: call ffi:soup_message_headers_get_ranges() } + //} + + #[doc(alias = "soup_message_headers_header_contains")] + pub fn header_contains(&self, name: &str, token: &str) -> bool { + unsafe { + from_glib(ffi::soup_message_headers_header_contains( + self.to_glib_none().0, + name.to_glib_none().0, + token.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_headers_header_equals")] + pub fn header_equals(&self, name: &str, value: &str) -> bool { + unsafe { + from_glib(ffi::soup_message_headers_header_equals( + self.to_glib_none().0, + name.to_glib_none().0, + value.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_message_headers_remove")] + pub fn remove(&self, name: &str) { + unsafe { + ffi::soup_message_headers_remove(self.to_glib_none().0, name.to_glib_none().0); + } + } + + #[doc(alias = "soup_message_headers_replace")] + pub fn replace(&self, name: &str, value: &str) { + unsafe { + ffi::soup_message_headers_replace( + self.to_glib_none().0, + name.to_glib_none().0, + value.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_message_headers_set_content_length")] + pub fn set_content_length(&self, content_length: i64) { + unsafe { + ffi::soup_message_headers_set_content_length(self.to_glib_none().0, content_length); + } + } + + #[doc(alias = "soup_message_headers_set_content_range")] + pub fn set_content_range(&self, start: i64, end: i64, total_length: i64) { + unsafe { + ffi::soup_message_headers_set_content_range( + self.to_glib_none().0, + start, + end, + total_length, + ); + } + } + + #[doc(alias = "soup_message_headers_set_encoding")] + pub fn set_encoding(&self, encoding: Encoding) { + unsafe { + ffi::soup_message_headers_set_encoding(self.to_glib_none().0, encoding.into_glib()); + } + } + + #[doc(alias = "soup_message_headers_set_expectations")] + pub fn set_expectations(&self, expectations: Expectation) { + unsafe { + ffi::soup_message_headers_set_expectations( + self.to_glib_none().0, + expectations.into_glib(), + ); + } + } + + #[doc(alias = "soup_message_headers_set_range")] + pub fn set_range(&self, start: i64, end: i64) { + unsafe { + ffi::soup_message_headers_set_range(self.to_glib_none().0, start, end); + } + } + + //#[doc(alias = "soup_message_headers_set_ranges")] + //pub fn set_ranges(&self, ranges: /*Ignored*/&mut Range, length: i32) { + // unsafe { TODO: call ffi:soup_message_headers_set_ranges() } + //} +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/message_metrics.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/message_metrics.rs new file mode 100644 index 00000000..254a6449 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/message_metrics.rs @@ -0,0 +1,115 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct MessageMetrics(Boxed); + + match fn { + copy => |ptr| ffi::soup_message_metrics_copy(mut_override(ptr)), + free => |ptr| ffi::soup_message_metrics_free(ptr), + type_ => || ffi::soup_message_metrics_get_type(), + } +} + +impl MessageMetrics { + #[doc(alias = "soup_message_metrics_get_connect_end")] + #[doc(alias = "get_connect_end")] + pub fn connect_end(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_connect_end(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_connect_start")] + #[doc(alias = "get_connect_start")] + pub fn connect_start(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_connect_start(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_dns_end")] + #[doc(alias = "get_dns_end")] + pub fn dns_end(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_dns_end(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_dns_start")] + #[doc(alias = "get_dns_start")] + pub fn dns_start(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_dns_start(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_fetch_start")] + #[doc(alias = "get_fetch_start")] + pub fn fetch_start(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_fetch_start(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_request_body_bytes_sent")] + #[doc(alias = "get_request_body_bytes_sent")] + pub fn request_body_bytes_sent(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_request_body_bytes_sent(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_request_body_size")] + #[doc(alias = "get_request_body_size")] + pub fn request_body_size(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_request_body_size(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_request_header_bytes_sent")] + #[doc(alias = "get_request_header_bytes_sent")] + pub fn request_header_bytes_sent(&mut self) -> u64 { + unsafe { + ffi::soup_message_metrics_get_request_header_bytes_sent(self.to_glib_none_mut().0) + } + } + + #[doc(alias = "soup_message_metrics_get_request_start")] + #[doc(alias = "get_request_start")] + pub fn request_start(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_request_start(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_response_body_bytes_received")] + #[doc(alias = "get_response_body_bytes_received")] + pub fn response_body_bytes_received(&mut self) -> u64 { + unsafe { + ffi::soup_message_metrics_get_response_body_bytes_received(self.to_glib_none_mut().0) + } + } + + #[doc(alias = "soup_message_metrics_get_response_body_size")] + #[doc(alias = "get_response_body_size")] + pub fn response_body_size(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_response_body_size(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_response_end")] + #[doc(alias = "get_response_end")] + pub fn response_end(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_response_end(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_response_header_bytes_received")] + #[doc(alias = "get_response_header_bytes_received")] + pub fn response_header_bytes_received(&mut self) -> u64 { + unsafe { + ffi::soup_message_metrics_get_response_header_bytes_received(self.to_glib_none_mut().0) + } + } + + #[doc(alias = "soup_message_metrics_get_response_start")] + #[doc(alias = "get_response_start")] + pub fn response_start(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_response_start(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_message_metrics_get_tls_start")] + #[doc(alias = "get_tls_start")] + pub fn tls_start(&mut self) -> u64 { + unsafe { ffi::soup_message_metrics_get_tls_start(self.to_glib_none_mut().0) } + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/mod.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/mod.rs new file mode 100644 index 00000000..e901a307 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/mod.rs @@ -0,0 +1,156 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +mod auth; +pub use self::auth::Auth; + +mod auth_basic; +pub use self::auth_basic::AuthBasic; + +mod auth_digest; +pub use self::auth_digest::AuthDigest; + +mod auth_domain; +pub use self::auth_domain::AuthDomain; + +mod auth_domain_basic; +pub use self::auth_domain_basic::AuthDomainBasic; + +mod auth_domain_digest; +pub use self::auth_domain_digest::AuthDomainDigest; + +mod auth_manager; +pub use self::auth_manager::AuthManager; + +mod auth_ntlm; +pub use self::auth_ntlm::AuthNTLM; + +mod auth_negotiate; +pub use self::auth_negotiate::AuthNegotiate; + +mod cache; +pub use self::cache::Cache; + +mod content_decoder; +pub use self::content_decoder::ContentDecoder; + +mod content_sniffer; +pub use self::content_sniffer::ContentSniffer; + +mod cookie_jar; +pub use self::cookie_jar::CookieJar; + +mod cookie_jar_db; +pub use self::cookie_jar_db::CookieJarDB; + +mod cookie_jar_text; +pub use self::cookie_jar_text::CookieJarText; + +mod hsts_enforcer; +pub use self::hsts_enforcer::HSTSEnforcer; + +mod hsts_enforcer_db; +pub use self::hsts_enforcer_db::HSTSEnforcerDB; + +mod logger; +pub use self::logger::Logger; + +mod message; +pub use self::message::Message; + +mod multipart_input_stream; +pub use self::multipart_input_stream::MultipartInputStream; + +mod server; +pub use self::server::Server; + +mod server_message; +pub use self::server_message::ServerMessage; + +mod session; +pub use self::session::Session; + +mod session_feature; +pub use self::session_feature::SessionFeature; + +mod websocket_connection; +pub use self::websocket_connection::WebsocketConnection; + +mod websocket_extension; +pub use self::websocket_extension::WebsocketExtension; + +mod websocket_extension_deflate; +pub use self::websocket_extension_deflate::WebsocketExtensionDeflate; + +mod websocket_extension_manager; +pub use self::websocket_extension_manager::WebsocketExtensionManager; + +mod cookie; +pub use self::cookie::Cookie; + +mod hsts_policy; +pub use self::hsts_policy::HSTSPolicy; + +mod message_body; +pub use self::message_body::MessageBody; + +mod message_headers; +pub use self::message_headers::MessageHeaders; + +mod message_metrics; +pub use self::message_metrics::MessageMetrics; + +mod multipart; +pub use self::multipart::Multipart; + +mod enums; +pub use self::enums::CacheType; +pub use self::enums::CookieJarAcceptPolicy; +pub use self::enums::DateFormat; +pub use self::enums::Encoding; +pub use self::enums::HTTPVersion; +pub use self::enums::LoggerLogLevel; +pub use self::enums::MemoryUse; +pub use self::enums::MessageHeadersType; +pub use self::enums::MessagePriority; +pub use self::enums::SameSitePolicy; +pub use self::enums::SessionError; +pub use self::enums::Status; +pub use self::enums::TLDError; +pub use self::enums::URIComponent; +pub use self::enums::WebsocketCloseCode; +pub use self::enums::WebsocketConnectionType; +pub use self::enums::WebsocketDataType; +pub use self::enums::WebsocketError; +pub use self::enums::WebsocketState; + +mod flags; +pub use self::flags::Cacheability; +pub use self::flags::Expectation; +pub use self::flags::MessageFlags; +pub use self::flags::ServerListenOptions; + +pub mod functions; + +mod constants; +pub use self::constants::FORM_MIME_TYPE_MULTIPART; +pub use self::constants::FORM_MIME_TYPE_URLENCODED; + +#[doc(hidden)] +pub mod traits { + pub use super::auth::AuthExt; + pub use super::auth_domain::AuthDomainExt; + pub use super::cache::CacheExt; + pub use super::cookie_jar::CookieJarExt; + pub use super::hsts_enforcer::HSTSEnforcerExt; + pub use super::server::ServerExt; + pub use super::session::SessionExt; + pub use super::session_feature::SessionFeatureExt; + pub use super::websocket_extension::WebsocketExtensionExt; +} +#[doc(hidden)] +pub mod builders { + pub use super::session::SessionBuilder; +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/multipart.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/multipart.rs new file mode 100644 index 00000000..4bef8269 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/multipart.rs @@ -0,0 +1,119 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::MessageHeaders; +use glib::translate::*; +use std::ptr; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct Multipart(Boxed); + + match fn { + copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::soup_multipart_get_type(), ptr as *mut _) as *mut ffi::SoupMultipart, + free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::soup_multipart_get_type(), ptr as *mut _), + type_ => || ffi::soup_multipart_get_type(), + } +} + +impl Multipart { + #[doc(alias = "soup_multipart_new")] + pub fn new(mime_type: &str) -> Multipart { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_multipart_new(mime_type.to_glib_none().0)) } + } + + #[doc(alias = "soup_multipart_new_from_message")] + #[doc(alias = "new_from_message")] + pub fn from_message(headers: &MessageHeaders, body: &glib::Bytes) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_multipart_new_from_message( + headers.to_glib_none().0, + body.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_multipart_append_form_file")] + pub fn append_form_file( + &mut self, + control_name: &str, + filename: Option<&str>, + content_type: Option<&str>, + body: &glib::Bytes, + ) { + unsafe { + ffi::soup_multipart_append_form_file( + self.to_glib_none_mut().0, + control_name.to_glib_none().0, + filename.to_glib_none().0, + content_type.to_glib_none().0, + body.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_multipart_append_form_string")] + pub fn append_form_string(&mut self, control_name: &str, data: &str) { + unsafe { + ffi::soup_multipart_append_form_string( + self.to_glib_none_mut().0, + control_name.to_glib_none().0, + data.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_multipart_append_part")] + pub fn append_part(&mut self, headers: &MessageHeaders, body: &glib::Bytes) { + unsafe { + ffi::soup_multipart_append_part( + self.to_glib_none_mut().0, + headers.to_glib_none().0, + body.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_multipart_get_length")] + #[doc(alias = "get_length")] + pub fn length(&mut self) -> i32 { + unsafe { ffi::soup_multipart_get_length(self.to_glib_none_mut().0) } + } + + #[doc(alias = "soup_multipart_get_part")] + #[doc(alias = "get_part")] + pub fn part(&mut self, part: i32) -> Option<(MessageHeaders, glib::Bytes)> { + unsafe { + let mut headers = ptr::null_mut(); + let mut body = ptr::null_mut(); + let ret = from_glib(ffi::soup_multipart_get_part( + self.to_glib_none_mut().0, + part, + &mut headers, + &mut body, + )); + if ret { + Some((from_glib_none(headers), from_glib_none(body))) + } else { + None + } + } + } + + #[doc(alias = "soup_multipart_to_message")] + pub fn to_message(&mut self, dest_headers: &MessageHeaders) -> glib::Bytes { + unsafe { + let mut dest_body = ptr::null_mut(); + ffi::soup_multipart_to_message( + self.to_glib_none_mut().0, + dest_headers.to_glib_none().0, + &mut dest_body, + ); + from_glib_full(dest_body) + } + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/multipart_input_stream.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/multipart_input_stream.rs new file mode 100644 index 00000000..7184cd9f --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/multipart_input_stream.rs @@ -0,0 +1,70 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{Message, MessageHeaders}; +use glib::{prelude::*, translate::*}; +use std::{fmt, ptr}; + +glib::wrapper! { + #[doc(alias = "SoupMultipartInputStream")] + pub struct MultipartInputStream(Object) @extends gio::FilterInputStream, gio::InputStream, @implements gio::PollableInputStream; + + match fn { + type_ => || ffi::soup_multipart_input_stream_get_type(), + } +} + +impl MultipartInputStream { + #[doc(alias = "soup_multipart_input_stream_new")] + pub fn new(msg: &Message, base_stream: &impl IsA) -> MultipartInputStream { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::soup_multipart_input_stream_new( + msg.to_glib_none().0, + base_stream.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_multipart_input_stream_get_headers")] + #[doc(alias = "get_headers")] + pub fn headers(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_multipart_input_stream_get_headers( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_multipart_input_stream_next_part")] + pub fn next_part( + &self, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_multipart_input_stream_next_part( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } + } + } + + pub fn message(&self) -> Option { + ObjectExt::property(self, "message") + } +} + +impl fmt::Display for MultipartInputStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("MultipartInputStream") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/server.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/server.rs new file mode 100644 index 00000000..81b31e21 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/server.rs @@ -0,0 +1,553 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT +#![allow(deprecated)] + +use crate::{AuthDomain, ServerListenOptions, ServerMessage}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute, ptr}; + +glib::wrapper! { + #[doc(alias = "SoupServer")] + pub struct Server(Object); + + match fn { + type_ => || ffi::soup_server_get_type(), + } +} + +impl Server { + pub const NONE: Option<&'static Server> = None; + + //#[doc(alias = "soup_server_new")] + //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option { + // unsafe { TODO: call ffi:soup_server_new() } + //} +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait ServerExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_server_accept_iostream")] + fn accept_iostream( + &self, + stream: &impl IsA, + local_addr: Option<&impl IsA>, + remote_addr: Option<&impl IsA>, + ) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let is_ok = ffi::soup_server_accept_iostream( + self.as_ref().to_glib_none().0, + stream.as_ref().to_glib_none().0, + local_addr.map(|p| p.as_ref()).to_glib_none().0, + remote_addr.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_server_add_auth_domain")] + fn add_auth_domain(&self, auth_domain: &impl IsA) { + unsafe { + ffi::soup_server_add_auth_domain( + self.as_ref().to_glib_none().0, + auth_domain.as_ref().to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_server_add_websocket_extension")] + fn add_websocket_extension(&self, extension_type: glib::types::Type) { + unsafe { + ffi::soup_server_add_websocket_extension( + self.as_ref().to_glib_none().0, + extension_type.into_glib(), + ); + } + } + + #[doc(alias = "soup_server_disconnect")] + fn disconnect(&self) { + unsafe { + ffi::soup_server_disconnect(self.as_ref().to_glib_none().0); + } + } + + #[doc(alias = "soup_server_get_listeners")] + #[doc(alias = "get_listeners")] + fn listeners(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_container(ffi::soup_server_get_listeners( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_get_tls_auth_mode")] + #[doc(alias = "get_tls_auth_mode")] + fn tls_auth_mode(&self) -> gio::TlsAuthenticationMode { + unsafe { + from_glib(ffi::soup_server_get_tls_auth_mode( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_get_tls_certificate")] + #[doc(alias = "get_tls_certificate")] + fn tls_certificate(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_get_tls_certificate( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_get_tls_database")] + #[doc(alias = "get_tls_database")] + fn tls_database(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_get_tls_database( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_get_uris")] + #[doc(alias = "get_uris")] + fn uris(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::soup_server_get_uris( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_is_https")] + fn is_https(&self) -> bool { + unsafe { from_glib(ffi::soup_server_is_https(self.as_ref().to_glib_none().0)) } + } + + #[doc(alias = "soup_server_listen")] + fn listen( + &self, + address: &impl IsA, + options: ServerListenOptions, + ) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let is_ok = ffi::soup_server_listen( + self.as_ref().to_glib_none().0, + address.as_ref().to_glib_none().0, + options.into_glib(), + &mut error, + ); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_server_listen_all")] + fn listen_all(&self, port: u32, options: ServerListenOptions) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let is_ok = ffi::soup_server_listen_all( + self.as_ref().to_glib_none().0, + port, + options.into_glib(), + &mut error, + ); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_server_listen_local")] + fn listen_local(&self, port: u32, options: ServerListenOptions) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let is_ok = ffi::soup_server_listen_local( + self.as_ref().to_glib_none().0, + port, + options.into_glib(), + &mut error, + ); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_server_listen_socket")] + fn listen_socket( + &self, + socket: &impl IsA, + options: ServerListenOptions, + ) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let is_ok = ffi::soup_server_listen_socket( + self.as_ref().to_glib_none().0, + socket.as_ref().to_glib_none().0, + options.into_glib(), + &mut error, + ); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } + } + } + + #[cfg_attr(feature = "v3_2", deprecated = "Since 3.2")] + #[allow(deprecated)] + #[doc(alias = "soup_server_pause_message")] + fn pause_message(&self, msg: &ServerMessage) { + unsafe { + ffi::soup_server_pause_message(self.as_ref().to_glib_none().0, msg.to_glib_none().0); + } + } + + #[doc(alias = "soup_server_remove_auth_domain")] + fn remove_auth_domain(&self, auth_domain: &impl IsA) { + unsafe { + ffi::soup_server_remove_auth_domain( + self.as_ref().to_glib_none().0, + auth_domain.as_ref().to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_server_remove_handler")] + fn remove_handler(&self, path: &str) { + unsafe { + ffi::soup_server_remove_handler(self.as_ref().to_glib_none().0, path.to_glib_none().0); + } + } + + #[doc(alias = "soup_server_remove_websocket_extension")] + fn remove_websocket_extension(&self, extension_type: glib::types::Type) { + unsafe { + ffi::soup_server_remove_websocket_extension( + self.as_ref().to_glib_none().0, + extension_type.into_glib(), + ); + } + } + + #[doc(alias = "soup_server_set_tls_auth_mode")] + fn set_tls_auth_mode(&self, mode: gio::TlsAuthenticationMode) { + unsafe { + ffi::soup_server_set_tls_auth_mode(self.as_ref().to_glib_none().0, mode.into_glib()); + } + } + + #[doc(alias = "soup_server_set_tls_certificate")] + fn set_tls_certificate(&self, certificate: &impl IsA) { + unsafe { + ffi::soup_server_set_tls_certificate( + self.as_ref().to_glib_none().0, + certificate.as_ref().to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_server_set_tls_database")] + fn set_tls_database(&self, tls_database: &impl IsA) { + unsafe { + ffi::soup_server_set_tls_database( + self.as_ref().to_glib_none().0, + tls_database.as_ref().to_glib_none().0, + ); + } + } + + #[cfg_attr(feature = "v3_2", deprecated = "Since 3.2")] + #[allow(deprecated)] + #[doc(alias = "soup_server_unpause_message")] + fn unpause_message(&self, msg: &ServerMessage) { + unsafe { + ffi::soup_server_unpause_message(self.as_ref().to_glib_none().0, msg.to_glib_none().0); + } + } + + #[doc(alias = "raw-paths")] + fn is_raw_paths(&self) -> bool { + ObjectExt::property(self.as_ref(), "raw-paths") + } + + #[doc(alias = "server-header")] + fn server_header(&self) -> Option { + ObjectExt::property(self.as_ref(), "server-header") + } + + #[doc(alias = "server-header")] + fn set_server_header(&self, server_header: Option<&str>) { + ObjectExt::set_property(self.as_ref(), "server-header", server_header) + } + + #[doc(alias = "request-aborted")] + fn connect_request_aborted( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn request_aborted_trampoline< + P: IsA, + F: Fn(&P, &ServerMessage) + 'static, + >( + this: *mut ffi::SoupServer, + message: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Server::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(message), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-aborted\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_aborted_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-finished")] + fn connect_request_finished( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn request_finished_trampoline< + P: IsA, + F: Fn(&P, &ServerMessage) + 'static, + >( + this: *mut ffi::SoupServer, + message: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Server::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(message), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-finished\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_finished_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-read")] + fn connect_request_read( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn request_read_trampoline< + P: IsA, + F: Fn(&P, &ServerMessage) + 'static, + >( + this: *mut ffi::SoupServer, + message: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Server::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(message), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-read\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_read_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-started")] + fn connect_request_started( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn request_started_trampoline< + P: IsA, + F: Fn(&P, &ServerMessage) + 'static, + >( + this: *mut ffi::SoupServer, + message: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Server::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(message), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-started\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_started_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "server-header")] + fn connect_server_header_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_server_header_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupServer, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Server::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::server-header\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_server_header_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-auth-mode")] + fn connect_tls_auth_mode_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_auth_mode_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupServer, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Server::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-auth-mode\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_auth_mode_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-certificate")] + fn connect_tls_certificate_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_certificate_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupServer, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Server::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-certificate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_certificate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-database")] + fn connect_tls_database_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_database_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupServer, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Server::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-database\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_database_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl> ServerExt for O {} + +impl fmt::Display for Server { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("Server") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/server_message.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/server_message.rs new file mode 100644 index 00000000..536fb9fb --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/server_message.rs @@ -0,0 +1,586 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{HTTPVersion, MemoryUse, MessageBody, MessageHeaders}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupServerMessage")] + pub struct ServerMessage(Object); + + match fn { + type_ => || ffi::soup_server_message_get_type(), + } +} + +impl ServerMessage { + #[doc(alias = "soup_server_message_get_http_version")] + #[doc(alias = "get_http_version")] + pub fn http_version(&self) -> HTTPVersion { + unsafe { + from_glib(ffi::soup_server_message_get_http_version( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_local_address")] + #[doc(alias = "get_local_address")] + pub fn local_address(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_local_address( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_method")] + #[doc(alias = "get_method")] + pub fn method(&self) -> Option { + unsafe { from_glib_none(ffi::soup_server_message_get_method(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_server_message_get_reason_phrase")] + #[doc(alias = "get_reason_phrase")] + pub fn reason_phrase(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_reason_phrase( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_remote_address")] + #[doc(alias = "get_remote_address")] + pub fn remote_address(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_remote_address( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_remote_host")] + #[doc(alias = "get_remote_host")] + pub fn remote_host(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_remote_host( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_request_body")] + #[doc(alias = "get_request_body")] + pub fn request_body(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_request_body( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_request_headers")] + #[doc(alias = "get_request_headers")] + pub fn request_headers(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_request_headers( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_response_body")] + #[doc(alias = "get_response_body")] + pub fn response_body(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_response_body( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_response_headers")] + #[doc(alias = "get_response_headers")] + pub fn response_headers(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_response_headers( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_socket")] + #[doc(alias = "get_socket")] + pub fn socket(&self) -> Option { + unsafe { from_glib_none(ffi::soup_server_message_get_socket(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_server_message_get_status")] + #[doc(alias = "get_status")] + pub fn status(&self) -> u32 { + unsafe { ffi::soup_server_message_get_status(self.to_glib_none().0) } + } + + #[cfg(feature = "v3_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] + #[doc(alias = "soup_server_message_get_tls_peer_certificate")] + #[doc(alias = "get_tls_peer_certificate")] + pub fn tls_peer_certificate(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_server_message_get_tls_peer_certificate( + self.to_glib_none().0, + )) + } + } + + #[cfg(feature = "v3_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] + #[doc(alias = "soup_server_message_get_tls_peer_certificate_errors")] + #[doc(alias = "get_tls_peer_certificate_errors")] + pub fn tls_peer_certificate_errors(&self) -> gio::TlsCertificateFlags { + unsafe { + from_glib(ffi::soup_server_message_get_tls_peer_certificate_errors( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_server_message_get_uri")] + #[doc(alias = "get_uri")] + pub fn uri(&self) -> Option { + unsafe { from_glib_none(ffi::soup_server_message_get_uri(self.to_glib_none().0)) } + } + + #[doc(alias = "soup_server_message_is_options_ping")] + pub fn is_options_ping(&self) -> bool { + unsafe { + from_glib(ffi::soup_server_message_is_options_ping( + self.to_glib_none().0, + )) + } + } + + #[cfg(feature = "v3_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] + #[doc(alias = "soup_server_message_pause")] + pub fn pause(&self) { + unsafe { + ffi::soup_server_message_pause(self.to_glib_none().0); + } + } + + #[doc(alias = "soup_server_message_set_http_version")] + pub fn set_http_version(&self, version: HTTPVersion) { + unsafe { + ffi::soup_server_message_set_http_version(self.to_glib_none().0, version.into_glib()); + } + } + + #[doc(alias = "soup_server_message_set_redirect")] + pub fn set_redirect(&self, status_code: u32, redirect_uri: &str) { + unsafe { + ffi::soup_server_message_set_redirect( + self.to_glib_none().0, + status_code, + redirect_uri.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_server_message_set_response")] + pub fn set_response(&self, content_type: Option<&str>, resp_use: MemoryUse, resp_body: &[u8]) { + let resp_length = resp_body.len() as _; + unsafe { + ffi::soup_server_message_set_response( + self.to_glib_none().0, + content_type.to_glib_none().0, + resp_use.into_glib(), + resp_body.to_glib_none().0, + resp_length, + ); + } + } + + #[doc(alias = "soup_server_message_set_status")] + pub fn set_status(&self, status_code: u32, reason_phrase: Option<&str>) { + unsafe { + ffi::soup_server_message_set_status( + self.to_glib_none().0, + status_code, + reason_phrase.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_server_message_steal_connection")] + pub fn steal_connection(&self) -> Option { + unsafe { + from_glib_full(ffi::soup_server_message_steal_connection( + self.to_glib_none().0, + )) + } + } + + #[cfg(feature = "v3_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] + #[doc(alias = "soup_server_message_unpause")] + pub fn unpause(&self) { + unsafe { + ffi::soup_server_message_unpause(self.to_glib_none().0); + } + } + + #[doc(alias = "accept-certificate")] + pub fn connect_accept_certificate< + F: Fn(&Self, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, + >( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn accept_certificate_trampoline< + F: Fn(&ServerMessage, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, + >( + this: *mut ffi::SoupServerMessage, + tls_peer_certificate: *mut gio::ffi::GTlsCertificate, + tls_peer_errors: gio::ffi::GTlsCertificateFlags, + f: glib::ffi::gpointer, + ) -> glib::ffi::gboolean { + let f: &F = &*(f as *const F); + f( + &from_glib_borrow(this), + &from_glib_borrow(tls_peer_certificate), + from_glib(tls_peer_errors), + ) + .into_glib() + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"accept-certificate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + accept_certificate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "connected")] + pub fn connect_connected(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn connected_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"connected\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + connected_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "disconnected")] + pub fn connect_disconnected(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn disconnected_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"disconnected\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + disconnected_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "finished")] + pub fn connect_finished(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn finished_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"finished\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + finished_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "got-body")] + pub fn connect_got_body(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_body_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-body\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_body_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "got-chunk")] + pub fn connect_got_chunk(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_chunk_trampoline( + this: *mut ffi::SoupServerMessage, + chunk: *mut glib::ffi::GBytes, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), &from_glib_borrow(chunk)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-chunk\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_chunk_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "got-headers")] + pub fn connect_got_headers(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn got_headers_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"got-headers\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + got_headers_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-body")] + pub fn connect_wrote_body(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_body_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-body\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_body_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-body-data")] + pub fn connect_wrote_body_data(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_body_data_trampoline( + this: *mut ffi::SoupServerMessage, + chunk_size: libc::c_uint, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), chunk_size) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-body-data\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_body_data_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-chunk")] + pub fn connect_wrote_chunk(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_chunk_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-chunk\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_chunk_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-headers")] + pub fn connect_wrote_headers(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_headers_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-headers\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_headers_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "wrote-informational")] + pub fn connect_wrote_informational(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn wrote_informational_trampoline( + this: *mut ffi::SoupServerMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"wrote-informational\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + wrote_informational_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[cfg(feature = "v3_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] + #[doc(alias = "tls-peer-certificate")] + pub fn connect_tls_peer_certificate_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_peer_certificate_trampoline< + F: Fn(&ServerMessage) + 'static, + >( + this: *mut ffi::SoupServerMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-peer-certificate\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_peer_certificate_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[cfg(feature = "v3_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] + #[doc(alias = "tls-peer-certificate-errors")] + pub fn connect_tls_peer_certificate_errors_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_peer_certificate_errors_trampoline< + F: Fn(&ServerMessage) + 'static, + >( + this: *mut ffi::SoupServerMessage, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-peer-certificate-errors\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_peer_certificate_errors_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl fmt::Display for ServerMessage { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("ServerMessage") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/session.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/session.rs new file mode 100644 index 00000000..0de60fb6 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/session.rs @@ -0,0 +1,1065 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{Message, SessionFeature, WebsocketConnection}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute, pin::Pin, ptr}; + +glib::wrapper! { + #[doc(alias = "SoupSession")] + pub struct Session(Object); + + match fn { + type_ => || ffi::soup_session_get_type(), + } +} + +impl Session { + pub const NONE: Option<&'static Session> = None; + + #[doc(alias = "soup_session_new")] + pub fn new() -> Session { + assert_initialized_main_thread!(); + unsafe { from_glib_full(ffi::soup_session_new()) } + } + + //#[doc(alias = "soup_session_new_with_options")] + //#[doc(alias = "new_with_options")] + //pub fn with_options(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Session { + // unsafe { TODO: call ffi:soup_session_new_with_options() } + //} + + // rustdoc-stripper-ignore-next + /// Creates a new builder-pattern struct instance to construct [`Session`] objects. + /// + /// This method returns an instance of [`SessionBuilder`](crate::builders::SessionBuilder) which can be used to create [`Session`] objects. + pub fn builder() -> SessionBuilder { + SessionBuilder::new() + } +} + +impl Default for Session { + fn default() -> Self { + Self::new() + } +} + +// rustdoc-stripper-ignore-next +/// A [builder-pattern] type to construct [`Session`] objects. +/// +/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] +pub struct SessionBuilder { + builder: glib::object::ObjectBuilder<'static, Session>, +} + +impl SessionBuilder { + fn new() -> Self { + Self { + builder: glib::object::Object::builder(), + } + } + + pub fn accept_language(self, accept_language: impl Into) -> Self { + Self { + builder: self + .builder + .property("accept-language", accept_language.into()), + } + } + + pub fn accept_language_auto(self, accept_language_auto: bool) -> Self { + Self { + builder: self + .builder + .property("accept-language-auto", accept_language_auto), + } + } + + pub fn idle_timeout(self, idle_timeout: u32) -> Self { + Self { + builder: self.builder.property("idle-timeout", idle_timeout), + } + } + + pub fn local_address(self, local_address: &impl IsA) -> Self { + Self { + builder: self + .builder + .property("local-address", local_address.clone().upcast()), + } + } + + pub fn max_conns(self, max_conns: i32) -> Self { + Self { + builder: self.builder.property("max-conns", max_conns), + } + } + + pub fn max_conns_per_host(self, max_conns_per_host: i32) -> Self { + Self { + builder: self + .builder + .property("max-conns-per-host", max_conns_per_host), + } + } + + pub fn proxy_resolver(self, proxy_resolver: &impl IsA) -> Self { + Self { + builder: self + .builder + .property("proxy-resolver", proxy_resolver.clone().upcast()), + } + } + + pub fn remote_connectable(self, remote_connectable: &impl IsA) -> Self { + Self { + builder: self + .builder + .property("remote-connectable", remote_connectable.clone().upcast()), + } + } + + pub fn timeout(self, timeout: u32) -> Self { + Self { + builder: self.builder.property("timeout", timeout), + } + } + + pub fn tls_database(self, tls_database: &impl IsA) -> Self { + Self { + builder: self + .builder + .property("tls-database", tls_database.clone().upcast()), + } + } + + pub fn tls_interaction(self, tls_interaction: &impl IsA) -> Self { + Self { + builder: self + .builder + .property("tls-interaction", tls_interaction.clone().upcast()), + } + } + + pub fn user_agent(self, user_agent: impl Into) -> Self { + Self { + builder: self.builder.property("user-agent", user_agent.into()), + } + } + + // rustdoc-stripper-ignore-next + /// Build the [`Session`]. + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] + pub fn build(self) -> Session { + self.builder.build() + } +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait SessionExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_session_abort")] + fn abort(&self) { + unsafe { + ffi::soup_session_abort(self.as_ref().to_glib_none().0); + } + } + + #[doc(alias = "soup_session_add_feature")] + fn add_feature(&self, feature: &impl IsA) { + unsafe { + ffi::soup_session_add_feature( + self.as_ref().to_glib_none().0, + feature.as_ref().to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_session_add_feature_by_type")] + fn add_feature_by_type(&self, feature_type: glib::types::Type) { + unsafe { + ffi::soup_session_add_feature_by_type( + self.as_ref().to_glib_none().0, + feature_type.into_glib(), + ); + } + } + + #[doc(alias = "soup_session_get_accept_language")] + #[doc(alias = "get_accept_language")] + fn accept_language(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_accept_language( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_accept_language_auto")] + #[doc(alias = "get_accept_language_auto")] + fn accepts_language_auto(&self) -> bool { + unsafe { + from_glib(ffi::soup_session_get_accept_language_auto( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_async_result_message")] + #[doc(alias = "get_async_result_message")] + fn async_result_message(&self, result: &impl IsA) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_async_result_message( + self.as_ref().to_glib_none().0, + result.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_feature")] + #[doc(alias = "get_feature")] + fn feature(&self, feature_type: glib::types::Type) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_feature( + self.as_ref().to_glib_none().0, + feature_type.into_glib(), + )) + } + } + + #[doc(alias = "soup_session_get_feature_for_message")] + #[doc(alias = "get_feature_for_message")] + fn feature_for_message( + &self, + feature_type: glib::types::Type, + msg: &Message, + ) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_feature_for_message( + self.as_ref().to_glib_none().0, + feature_type.into_glib(), + msg.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_idle_timeout")] + #[doc(alias = "get_idle_timeout")] + fn idle_timeout(&self) -> u32 { + unsafe { ffi::soup_session_get_idle_timeout(self.as_ref().to_glib_none().0) } + } + + #[doc(alias = "soup_session_get_local_address")] + #[doc(alias = "get_local_address")] + fn local_address(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_local_address( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_max_conns")] + #[doc(alias = "get_max_conns")] + fn max_conns(&self) -> u32 { + unsafe { ffi::soup_session_get_max_conns(self.as_ref().to_glib_none().0) } + } + + #[doc(alias = "soup_session_get_max_conns_per_host")] + #[doc(alias = "get_max_conns_per_host")] + fn max_conns_per_host(&self) -> u32 { + unsafe { ffi::soup_session_get_max_conns_per_host(self.as_ref().to_glib_none().0) } + } + + #[doc(alias = "soup_session_get_proxy_resolver")] + #[doc(alias = "get_proxy_resolver")] + fn proxy_resolver(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_proxy_resolver( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_remote_connectable")] + #[doc(alias = "get_remote_connectable")] + fn remote_connectable(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_remote_connectable( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_timeout")] + #[doc(alias = "get_timeout")] + fn timeout(&self) -> u32 { + unsafe { ffi::soup_session_get_timeout(self.as_ref().to_glib_none().0) } + } + + #[doc(alias = "soup_session_get_tls_database")] + #[doc(alias = "get_tls_database")] + fn tls_database(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_tls_database( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_tls_interaction")] + #[doc(alias = "get_tls_interaction")] + fn tls_interaction(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_tls_interaction( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_get_user_agent")] + #[doc(alias = "get_user_agent")] + fn user_agent(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_session_get_user_agent( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_session_has_feature")] + fn has_feature(&self, feature_type: glib::types::Type) -> bool { + unsafe { + from_glib(ffi::soup_session_has_feature( + self.as_ref().to_glib_none().0, + feature_type.into_glib(), + )) + } + } + + #[doc(alias = "soup_session_preconnect_async")] + fn preconnect_async) + 'static>( + &self, + msg: &Message, + io_priority: glib::Priority, + cancellable: Option<&impl IsA>, + callback: P, + ) { + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = + Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn preconnect_async_trampoline< + P: FnOnce(Result<(), glib::Error>) + 'static, + >( + _source_object: *mut glib::gobject_ffi::GObject, + res: *mut gio::ffi::GAsyncResult, + user_data: glib::ffi::gpointer, + ) { + let mut error = ptr::null_mut(); + let _ = ffi::soup_session_preconnect_finish(_source_object as *mut _, res, &mut error); + let result = if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + }; + let callback: Box_> = + Box_::from_raw(user_data as *mut _); + let callback: P = callback.into_inner(); + callback(result); + } + let callback = preconnect_async_trampoline::

; + unsafe { + ffi::soup_session_preconnect_async( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + io_priority.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box_::into_raw(user_data) as *mut _, + ); + } + } + + fn preconnect_future( + &self, + msg: &Message, + io_priority: glib::Priority, + ) -> Pin> + 'static>> { + let msg = msg.clone(); + Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { + obj.preconnect_async(&msg, io_priority, Some(cancellable), move |res| { + send.resolve(res); + }); + })) + } + + #[doc(alias = "soup_session_remove_feature")] + fn remove_feature(&self, feature: &impl IsA) { + unsafe { + ffi::soup_session_remove_feature( + self.as_ref().to_glib_none().0, + feature.as_ref().to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_session_remove_feature_by_type")] + fn remove_feature_by_type(&self, feature_type: glib::types::Type) { + unsafe { + ffi::soup_session_remove_feature_by_type( + self.as_ref().to_glib_none().0, + feature_type.into_glib(), + ); + } + } + + #[doc(alias = "soup_session_send")] + fn send( + &self, + msg: &Message, + cancellable: Option<&impl IsA>, + ) -> Result { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_session_send( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_session_send_and_read")] + fn send_and_read( + &self, + msg: &Message, + cancellable: Option<&impl IsA>, + ) -> Result { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_session_send_and_read( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_session_send_and_read_async")] + fn send_and_read_async) + 'static>( + &self, + msg: &Message, + io_priority: glib::Priority, + cancellable: Option<&impl IsA>, + callback: P, + ) { + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = + Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn send_and_read_async_trampoline< + P: FnOnce(Result) + 'static, + >( + _source_object: *mut glib::gobject_ffi::GObject, + res: *mut gio::ffi::GAsyncResult, + user_data: glib::ffi::gpointer, + ) { + let mut error = ptr::null_mut(); + let ret = + ffi::soup_session_send_and_read_finish(_source_object as *mut _, res, &mut error); + let result = if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + }; + let callback: Box_> = + Box_::from_raw(user_data as *mut _); + let callback: P = callback.into_inner(); + callback(result); + } + let callback = send_and_read_async_trampoline::

; + unsafe { + ffi::soup_session_send_and_read_async( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + io_priority.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box_::into_raw(user_data) as *mut _, + ); + } + } + + fn send_and_read_future( + &self, + msg: &Message, + io_priority: glib::Priority, + ) -> Pin> + 'static>> + { + let msg = msg.clone(); + Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { + obj.send_and_read_async(&msg, io_priority, Some(cancellable), move |res| { + send.resolve(res); + }); + })) + } + + #[cfg(feature = "v3_4")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] + #[doc(alias = "soup_session_send_and_splice")] + fn send_and_splice( + &self, + msg: &Message, + out_stream: &impl IsA, + flags: gio::OutputStreamSpliceFlags, + cancellable: Option<&impl IsA>, + ) -> Result { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_session_send_and_splice( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + out_stream.as_ref().to_glib_none().0, + flags.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(ret) + } else { + Err(from_glib_full(error)) + } + } + } + + #[cfg(feature = "v3_4")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] + #[doc(alias = "soup_session_send_and_splice_async")] + fn send_and_splice_async) + 'static>( + &self, + msg: &Message, + out_stream: &impl IsA, + flags: gio::OutputStreamSpliceFlags, + io_priority: glib::Priority, + cancellable: Option<&impl IsA>, + callback: P, + ) { + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = + Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn send_and_splice_async_trampoline< + P: FnOnce(Result) + 'static, + >( + _source_object: *mut glib::gobject_ffi::GObject, + res: *mut gio::ffi::GAsyncResult, + user_data: glib::ffi::gpointer, + ) { + let mut error = ptr::null_mut(); + let ret = + ffi::soup_session_send_and_splice_finish(_source_object as *mut _, res, &mut error); + let result = if error.is_null() { + Ok(ret) + } else { + Err(from_glib_full(error)) + }; + let callback: Box_> = + Box_::from_raw(user_data as *mut _); + let callback: P = callback.into_inner(); + callback(result); + } + let callback = send_and_splice_async_trampoline::

; + unsafe { + ffi::soup_session_send_and_splice_async( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + out_stream.as_ref().to_glib_none().0, + flags.into_glib(), + io_priority.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box_::into_raw(user_data) as *mut _, + ); + } + } + + #[cfg(feature = "v3_4")] + #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] + fn send_and_splice_future( + &self, + msg: &Message, + out_stream: &(impl IsA + Clone + 'static), + flags: gio::OutputStreamSpliceFlags, + io_priority: glib::Priority, + ) -> Pin> + 'static>> { + let msg = msg.clone(); + let out_stream = out_stream.clone(); + Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { + obj.send_and_splice_async( + &msg, + &out_stream, + flags, + io_priority, + Some(cancellable), + move |res| { + send.resolve(res); + }, + ); + })) + } + + #[doc(alias = "soup_session_send_async")] + fn send_async) + 'static>( + &self, + msg: &Message, + io_priority: glib::Priority, + cancellable: Option<&impl IsA>, + callback: P, + ) { + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = + Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn send_async_trampoline< + P: FnOnce(Result) + 'static, + >( + _source_object: *mut glib::gobject_ffi::GObject, + res: *mut gio::ffi::GAsyncResult, + user_data: glib::ffi::gpointer, + ) { + let mut error = ptr::null_mut(); + let ret = ffi::soup_session_send_finish(_source_object as *mut _, res, &mut error); + let result = if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + }; + let callback: Box_> = + Box_::from_raw(user_data as *mut _); + let callback: P = callback.into_inner(); + callback(result); + } + let callback = send_async_trampoline::

; + unsafe { + ffi::soup_session_send_async( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + io_priority.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box_::into_raw(user_data) as *mut _, + ); + } + } + + fn send_future( + &self, + msg: &Message, + io_priority: glib::Priority, + ) -> Pin> + 'static>> + { + let msg = msg.clone(); + Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { + obj.send_async(&msg, io_priority, Some(cancellable), move |res| { + send.resolve(res); + }); + })) + } + + #[doc(alias = "soup_session_set_accept_language")] + fn set_accept_language(&self, accept_language: &str) { + unsafe { + ffi::soup_session_set_accept_language( + self.as_ref().to_glib_none().0, + accept_language.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_session_set_accept_language_auto")] + fn set_accept_language_auto(&self, accept_language_auto: bool) { + unsafe { + ffi::soup_session_set_accept_language_auto( + self.as_ref().to_glib_none().0, + accept_language_auto.into_glib(), + ); + } + } + + #[doc(alias = "soup_session_set_idle_timeout")] + fn set_idle_timeout(&self, timeout: u32) { + unsafe { + ffi::soup_session_set_idle_timeout(self.as_ref().to_glib_none().0, timeout); + } + } + + #[doc(alias = "soup_session_set_proxy_resolver")] + fn set_proxy_resolver(&self, proxy_resolver: Option<&impl IsA>) { + unsafe { + ffi::soup_session_set_proxy_resolver( + self.as_ref().to_glib_none().0, + proxy_resolver.map(|p| p.as_ref()).to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_session_set_timeout")] + fn set_timeout(&self, timeout: u32) { + unsafe { + ffi::soup_session_set_timeout(self.as_ref().to_glib_none().0, timeout); + } + } + + #[doc(alias = "soup_session_set_tls_database")] + fn set_tls_database(&self, tls_database: Option<&impl IsA>) { + unsafe { + ffi::soup_session_set_tls_database( + self.as_ref().to_glib_none().0, + tls_database.map(|p| p.as_ref()).to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_session_set_tls_interaction")] + fn set_tls_interaction(&self, tls_interaction: Option<&impl IsA>) { + unsafe { + ffi::soup_session_set_tls_interaction( + self.as_ref().to_glib_none().0, + tls_interaction.map(|p| p.as_ref()).to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_session_set_user_agent")] + fn set_user_agent(&self, user_agent: &str) { + unsafe { + ffi::soup_session_set_user_agent( + self.as_ref().to_glib_none().0, + user_agent.to_glib_none().0, + ); + } + } + + #[doc(alias = "request-queued")] + fn connect_request_queued(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn request_queued_trampoline< + P: IsA, + F: Fn(&P, &Message) + 'static, + >( + this: *mut ffi::SoupSession, + msg: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Session::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(msg), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-queued\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_queued_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "request-unqueued")] + fn connect_request_unqueued(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn request_unqueued_trampoline< + P: IsA, + F: Fn(&P, &Message) + 'static, + >( + this: *mut ffi::SoupSession, + msg: *mut ffi::SoupMessage, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Session::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(msg), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"request-unqueued\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + request_unqueued_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "accept-language")] + fn connect_accept_language_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_accept_language_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::accept-language\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_accept_language_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "accept-language-auto")] + fn connect_accept_language_auto_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_accept_language_auto_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::accept-language-auto\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_accept_language_auto_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "idle-timeout")] + fn connect_idle_timeout_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_idle_timeout_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::idle-timeout\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_idle_timeout_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "proxy-resolver")] + fn connect_proxy_resolver_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_proxy_resolver_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::proxy-resolver\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_proxy_resolver_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "timeout")] + fn connect_timeout_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_timeout_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::timeout\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_timeout_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-database")] + fn connect_tls_database_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_database_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-database\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_database_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "tls-interaction")] + fn connect_tls_interaction_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_tls_interaction_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::tls-interaction\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_tls_interaction_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "user-agent")] + fn connect_user_agent_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_user_agent_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::SoupSession, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Session::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::user-agent\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_user_agent_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl> SessionExt for O {} + +impl fmt::Display for Session { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("Session") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/session_feature.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/session_feature.rs new file mode 100644 index 00000000..81dfe677 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/session_feature.rs @@ -0,0 +1,35 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::prelude::*; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupSessionFeature")] + pub struct SessionFeature(Interface); + + match fn { + type_ => || ffi::soup_session_feature_get_type(), + } +} + +impl SessionFeature { + pub const NONE: Option<&'static SessionFeature> = None; +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait SessionFeatureExt: IsA + sealed::Sealed + 'static {} + +impl> SessionFeatureExt for O {} + +impl fmt::Display for SessionFeature { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("SessionFeature") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/versions.txt b/src-tauri/vendor/soup3-0.5.0/src/auto/versions.txt new file mode 100644 index 00000000..affd34cc --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/versions.txt @@ -0,0 +1,3 @@ +Generated by gir (https://github.com/gtk-rs/gir @ ef087c070d5b) +from +from gir-files (https://github.com/gtk-rs/gir-files @ c23f21f51d54) diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_connection.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_connection.rs new file mode 100644 index 00000000..4cccc472 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_connection.rs @@ -0,0 +1,366 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::{WebsocketConnectionType, WebsocketExtension, WebsocketState}; +use glib::{ + prelude::*, + signal::{connect_raw, SignalHandlerId}, + translate::*, +}; +use std::{boxed::Box as Box_, fmt, mem::transmute}; + +glib::wrapper! { + #[doc(alias = "SoupWebsocketConnection")] + pub struct WebsocketConnection(Object); + + match fn { + type_ => || ffi::soup_websocket_connection_get_type(), + } +} + +impl WebsocketConnection { + #[doc(alias = "soup_websocket_connection_close")] + pub fn close(&self, code: libc::c_ushort, data: Option<&str>) { + unsafe { + ffi::soup_websocket_connection_close( + self.to_glib_none().0, + code, + data.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_websocket_connection_get_close_code")] + #[doc(alias = "get_close_code")] + pub fn close_code(&self) -> libc::c_ushort { + unsafe { ffi::soup_websocket_connection_get_close_code(self.to_glib_none().0) } + } + + #[doc(alias = "soup_websocket_connection_get_close_data")] + #[doc(alias = "get_close_data")] + pub fn close_data(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_websocket_connection_get_close_data( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_connection_type")] + #[doc(alias = "get_connection_type")] + pub fn connection_type(&self) -> WebsocketConnectionType { + unsafe { + from_glib(ffi::soup_websocket_connection_get_connection_type( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_extensions")] + #[doc(alias = "get_extensions")] + pub fn extensions(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::soup_websocket_connection_get_extensions( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_io_stream")] + #[doc(alias = "get_io_stream")] + pub fn io_stream(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_websocket_connection_get_io_stream( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_keepalive_interval")] + #[doc(alias = "get_keepalive_interval")] + pub fn keepalive_interval(&self) -> u32 { + unsafe { ffi::soup_websocket_connection_get_keepalive_interval(self.to_glib_none().0) } + } + + #[doc(alias = "soup_websocket_connection_get_max_incoming_payload_size")] + #[doc(alias = "get_max_incoming_payload_size")] + pub fn max_incoming_payload_size(&self) -> u64 { + unsafe { + ffi::soup_websocket_connection_get_max_incoming_payload_size(self.to_glib_none().0) + } + } + + #[doc(alias = "soup_websocket_connection_get_origin")] + #[doc(alias = "get_origin")] + pub fn origin(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_websocket_connection_get_origin( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_protocol")] + #[doc(alias = "get_protocol")] + pub fn protocol(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_websocket_connection_get_protocol( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_state")] + #[doc(alias = "get_state")] + pub fn state(&self) -> WebsocketState { + unsafe { + from_glib(ffi::soup_websocket_connection_get_state( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_get_uri")] + #[doc(alias = "get_uri")] + pub fn uri(&self) -> Option { + unsafe { + from_glib_none(ffi::soup_websocket_connection_get_uri( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_connection_send_text")] + pub fn send_text(&self, text: &str) { + unsafe { + ffi::soup_websocket_connection_send_text(self.to_glib_none().0, text.to_glib_none().0); + } + } + + #[doc(alias = "soup_websocket_connection_set_keepalive_interval")] + pub fn set_keepalive_interval(&self, interval: u32) { + unsafe { + ffi::soup_websocket_connection_set_keepalive_interval(self.to_glib_none().0, interval); + } + } + + #[doc(alias = "soup_websocket_connection_set_max_incoming_payload_size")] + pub fn set_max_incoming_payload_size(&self, max_incoming_payload_size: u64) { + unsafe { + ffi::soup_websocket_connection_set_max_incoming_payload_size( + self.to_glib_none().0, + max_incoming_payload_size, + ); + } + } + + #[doc(alias = "closed")] + pub fn connect_closed(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn closed_trampoline( + this: *mut ffi::SoupWebsocketConnection, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"closed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + closed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "closing")] + pub fn connect_closing(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn closing_trampoline( + this: *mut ffi::SoupWebsocketConnection, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"closing\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + closing_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "error")] + pub fn connect_error(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn error_trampoline< + F: Fn(&WebsocketConnection, &glib::Error) + 'static, + >( + this: *mut ffi::SoupWebsocketConnection, + error: *mut glib::ffi::GError, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), &from_glib_borrow(error)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"error\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + error_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "message")] + pub fn connect_message( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn message_trampoline< + F: Fn(&WebsocketConnection, i32, &glib::Bytes) + 'static, + >( + this: *mut ffi::SoupWebsocketConnection, + type_: libc::c_int, + message: *mut glib::ffi::GBytes, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), type_, &from_glib_borrow(message)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"message\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + message_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "pong")] + pub fn connect_pong(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn pong_trampoline< + F: Fn(&WebsocketConnection, &glib::Bytes) + 'static, + >( + this: *mut ffi::SoupWebsocketConnection, + message: *mut glib::ffi::GBytes, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), &from_glib_borrow(message)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"pong\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + pong_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "keepalive-interval")] + pub fn connect_keepalive_interval_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_keepalive_interval_trampoline< + F: Fn(&WebsocketConnection) + 'static, + >( + this: *mut ffi::SoupWebsocketConnection, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::keepalive-interval\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_keepalive_interval_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "max-incoming-payload-size")] + pub fn connect_max_incoming_payload_size_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_max_incoming_payload_size_trampoline< + F: Fn(&WebsocketConnection) + 'static, + >( + this: *mut ffi::SoupWebsocketConnection, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::max-incoming-payload-size\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_max_incoming_payload_size_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + #[doc(alias = "state")] + pub fn connect_state_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_state_trampoline( + this: *mut ffi::SoupWebsocketConnection, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::state\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_state_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} + +impl fmt::Display for WebsocketConnection { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("WebsocketConnection") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension.rs new file mode 100644 index 00000000..41a5dd71 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension.rs @@ -0,0 +1,104 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use glib::{prelude::*, translate::*}; +use std::{fmt, ptr}; + +glib::wrapper! { + #[doc(alias = "SoupWebsocketExtension")] + pub struct WebsocketExtension(Object); + + match fn { + type_ => || ffi::soup_websocket_extension_get_type(), + } +} + +impl WebsocketExtension { + pub const NONE: Option<&'static WebsocketExtension> = None; +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait WebsocketExtensionExt: IsA + sealed::Sealed + 'static { + //#[doc(alias = "soup_websocket_extension_configure")] + //fn configure(&self, connection_type: WebsocketConnectionType, params: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<(), glib::Error> { + // unsafe { TODO: call ffi:soup_websocket_extension_configure() } + //} + + #[doc(alias = "soup_websocket_extension_get_request_params")] + #[doc(alias = "get_request_params")] + fn request_params(&self) -> Option { + unsafe { + from_glib_full(ffi::soup_websocket_extension_get_request_params( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_extension_get_response_params")] + #[doc(alias = "get_response_params")] + fn response_params(&self) -> Option { + unsafe { + from_glib_full(ffi::soup_websocket_extension_get_response_params( + self.as_ref().to_glib_none().0, + )) + } + } + + #[doc(alias = "soup_websocket_extension_process_incoming_message")] + fn process_incoming_message( + &self, + header: &mut u8, + payload: glib::Bytes, + ) -> Result { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_websocket_extension_process_incoming_message( + self.as_ref().to_glib_none().0, + header, + payload.into_glib_ptr(), + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } + } + } + + #[doc(alias = "soup_websocket_extension_process_outgoing_message")] + fn process_outgoing_message( + &self, + header: &mut u8, + payload: glib::Bytes, + ) -> Result { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::soup_websocket_extension_process_outgoing_message( + self.as_ref().to_glib_none().0, + header, + payload.into_glib_ptr(), + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } + } + } +} + +impl> WebsocketExtensionExt for O {} + +impl fmt::Display for WebsocketExtension { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("WebsocketExtension") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_deflate.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_deflate.rs new file mode 100644 index 00000000..ac9837c5 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_deflate.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::WebsocketExtension; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupWebsocketExtensionDeflate")] + pub struct WebsocketExtensionDeflate(Object) @extends WebsocketExtension; + + match fn { + type_ => || ffi::soup_websocket_extension_deflate_get_type(), + } +} + +impl WebsocketExtensionDeflate {} + +impl fmt::Display for WebsocketExtensionDeflate { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("WebsocketExtensionDeflate") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_manager.rs b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_manager.rs new file mode 100644 index 00000000..409d9694 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/auto/websocket_extension_manager.rs @@ -0,0 +1,24 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use crate::SessionFeature; +use std::fmt; + +glib::wrapper! { + #[doc(alias = "SoupWebsocketExtensionManager")] + pub struct WebsocketExtensionManager(Object) @implements SessionFeature; + + match fn { + type_ => || ffi::soup_websocket_extension_manager_get_type(), + } +} + +impl WebsocketExtensionManager {} + +impl fmt::Display for WebsocketExtensionManager { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("WebsocketExtensionManager") + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/cookie_jar.rs b/src-tauri/vendor/soup3-0.5.0/src/cookie_jar.rs new file mode 100644 index 00000000..b092cca5 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/cookie_jar.rs @@ -0,0 +1,60 @@ +use crate::{Cookie, CookieJar}; +use glib::object::IsA; +use glib::translate::*; + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait CookieJarExtManual: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_cookie_jar_add_cookie")] + fn add_cookie(&self, cookie: &mut Cookie) { + unsafe { + ffi::soup_cookie_jar_add_cookie( + self.as_ref().to_glib_none().0, + mut_override(cookie.to_glib_full()), + ); + } + } + + #[doc(alias = "soup_cookie_jar_add_cookie_full")] + fn add_cookie_full( + &self, + cookie: &mut Cookie, + uri: Option<&glib::Uri>, + first_party: Option<&glib::Uri>, + ) { + unsafe { + ffi::soup_cookie_jar_add_cookie_full( + self.as_ref().to_glib_none().0, + mut_override(cookie.to_glib_full()), + uri.to_glib_none().0, + first_party.to_glib_none().0, + ); + } + } + + #[doc(alias = "soup_cookie_jar_add_cookie_with_first_party")] + fn add_cookie_with_first_party(&self, first_party: &glib::Uri, cookie: &mut Cookie) { + unsafe { + ffi::soup_cookie_jar_add_cookie_with_first_party( + self.as_ref().to_glib_none().0, + first_party.to_glib_none().0, + mut_override(cookie.to_glib_full()), + ); + } + } + + #[doc(alias = "soup_cookie_jar_delete_cookie")] + fn delete_cookie(&self, cookie: &mut Cookie) { + unsafe { + ffi::soup_cookie_jar_delete_cookie( + self.as_ref().to_glib_none().0, + cookie.to_glib_none_mut().0, + ); + } + } +} + +impl> CookieJarExtManual for O {} diff --git a/src-tauri/vendor/soup3-0.5.0/src/functions.rs b/src-tauri/vendor/soup3-0.5.0/src/functions.rs new file mode 100644 index 00000000..6d33b1db --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/functions.rs @@ -0,0 +1,62 @@ +use ffi; +use glib; +use glib::translate::*; + +#[doc(alias = "soup_header_g_string_append_param")] +pub fn header_g_string_append_param(header: &mut String, name: &str, value: &str) { + unsafe { + let hdr = glib::ffi::g_string_new_len(header.as_ptr() as *const _, header.len() as isize); + ffi::soup_header_g_string_append_param(hdr, name.to_glib_none().0, value.to_glib_none().0); + let s: glib::GString = from_glib_full(glib::ffi::g_string_free(hdr, glib::ffi::GFALSE)); + header.clone_from(&s.as_str().to_owned()) + } +} + +#[doc(alias = "soup_header_g_string_append_param_quoted")] +pub fn header_g_string_append_param_quoted(header: &mut String, name: &str, value: &str) { + unsafe { + let hdr = glib::ffi::g_string_new_len(header.as_ptr() as *const _, header.len() as isize); + ffi::soup_header_g_string_append_param_quoted( + hdr, + name.to_glib_none().0, + value.to_glib_none().0, + ); + let s: glib::GString = from_glib_full(glib::ffi::g_string_free(hdr, glib::ffi::GFALSE)); + header.clone_from(&s.as_str().to_owned()) + } +} + +// #[doc(alias = "soup_cookies_free")] +// pub fn cookies_free(cookies: &[&Cookie]) { +// assert_initialized_main_thread!(); +// unsafe { +// let cookie_list: *mut glib::ffi::GSList = ToGlibContainerFromSlice::to_glib_none_from_slice(cookies).0; +// ffi::soup_cookies_free(cookie_list); +// } +// } + +// #[doc(alias = "soup_cookies_to_cookie_header")] +// pub fn cookies_to_cookie_header(cookies: &[Cookie]) -> Option { +// assert_initialized_main_thread!(); +// unsafe { +// let cookie_list: *mut glib::ffi::GSList = ToGlibContainerFromSlice::to_glib_none_from_slice(cookies).0; +// from_glib_full(ffi::soup_cookies_to_cookie_header(cookie_list)) +// } + +// } + +// #[doc(alias = "soup_cookies_to_request")] +// pub fn cookies_to_request(cookies: &[&Cookie], msg: &Message) { +// skip_assert_initialized!(); +// unsafe { +// ffi::soup_cookies_to_request(cookies.to_glib_none().0, msg.to_glib_none().0); +// } +// } + +// #[doc(alias = "soup_cookies_to_response")] +// pub fn cookies_to_response(cookies: &[Cookie], msg: &Message) { +// skip_assert_initialized!(); +// unsafe { +// ffi::soup_cookies_to_response(cookies.to_glib_none().0, msg.to_glib_none().0); +// } +// } diff --git a/src-tauri/vendor/soup3-0.5.0/src/lib.rs b/src-tauri/vendor/soup3-0.5.0/src/lib.rs new file mode 100644 index 00000000..db2fc8bb --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/lib.rs @@ -0,0 +1,28 @@ +// // Copyright 2013-2017, The Gtk-rs Project Developers. +// // See the COPYRIGHT file at the top-level directory of this distribution. +// // Licensed under the MIT license, see the LICENSE file or +#![cfg_attr(docsrs, feature(doc_cfg))] + +pub use ffi; +pub use gio; +pub use glib; + +#[macro_use] +mod rt; + +pub mod prelude; + +#[allow(unused_imports)] +mod auto; +pub use auto::*; + +mod functions; +pub use auto::functions::*; +pub use functions::*; + +mod cookie_jar; +mod logger; +mod message_headers; +mod server; +mod session; +mod websocket_connection; diff --git a/src-tauri/vendor/soup3-0.5.0/src/logger.rs b/src-tauri/vendor/soup3-0.5.0/src/logger.rs new file mode 100644 index 00000000..cdcec922 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/logger.rs @@ -0,0 +1,52 @@ +use crate::{Logger, LoggerLogLevel}; +use glib::object::IsA; +use glib::translate::*; +use glib::GStr; +use std::boxed::Box as Box_; + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait LoggerExtManual: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_logger_set_printer")] + fn set_printer( + &self, + printer: P, + ) { + let printer_data: Box_

= Box_::new(printer); + unsafe extern "C" fn printer_func< + P: Fn(&Logger, LoggerLogLevel, char, &GStr) + Send + Sync + 'static, + >( + logger: *mut ffi::SoupLogger, + level: ffi::SoupLoggerLogLevel, + direction: libc::c_char, + data: *const libc::c_char, + user_data: glib::ffi::gpointer, + ) { + let logger = from_glib_borrow(logger); + let direction: glib::Char = from_glib(direction); + let data: &GStr = GStr::from_ptr(data); + let callback: &P = &*(user_data as *mut _); + (*callback)(&logger, from_glib(level), char::from(direction), data); + } + unsafe extern "C" fn destroy_func< + P: Fn(&Logger, LoggerLogLevel, char, &GStr) + Send + Sync + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + unsafe { + ffi::soup_logger_set_printer( + self.as_ref().to_glib_none().0, + Some(printer_func::

as _), + Box_::into_raw(printer_data) as *mut _, + Some(destroy_func::

as _), + ) + } + } +} + +impl> LoggerExtManual for O {} diff --git a/src-tauri/vendor/soup3-0.5.0/src/message_headers.rs b/src-tauri/vendor/soup3-0.5.0/src/message_headers.rs new file mode 100644 index 00000000..4d874973 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/message_headers.rs @@ -0,0 +1,81 @@ +use glib::translate::*; +use glib::{GString, IntoGStr, IntoOptionalGStr}; +use std::collections::HashMap; +use std::ptr; + +use crate::MessageHeaders; + +impl MessageHeaders { + #[doc(alias = "soup_message_headers_get_content_disposition")] + pub fn content_disposition(&self) -> Option<(GString, HashMap)> { + let mut disposition = ptr::null_mut(); + let mut params = ptr::null_mut(); + unsafe { + if bool::from_glib(ffi::soup_message_headers_get_content_disposition( + mut_override(self.to_glib_none().0), + &mut disposition, + &mut params, + )) { + let params = if !params.is_null() { + HashMap::from_glib_full(params) + } else { + HashMap::new() + }; + Some((GString::from_glib_full(disposition), params)) + } else { + None + } + } + } + + #[doc(alias = "soup_message_headers_set_content_disposition")] + pub fn set_content_disposition( + &self, + disposition: Option, + params: Option>, + ) { + disposition.run_with_gstr(|disposition| unsafe { + ffi::soup_message_headers_set_content_disposition( + self.to_glib_none().0, + disposition.to_glib_none().0, + params.to_glib_none().0, + ) + }) + } + + #[doc(alias = "soup_message_headers_get_content_type")] + pub fn content_type(&self) -> Option<(GString, HashMap)> { + let mut params = ptr::null_mut(); + unsafe { + let content_type = ffi::soup_message_headers_get_content_type( + mut_override(self.to_glib_none().0), + &mut params, + ); + if !content_type.is_null() { + let params = if !params.is_null() { + HashMap::from_glib_full(params) + } else { + HashMap::new() + }; + Some((GString::from_glib_full(content_type), params)) + } else { + None + } + } + } + + #[doc(alias = "soup_message_headers_set_content_type")] + pub fn set_content_type( + &self, + content_type: Option, + params: Option>, + ) { + content_type.run_with_gstr(|content_type| unsafe { + ffi::soup_message_headers_set_content_disposition( + self.to_glib_none().0, + content_type.to_glib_none().0, + params.to_glib_none().0, + ) + }) + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/prelude.rs b/src-tauri/vendor/soup3-0.5.0/src/prelude.rs new file mode 100644 index 00000000..2c966f27 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/prelude.rs @@ -0,0 +1,12 @@ +#[doc(hidden)] +pub use gio::prelude::*; +#[doc(hidden)] +pub use glib::prelude::*; + +pub use crate::auto::traits::*; + +pub use crate::cookie_jar::CookieJarExtManual; +pub use crate::logger::LoggerExtManual; +pub use crate::server::ServerExtManual; +pub use crate::session::SessionExtManual; +pub use crate::websocket_connection::WebsocketConnectionExtManual; diff --git a/src-tauri/vendor/soup3-0.5.0/src/rt.rs b/src-tauri/vendor/soup3-0.5.0/src/rt.rs new file mode 100644 index 00000000..696fd791 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/rt.rs @@ -0,0 +1,11 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +/// No-op. +macro_rules! assert_initialized_main_thread { + () => {}; +} + +/// No-op. +macro_rules! skip_assert_initialized { + () => {}; +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/server.rs b/src-tauri/vendor/soup3-0.5.0/src/server.rs new file mode 100644 index 00000000..4557ce7b --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/server.rs @@ -0,0 +1,178 @@ +use crate::{Server, ServerMessage, WebsocketConnection}; +use glib::object::IsA; +use glib::translate::*; +use std::boxed::Box as Box_; +use std::collections::HashMap; + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait ServerExtManual: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_server_add_early_handler")] + fn add_early_handler) + 'static>( + &self, + path: Option<&str>, + callback: P, + ) { + let callback_data: Box_

= Box_::new(callback); + unsafe extern "C" fn callback_func< + P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, + >( + server: *mut ffi::SoupServer, + msg: *mut ffi::SoupServerMessage, + path: *const libc::c_char, + query: *mut glib::ffi::GHashTable, + user_data: glib::ffi::gpointer, + ) { + let server = from_glib_borrow(server); + let msg: Borrowed = from_glib_borrow(msg); + let path: Borrowed = from_glib_borrow(path); + let query_map = query_map_from_hash_table(query); + let callback: &P = &*(user_data as *mut _); + (*callback)(&server, &msg, path.as_str(), query_map); + } + let callback = Some(callback_func::

as _); + unsafe extern "C" fn destroy_func< + P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call6 = Some(destroy_func::

as _); + let super_callback0: Box_

= callback_data; + unsafe { + ffi::soup_server_add_early_handler( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + callback, + Box_::into_raw(super_callback0) as *mut _, + destroy_call6, + ); + } + } + + #[doc(alias = "soup_server_add_handler")] + fn add_handler) + 'static>( + &self, + path: Option<&str>, + callback: P, + ) { + let callback_data: Box_

= Box_::new(callback); + unsafe extern "C" fn callback_func< + P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, + >( + server: *mut ffi::SoupServer, + msg: *mut ffi::SoupServerMessage, + path: *const libc::c_char, + query: *mut glib::ffi::GHashTable, + user_data: glib::ffi::gpointer, + ) { + let server = from_glib_borrow(server); + let msg: Borrowed = from_glib_borrow(msg); + let path: Borrowed = from_glib_borrow(path); + let query_map = query_map_from_hash_table(query); + let callback: &P = &*(user_data as *mut _); + (*callback)(&server, &msg, path.as_str(), query_map); + } + let callback = Some(callback_func::

as _); + unsafe extern "C" fn destroy_func< + P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call6 = Some(destroy_func::

as _); + let super_callback0: Box_

= callback_data; + unsafe { + ffi::soup_server_add_handler( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + callback, + Box_::into_raw(super_callback0) as *mut _, + destroy_call6, + ); + } + } + + #[doc(alias = "soup_server_add_websocket_handler")] + fn add_websocket_handler< + P: Fn(&Server, &ServerMessage, &str, &WebsocketConnection) + 'static, + >( + &self, + path: Option<&str>, + origin: Option<&str>, + protocols: &[&str], + callback: P, + ) { + let callback_data: Box_

= Box_::new(callback); + unsafe extern "C" fn callback_func< + P: Fn(&Server, &ServerMessage, &str, &WebsocketConnection) + 'static, + >( + server: *mut ffi::SoupServer, + msg: *mut ffi::SoupServerMessage, + path: *const libc::c_char, + connection: *mut ffi::SoupWebsocketConnection, + user_data: glib::ffi::gpointer, + ) { + let server = from_glib_borrow(server); + let msg: Borrowed = from_glib_borrow(msg); + let path: Borrowed = from_glib_borrow(path); + let connection = from_glib_borrow(connection); + let callback: &P = &*(user_data as *mut _); + (*callback)(&server, &msg, path.as_str(), &connection); + } + let callback = Some(callback_func::

as _); + unsafe extern "C" fn destroy_func< + P: Fn(&Server, &ServerMessage, &str, &WebsocketConnection) + 'static, + >( + data: glib::ffi::gpointer, + ) { + let _callback: Box_

= Box_::from_raw(data as *mut _); + } + let destroy_call6 = Some(destroy_func::

as _); + let super_callback0: Box_

= callback_data; + unsafe { + ffi::soup_server_add_websocket_handler( + self.as_ref().to_glib_none().0, + path.to_glib_none().0, + origin.to_glib_none().0, + protocols.to_glib_none().0, + callback, + Box_::into_raw(super_callback0) as *mut _, + destroy_call6, + ); + } + } +} + +impl> ServerExtManual for O {} + +unsafe fn query_map_from_hash_table<'a>( + query: *mut glib::ffi::GHashTable, +) -> HashMap<&'a str, &'a str> { + unsafe extern "C" fn read_query_hash_table( + key: glib::ffi::gpointer, + value: glib::ffi::gpointer, + hash_map: glib::ffi::gpointer, + ) { + let key = glib::GStr::from_ptr_checked(key as *const libc::c_char); + let value = glib::GStr::from_ptr_checked(value as *const libc::c_char); + let hash_map: &mut HashMap<&str, &str> = &mut *(hash_map as *mut HashMap<&str, &str>); + if let (Some(k), Some(v)) = (key, value) { + hash_map.insert(k.as_str(), v.as_str()); + } + } + unsafe { + let mut query_map = HashMap::with_capacity(glib::ffi::g_hash_table_size(query) as usize); + glib::ffi::g_hash_table_foreach( + query, + Some(read_query_hash_table), + &mut query_map as *mut HashMap<&str, &str> as *mut _, + ); + query_map + } +} diff --git a/src-tauri/vendor/soup3-0.5.0/src/session.rs b/src-tauri/vendor/soup3-0.5.0/src/session.rs new file mode 100644 index 00000000..22d4c0de --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/session.rs @@ -0,0 +1,106 @@ +use crate::{Message, Session, WebsocketConnection}; +use glib::object::IsA; +use glib::translate::*; +use std::boxed::Box as Box_; +use std::pin::Pin; +use std::ptr; + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait SessionExtManual: IsA + sealed::Sealed + 'static { + #[doc(alias = "soup_session_websocket_connect_async")] + fn websocket_connect_async) + 'static>( + &self, + msg: &Message, + origin: Option<&str>, + protocols: &[&str], + io_priority: glib::Priority, + cancellable: Option<&impl IsA>, + callback: P, + ) { + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = + Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn websocket_connect_async_trampoline< + P: FnOnce(Result) + 'static, + >( + _source_object: *mut glib::gobject_ffi::GObject, + res: *mut gio::ffi::GAsyncResult, + user_data: glib::ffi::gpointer, + ) { + let mut error = ptr::null_mut(); + let ret = ffi::soup_session_websocket_connect_finish( + _source_object as *mut _, + res, + &mut error, + ); + let result = if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + }; + let callback: Box_> = + Box_::from_raw(user_data as *mut _); + let callback = callback.into_inner(); + callback(result); + } + let callback = websocket_connect_async_trampoline::

; + unsafe { + ffi::soup_session_websocket_connect_async( + self.as_ref().to_glib_none().0, + msg.to_glib_none().0, + origin.to_glib_none().0, + protocols.to_glib_none().0, + io_priority.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box_::into_raw(user_data) as *mut _, + ); + } + } + + fn websocket_connect_async_future( + &self, + msg: &Message, + origin: Option<&str>, + protocols: &[&str], + io_priority: glib::Priority, + ) -> Pin< + Box_> + 'static>, + > { + let msg = msg.clone(); + let origin = origin.map(ToOwned::to_owned); + let protocols = protocols + .iter() + .copied() + .map(String::from) + .collect::>(); + Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { + let protocols = protocols.iter().map(|s| s.as_str()).collect::>(); + obj.websocket_connect_async( + &msg, + origin.as_ref().map(::std::borrow::Borrow::borrow), + &protocols, + io_priority, + Some(cancellable), + move |res| { + send.resolve(res); + }, + ); + })) + } +} + +impl> SessionExtManual for O {} diff --git a/src-tauri/vendor/soup3-0.5.0/src/websocket_connection.rs b/src-tauri/vendor/soup3-0.5.0/src/websocket_connection.rs new file mode 100644 index 00000000..b6a822e0 --- /dev/null +++ b/src-tauri/vendor/soup3-0.5.0/src/websocket_connection.rs @@ -0,0 +1,35 @@ +use crate::{WebsocketConnection, WebsocketConnectionType, WebsocketExtension}; +use glib::{prelude::*, translate::*}; + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait WebsocketConnectionExtManual: + IsA + sealed::Sealed + 'static +{ + #[doc(alias = "soup_websocket_connection_new")] + fn new( + stream: &impl IsA, + uri: &glib::Uri, + type_: WebsocketConnectionType, + origin: Option<&str>, + protocol: Option<&str>, + extensions: &[WebsocketExtension], + ) -> WebsocketConnection { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::soup_websocket_connection_new( + stream.as_ref().to_glib_none().0, + uri.to_glib_none().0, + type_.into_glib(), + origin.to_glib_none().0, + protocol.to_glib_none().0, + extensions.to_glib_full(), + )) + } + } +} + +impl> WebsocketConnectionExtManual for O {}