Skip to content
Snippets Groups Projects
Select Git revision
  • 352b6fb23ec5ebe47eab0e68afec5f5ae6594e25
  • main default protected
2 results

server_apps.go

Blame
  • server_apps.go 16.52 KiB
    package main
    
    import (
    	"archive/tar"
    	"archive/zip"
    	"bytes"
    	"compress/gzip"
    	"context"
    	"crypto/md5"
    	"encoding/json"
    	"fmt"
    	"io"
    	"log"
    	"net/http"
    	"net/url"
    	"path"
    	"regexp"
    	"strings"
    	"time"
    
    	"github.com/go-git/go-git/v5"
    	"github.com/go-git/go-git/v5/config"
    	"github.com/go-git/go-git/v5/plumbing"
    	"github.com/go-git/go-git/v5/plumbing/object"
    	"github.com/go-git/go-git/v5/storage/memory"
    	"github.com/pelletier/go-toml/v2"
    )
    
    type appRegistry struct {
    	shame []*appShame
    	apps  []*appDescriptor
    }
    
    type appShame struct {
    	repository string
    	errorMsg   string
    }
    
    type appDescriptor struct {
    	repository string
    	pathInRepo string
    	appInfo    *appInfo
    }
    
    type appInfo struct {
    	name        string
    	menu        string
    	author      string
    	description string
    	version     int
    	commit      string
    	stars       int
    	flow3rSeed  string
    
    	commitObj *object.Commit
    	zip       []byte
    	targz     []byte
    
    	firstErr error
    }
    
    type GLProject struct {
    	StarCount int `json:"star_count"`
    }
    
    var (
    	reAppPath = regexp.MustCompile(`^apps/([^/]+.toml)$`)
    	reAppRepo = regexp.MustCompile(`^([a-zA-Z\-_\.0-9]+)/([a-zA-Z\-_0-9]+)$`)
    )