api: remote route takes advantage from builds functions
This commit is contained in:
parent
ded583008a
commit
f2fc142869
6 changed files with 83 additions and 6 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package sync
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path"
|
||||
|
|
@ -159,5 +160,10 @@ func ApiListRemoteThemes(_ httprouter.Params, _ []byte) (interface{}, error) {
|
|||
|
||||
// ApiListRemoteTheme is an accessor letting foreign packages to access remote main theme attributes.
|
||||
func ApiGetRemoteTheme(ps httprouter.Params, _ []byte) (interface{}, error) {
|
||||
return getAuthors(GlobalImporter, ps.ByName("thid"))
|
||||
r, errs := BuildTheme(GlobalImporter, ps.ByName("thid"))
|
||||
if r == nil {
|
||||
return r, errors.New(fmt.Sprintf("%q", errs))
|
||||
} else {
|
||||
return r, nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue