Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
1 result

Target

Select target project
No results found
Select Git revision
  • master
1 result
Show changes
1000 files
+ 219864
66
Compare changes
  • Side-by-side
  • Inline

Files

.gitignore

0 → 100644
+325 −0
Original line number Diff line number Diff line
/development/build/
node_modules/


development/temp/
development/log/
/application/source/server/web/node_modules/


##################### IDE / Tools ##


# @see https://github.com/github/gitignore/

# PHPUnit
.phpunit.result.cache

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.cache

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Cloud9 IDE - http://c9.io
.c9revisions
.c9

##Exclipse
.metadata
#bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
#local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Annotation Processing
.apt_generated/
.apt_generated_test/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project

##Kate
# Swap Files #
.*.kate-swp
.swp.*

## KDEDevelop
*.kdev4
.kdev4/

## LibreOffice
# LibreOffice locks
.~lock.*#


### LINUX
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

## Patches
*.orig
*.rej

# Private key
*.ppk

## Sublime
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# Workspace files are user-specific
*.sublime-workspace

# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project

# SFTP configuration file
sftp-config.json
sftp-config-alt*.json

# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache

# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings

## VIM
# Swap
[._]*.s[a-v][a-z]
!*.svg  # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# gitignore template for AWS Serverless Application Model project
# website: https://docs.aws.amazon.com/serverless-application-model

# Ignore build folder
.aws-sam/

# Netbeans
**/nbproject/private/
**/nbproject/Makefile-*.mk
**/nbproject/Package-*.bash
build/
nbbuild/
dist/
nbdist/
.nb-gradle/



# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

## GOLANG
go.work
Original line number Diff line number Diff line
@@ -3,7 +3,17 @@
  <component name="Go" enabled="true" />
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$" />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/application/source" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/application/source/command" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/application/source/config" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/application/source/server" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/application/source/server/web" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/application/source/server/web/app" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/application/source/utils" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/development/examples" type="java-resource" />
      <excludeFolder url="file://$MODULE_DIR$/development/build" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
  <configuration default="false" name="minerva serve" type="GoApplicationRunConfiguration" factoryName="Go Application">
    <module name="minerva" />
    <working_directory value="$PROJECT_DIR$/application/source" />
    <parameters value="serve --config=../../development/examples/theme1/config.yaml" />
    <parameters value="serve --config=../../development/examples/theme1/config.yaml --path=../../development/examples/theme1/" />
    <kind value="DIRECTORY" />
    <directory value="$PROJECT_DIR$/application/source" />
    <filePath value="$PROJECT_DIR$" />
Original line number Diff line number Diff line
@@ -30,4 +30,10 @@ func intiParser() {
		config.InitializeConfigFromFile(def.Config)
	}

	cfg := config.GetConfiguration()

	if def.Serve.Path != "" {
		cfg.Server.Path = def.Serve.Path
	}

}
Original line number Diff line number Diff line
@@ -5,24 +5,6 @@ type options struct {
	Version struct {
	} `command:"version"`
	Serve struct {
		Path string `short:"p" long:"path" description:"Path to the project files"`
	} `command:"serve"`
}

//// DebugLevel logs are typically voluminous, and are usually disabled in production.
// DebugLevel = zapcore.DebugLevel
//// InfoLevel is the default logging priority.
// InfoLevel = zapcore.InfoLevel
//// WarnLevel logs are more important than Info, but don't need individual
//// human review.
// WarnLevel = zapcore.WarnLevel
//// ErrorLevel logs are high-priority. If an application is running smoothly,
//// it shouldn't generate any error-level logs.
// ErrorLevel = zapcore.ErrorLevel
//// DPanicLevel logs are particularly important errors. In development the
//// logger panics after writing the message.
// DPanicLevel = zapcore.DPanicLevel
//// PanicLevel logs a message, then panics.
// PanicLevel = zapcore.PanicLevel
//// FatalLevel logs a message, then calls os.Exit(1).
// FatalLevel = zapcore.FatalLevel
// ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ func Do() {
		printVersion()

	case "serve":

		serve(active)

	}
Original line number Diff line number Diff line
package config

import (
	"github.com/creasty/defaults"
	"github.com/kelseyhightower/envconfig"
	"gitlab.schukai.com/oss/minerva/utils"
	"gopkg.in/yaml.v3"
@@ -8,24 +9,44 @@ import (
	"path"
)

func GetServerPort() string {
	return configuration.Server.Port
}

type Configuration struct {
	//LogLevel string `yaml:"logLevel" envconfig:"LOG_LEVEL"`

	Server struct {
		Port string `yaml:"Port" envconfig:"SERVER_PORT" default:"80"`
		Port int    `yaml:"Port" envconfig:"SERVER_PORT" default:"8080"`
		Path string `yaml:"Path" envconfig:"SERVER_PATH" default:""`
	} `yaml:"Server"`
}

// SetDefaults implements defaults.Setter interface
func (s *Configuration) SetDefaults() {
	if defaults.CanUpdate(s.Server.Path) {
		path, err := os.Getwd()
		if err != nil {
			utils.PrintErrorAndExit("something went wrong: %s", err.Error())
		}
		s.Server.Path = path
	}
}

	Paths struct {
		Web string `yaml:"Web" envconfig:"PATH_WEB" default:"/srv/web/"`
	} `yaml:"Paths"`
func GetServerPort() int {
	return configuration.Server.Port
}

func GetServerPath() string {
	return configuration.Server.Path
}

var configuration *Configuration

func newConfiguration() *Configuration {

	config := &Configuration{}
	if err := defaults.Set(config); err != nil {
		utils.PrintErrorAndExit("we have a problem: %s", err.Error())
	}

	return config
}

func GetConfiguration() *Configuration {

	if configuration == nil {
@@ -63,7 +84,7 @@ func intiConfiguration() {
		return
	}

	configuration = &Configuration{}
	configuration = newConfiguration()

}

@@ -98,10 +119,10 @@ func readFile(filename string) {
		}
	}()

	c := Configuration{}
	err = yaml.Unmarshal([]byte(data), &c)
	c := newConfiguration()
	err = yaml.Unmarshal([]byte(data), c)

	configuration = &c
	configuration = c

	if err != nil {
		utils.PrintErrorAndExit(err.Error())
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ require (
)

require (
	github.com/creasty/defaults v1.6.0 // indirect
	github.com/go-chi/chi/v5 v5.0.7 // indirect
	github.com/google/uuid v1.3.0 // indirect
	github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
Original line number Diff line number Diff line
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/creasty/defaults v1.6.0 h1:ltuE9cfphUtlrBeomuu8PEyISTXnxqkBIoQfXgv7BSc=
github.com/creasty/defaults v1.6.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+31 −0
Original line number Diff line number Diff line
package server

import (
	"github.com/go-chi/chi/v5"
	"github.com/go-chi/chi/v5/middleware"
	"net/http"
)

func appHandler() http.Handler {

	r := chi.NewRouter()
	r.Use(middleware.NoCache)

	r.Get("/editor", renderEditor)

	r.Handle("/web/node_modules/*",
		http.StripPrefix("/app", http.FileServer(http.FS(embeddedFiles))))

	//r.Get("/node_modules/*", serveNodeModules)

	//r.Route("/node_modules/*",  http.StripPrefix("/assets/",
	//	http.FileServer(http.Dir("assets/"))))
	//
	//http.Handle("/assets/", http.StripPrefix("/assets/",
	//	http.FileServer(http.Dir("assets/"))))

	//r.Post("/convert", doV1Convert)
	//r.Post("/create", doV1Create)

	return r
}
+49 −0
Original line number Diff line number Diff line
package server

import (
	"net/http"
)

func serveNodeModules(w http.ResponseWriter, r *http.Request) {

	content := lookUp(r.URL.Path)
	if content != nil {

		//w.Header().Add("Content-Type", "application/json")

		//mimeType := ""
		//
		//ext := filepath.Ext(r.URL.Path)
		//switch ext {
		//case ".htm", ".html":
		//	return "text/html"
		//case ".css":
		//	return "text/css"
		//case ".js":
		//	return "application/javascript"
		//
		//
		//
		//filetype := http.DetectContentType(content)
		//fmt.Println(filetype)

		w.Write(content)
		return
	}

	w.WriteHeader(404)

}

func renderEditor(w http.ResponseWriter, r *http.Request) {

	content, err := embeddedFiles.ReadFile("web/app/editor.html")
	if err != nil {
		logError("something went wrong: %s", err.Error())
		w.WriteHeader(500)
		return
	}

	w.Write(content)

}