32 lines
613 B
Go
32 lines
613 B
Go
package code
|
|
|
|
import (
|
|
"encoding/base64"
|
|
|
|
aw "github.com/deanishe/awgo"
|
|
|
|
"gitea.micah.wiki/pandora/alfred/model"
|
|
"gitea.micah.wiki/pandora/alfred/pkg/stringx"
|
|
)
|
|
|
|
func DecodeDo(args []string) []*model.Item {
|
|
if len(args) == 0 {
|
|
return nil
|
|
}
|
|
value := args[0]
|
|
bytes, err := base64.RawURLEncoding.DecodeString(value)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
val := string(bytes)
|
|
items := make([]*model.Item, 0)
|
|
items = append(items, &model.Item{
|
|
Title: val,
|
|
Subtitle: stringx.NewStrPoint("URL Decode"),
|
|
Icon: aw.IconInfo,
|
|
Arg: []string{"copytext", val},
|
|
Valid: true,
|
|
})
|
|
return items
|
|
}
|