feat: direct call download api by cgo dart

This commit is contained in:
liwei committed 2024-12-02 00:39:28 +08:00
1 parent 467ada5500
commit 91dfd78b77
71 files changed
+6936 -1883

No files matched your search

-6
View File
@@ -1,15 +1,11 @@
package main
/*
#include <stdlib.h>
*/
import "C"
import (
"encoding/json"
"github.com/GopeedLab/gopeed/bind"
"github.com/GopeedLab/gopeed/pkg/api"
"github.com/GopeedLab/gopeed/pkg/api/model"
"unsafe"
)
func main() {}
@@ -20,7 +16,6 @@ func Create(cfg *C.char) *C.char {
if err := json.Unmarshal([]byte(C.GoString(cfg)), &config); err != nil {
return C.CString(bind.BuildResult(err))
}
defer C.free(unsafe.Pointer(cfg))
return C.CString(bind.Create(&config))
}
@@ -31,7 +26,6 @@ func Invoke(index int, req *C.char) *C.char {
if err := json.Unmarshal([]byte(C.GoString(req)), &request); err != nil {
return C.CString(bind.BuildResult(err))
}
defer C.free(unsafe.Pointer(req))
return C.CString(bind.Invoke(index, &request))
}