api: remote route takes advantage from builds functions

This commit is contained in:
nemunaire 2019-09-07 01:25:42 +02:00
commit f2fc142869
6 changed files with 83 additions and 6 deletions

View file

@ -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
}
}