Browse Source
- added example configuration - changed ID Length to uint instead of int - Added ShareX configuration generation in the frontenddependabot/npm_and_yarn/web/prismjs-1.21.0
11 changed files with 198 additions and 14 deletions
@ -0,0 +1,19 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"flag" |
|||
"io/ioutil" |
|||
"log" |
|||
|
|||
"github.com/maxibanki/golang-url-shortener/config" |
|||
"github.com/urakozz/go-json-schema-generator" |
|||
) |
|||
|
|||
func main() { |
|||
schemaPath := flag.String("path", "schema.json", "location of the converted schema") |
|||
flag.Parse() |
|||
schema := generator.Generate(&config.Configuration{}) |
|||
if err := ioutil.WriteFile(*schemaPath, []byte(schema), 644); err != nil { |
|||
log.Fatalf("could not write schema: %v", err) |
|||
} |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
{ |
|||
"$schema": "http://json-schema.org/schema#", |
|||
"type": "object", |
|||
"properties": { |
|||
"Handlers": { |
|||
"type": "object", |
|||
"properties": { |
|||
"BaseURL": { |
|||
"type": "string" |
|||
}, |
|||
"EnableGinDebugMode": { |
|||
"type": "boolean" |
|||
}, |
|||
"ListenAddr": { |
|||
"type": "string" |
|||
}, |
|||
"OAuth": { |
|||
"type": "object", |
|||
"properties": { |
|||
"Google": { |
|||
"type": "object", |
|||
"properties": { |
|||
"ClientID": { |
|||
"type": "string" |
|||
}, |
|||
"ClientSecret": { |
|||
"type": "string" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"Secret": { |
|||
"type": "string" |
|||
} |
|||
} |
|||
}, |
|||
"Store": { |
|||
"type": "object", |
|||
"properties": { |
|||
"DBPath": { |
|||
"type": "string" |
|||
}, |
|||
"ShortedIDLength": { |
|||
"type": "integer" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
{ |
|||
"$schema": "./build/schema.json", |
|||
"Store": { |
|||
"DBPath": "main.db", |
|||
"ShortedIDLength": 4 |
|||
}, |
|||
"Handlers": { |
|||
"ListenAddr": ":8080", |
|||
"BaseURL": "http://localhost:3000", |
|||
"EnableGinDebugMode": false, |
|||
"OAuth": { |
|||
"Google": { |
|||
"ClientID": "", |
|||
"ClientSecret": "" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
import React, { Component } from 'react' |
|||
import { Container } from 'semantic-ui-react' |
|||
import { Highlight } from 'react-fast-highlight'; |
|||
import ClipboardButton from 'react-clipboard.js'; |
|||
import 'highlight.js/styles/github.css' |
|||
|
|||
export default class ShareXComponent extends Component { |
|||
state = { |
|||
config: JSON.stringify({ |
|||
Name: "Golang URL Shortener", |
|||
DestinationType: "URLShortener", |
|||
RequestType: "POST", |
|||
RequestURL: window.location.origin + "/api/v1/protected/create", |
|||
Arguments: { |
|||
URL: "$input$" |
|||
}, |
|||
Headers: { |
|||
Authorization: window.localStorage.getItem('token') |
|||
}, |
|||
ResponseType: "Text", |
|||
URL: "$json:URL$" |
|||
}, null, 4) |
|||
} |
|||
|
|||
render() { |
|||
const { config } = this.state |
|||
return ( |
|||
<Container id='rootContainer' > |
|||
<div>ShareX</div> |
|||
<Highlight languages={['json']}> |
|||
{config} |
|||
</Highlight> |
|||
<ClipboardButton data-clipboard-text={config} className='ui button'> |
|||
Copy the configuration to the clipboard |
|||
</ClipboardButton> |
|||
</Container> |
|||
) |
|||
} |
|||
}; |
|||
Loading…
Reference in new issue