Provider's icons
This commit is contained in:
parent
7c05c6199c
commit
1d38f399fc
|
@ -34,6 +34,7 @@ package api
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
|
@ -45,9 +46,9 @@ import (
|
||||||
func declareProviderSpecsRoutes(router *gin.RouterGroup) {
|
func declareProviderSpecsRoutes(router *gin.RouterGroup) {
|
||||||
router.GET("/providers/_specs", listProviders)
|
router.GET("/providers/_specs", listProviders)
|
||||||
|
|
||||||
router.GET("/providers/_specs/:ssid/icon.png", getProviderSpecIcon)
|
router.GET("/providers/_specs/:psid/icon.png", getProviderSpecIcon)
|
||||||
|
|
||||||
apiProviderSpecsRoutes := router.Group("/providers/_specs/:ssid")
|
apiProviderSpecsRoutes := router.Group("/providers/_specs/:psid")
|
||||||
apiProviderSpecsRoutes.Use(ProviderSpecsHandler)
|
apiProviderSpecsRoutes.Use(ProviderSpecsHandler)
|
||||||
|
|
||||||
apiProviderSpecsRoutes.GET("", getProviderSpec)
|
apiProviderSpecsRoutes.GET("", getProviderSpec)
|
||||||
|
@ -65,17 +66,14 @@ func listProviders(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getProviderSpecIcon(c *gin.Context) {
|
func getProviderSpecIcon(c *gin.Context) {
|
||||||
/*
|
psid := string(c.Param("psid"))
|
||||||
ssid := string(c.Param("ssid"))
|
|
||||||
|
|
||||||
cnt, ok := providers.Icons[strings.TrimSuffix(ssid, ".png")]
|
cnt, ok := providers.Icons[strings.TrimSuffix(psid, ".png")]
|
||||||
if !ok {
|
if !ok {
|
||||||
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Icon not found."})
|
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": "Icon not found."})
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data(http.StatusOK, "image/png", cnt)
|
c.Data(http.StatusOK, "image/png", cnt)
|
||||||
*/
|
|
||||||
c.AbortWithStatusJSON(http.StatusNotImplemented, gin.H{"errmsg": "Icon not found."})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProviderSpecsHandler(c *gin.Context) {
|
func ProviderSpecsHandler(c *gin.Context) {
|
||||||
|
|
|
@ -32,5 +32,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
//go:generate go run generators/gen_database_migration.go
|
//go:generate go run generators/gen_database_migration.go
|
||||||
//go:generate go run generators/gen_icon.go sources sources
|
//go:generate go run generators/gen_icon.go providers providers
|
||||||
//go:generate go run generators/gen_icon.go services svcs
|
//go:generate go run generators/gen_icon.go services svcs
|
||||||
|
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -38,7 +38,7 @@
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
<b-list-group-item v-for="(src, idx) in providers" :key="idx" :active="srcSelected === idx" button class="d-flex" @click="selectProvider(idx)">
|
<b-list-group-item v-for="(src, idx) in providers" :key="idx" :active="srcSelected === idx" button class="d-flex" @click="selectProvider(idx)">
|
||||||
<div class="align-self-center text-center" style="min-width:50px;width:50px;">
|
<div class="align-self-center text-center" style="min-width:50px;width:50px;">
|
||||||
<img :src="'/api/source_specs/' + idx + '/icon.png'" :alt="src.name" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
<img :src="'/api/providers/_specs/' + idx + '/icon.png'" :alt="src.name" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
||||||
</div>
|
</div>
|
||||||
<div class="align-self-center" style="line-height: 1.1">
|
<div class="align-self-center" style="line-height: 1.1">
|
||||||
<strong>{{ src.name }}</strong> –
|
<strong>{{ src.name }}</strong> –
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
<div class="pr-2 pl-2">
|
<div class="pr-2 pl-2">
|
||||||
<b-button class="p-3 w-100 text-left" type="button" variant="outline-info" @click="goToSource()">
|
<b-button class="p-3 w-100 text-left" type="button" variant="outline-info" @click="goToSource()">
|
||||||
<div class="d-inline-block text-center" style="width: 50px;">
|
<div class="d-inline-block text-center" style="width: 50px;">
|
||||||
<img :src="'/api/source_specs/' + sources_getAll[domain.id_source]._srctype + '/icon.png'" :alt="sources_getAll[domain.id_source]._srctype" :title="sources_getAll[domain.id_source]._srctype" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
<img :src="'/api/providers/_specs/' + providers_getAll[domain.id_provider]._srctype + '/icon.png'" :alt="providers_getAll[domain.id_provider]._srctype" :title="providers_getAll[domain.id_provider]._srctype" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
||||||
</div>
|
</div>
|
||||||
{{ sources_getAll[domain.id_source]._comment }}
|
{{ sources_getAll[domain.id_source]._comment }}
|
||||||
</b-button>
|
</b-button>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<b-row v-else class="flex-grow-1">
|
<b-row v-else class="flex-grow-1">
|
||||||
<b-col lg="4" md="5" class="bg-light">
|
<b-col lg="4" md="5" class="bg-light">
|
||||||
<div class="text-center mb-3">
|
<div class="text-center mb-3">
|
||||||
<img :src="'/api/provider_specs/' + $route.params.provider + '/icon.png'" :alt="providerSpecs_getAll[$route.params.provider].name" style="max-width: 100%; max-height: 10em">
|
<img :src="'/api/providers/_specs/' + $route.params.provider + '/icon.png'" :alt="providerSpecs_getAll[$route.params.provider].name" style="max-width: 100%; max-height: 10em">
|
||||||
</div>
|
</div>
|
||||||
<h3>
|
<h3>
|
||||||
{{ providerSpecs_getAll[$route.params.provider].name }}
|
{{ providerSpecs_getAll[$route.params.provider].name }}
|
||||||
|
|
Loading…
Reference in New Issue