-
Notifications
You must be signed in to change notification settings - Fork 1
/
Root.go
47 lines (39 loc) · 8.8 KB
/
Root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Licensed to NASA JPL under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. NASA JPL licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package endpoints
import (
"fmt"
apiRouter "github.com/pixlise/core/v4/api/router"
"github.com/pixlise/core/v4/api/services"
)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Root request, which also shows version & a logo
func RootRequest(params apiRouter.ApiHandlerGenericPublicParams) error {
params.Writer.Header().Add("Content-Type", "text/html")
const binchicken = `<img style="margin-top: 50px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAABCCAYAAAAc9iUKAAAMSmlDQ1BJQ0MgcHJvZmlsZQAASImVVwdYU8kWnltSSWiBCEgJvYkiCASQEkKLICBVsBGSQEKJMSGI2JFlFVy7iIC6oqsiLroWQNaKvSyKvT8sqKysiwUbKm9SQFe/9973zvfNvf89c85/SubezACgV8OXyXJRfQDypPny+IgQ1vjUNBbpEUABA5ABG/jxBQoZJy4uGkAZuP9T3lwDiOp+2U3F9f38fxUDoUghAACJgzhDqBDkQbwXALxEIJPnA0BkQ73t9HyZCk+E2EgOE4RYpsJZGlyiwhkaXKm2SYznQrwDADKNz5dnAaDbDPWsAkEW5NG9AbG7VCiRAqBHhjhQIOYLIY6EeFhe3lQVhnbAKeMrnqx/cGYMcvL5WYNYU4tayKEShSy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LSYT3e3t4IDAx0HJifnx82bdq0YNe1AoEAGo0Gvb29AICxsTG8evUKPB4PfD7fYT0xMTFYtWqV40tx5cqVSE5OxosXL/D161eXA1u+fPkMvTKZDAqFwmH3i+2jSCRyfMYoikJCQgKysrLg4eHhcmB8Pn+Gi6XRaFBXV+dQOI7P5+P48eM4cuQIeDye43TPik6nI2VlZSQkJMSltJ+Xl0dqa2vnVVcoFJLi4mLS398/62mAcuT/Y8PDw6iqqkJjYyP6+vpgMBhAURQYhrFGfrlcrjWQw2aPssuKpmlwOByIxWJIJBIcO3YMAQEBOH36NNRqtVUPm1nKksrULFQ/Pz8kJCQgPT3doct76m/9Y9y/J9Gg8YSzEr8AAAAASUVORK5CYII=">`
var start string = `<!DOCTYPE html>
<html lang="en"><head></head>
<body style="font-family: Arial, Helvetica, sans-serif">
<center>`
var midtemplate = "<h1>PIXLISE API</h1><p>Version %s</p><p>Git Commit: %s"
var mid = fmt.Sprintf(midtemplate, getAPIVersion(), services.GitHash)
var end string = `</p>
</center>
</body>`
params.Writer.Write([]byte(start + binchicken + mid + end))
return nil
}