mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-15 18:22:08 -04:00
clipboard: fix file transfer & export functionality
- grants read to all installed flatpak apps
This commit is contained in:
@@ -45,6 +45,10 @@ func HandleRequest(conn net.Conn, req models.Request, m *Manager) {
|
||||
handleGetPinnedEntries(conn, req, m)
|
||||
case "clipboard.getPinnedCount":
|
||||
handleGetPinnedCount(conn, req, m)
|
||||
case "clipboard.startFileTransfer":
|
||||
handleStartFileTransfer(conn, req, m)
|
||||
case "clipboard.exportFile":
|
||||
handleExportFile(conn, req, m)
|
||||
default:
|
||||
models.RespondError(conn, req.ID, "unknown method: "+req.Method)
|
||||
}
|
||||
@@ -281,3 +285,35 @@ func handleGetPinnedCount(conn net.Conn, req models.Request, m *Manager) {
|
||||
count := m.GetPinnedCount()
|
||||
models.Respond(conn, req.ID, map[string]int{"count": count})
|
||||
}
|
||||
|
||||
func handleStartFileTransfer(conn net.Conn, req models.Request, m *Manager) {
|
||||
filePath, err := params.String(req.Params, "filePath")
|
||||
if err != nil {
|
||||
models.RespondError(conn, req.ID, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
key, err := m.StartFileTransfer(filePath)
|
||||
if err != nil {
|
||||
models.RespondError(conn, req.ID, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
models.Respond(conn, req.ID, map[string]string{"key": key})
|
||||
}
|
||||
|
||||
func handleExportFile(conn net.Conn, req models.Request, m *Manager) {
|
||||
filePath, err := params.String(req.Params, "filePath")
|
||||
if err != nil {
|
||||
models.RespondError(conn, req.ID, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
exportedPath, err := m.ExportFileForFlatpak(filePath)
|
||||
if err != nil {
|
||||
models.RespondError(conn, req.ID, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
models.Respond(conn, req.ID, map[string]string{"path": exportedPath})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user