Christopher Ramey 5 месяцев назад
Родитель
Сommit
2574262ced
8 измененных файлов: 19 добавлений и 19 удалений
  1. +4
    -4
      backup.go
  2. +2
    -2
      load.go
  3. +2
    -2
      main.go
  4. +1
    -1
      obj/qurl.go
  5. +3
    -3
      pages/root.go
  6. +5
    -5
      pages/static.go
  7. +1
    -1
      storage/bolt/bolt.go
  8. +1
    -1
      storage/storage.go

+ 4
- 4
backup.go Просмотреть файл

@@ -1,14 +1,14 @@
package main

import (
"git.binarythought.com/cdramey/qurl/storage"
"time"
"fmt"
"path"
"git.binarythought.com/cdramey/qurl/storage"
"os"
"path"
"time"
)

func manageBackup(stor storage.Storage, dir string, interval int){
func manageBackup(stor storage.Storage, dir string, interval int) {
for {
time.Sleep(time.Duration(interval) * time.Second)
fname := fmt.Sprintf("qurl-%s.backup",


+ 2
- 2
load.go Просмотреть файл

@@ -3,10 +3,10 @@ package main
import (
"encoding/json"
"fmt"
"git.binarythought.com/cdramey/qurl/obj"
"git.binarythought.com/cdramey/qurl/storage"
"net"
"os"
"git.binarythought.com/cdramey/qurl/storage"
"git.binarythought.com/cdramey/qurl/obj"
"time"
)



+ 2
- 2
main.go Просмотреть файл

@@ -3,11 +3,11 @@ package main
import (
"flag"
"fmt"
"git.binarythought.com/cdramey/qurl/pages"
"git.binarythought.com/cdramey/qurl/storage"
"net"
"net/http"
"os"
"git.binarythought.com/cdramey/qurl/pages"
"git.binarythought.com/cdramey/qurl/storage"
)

//go:generate go run ./togo -n Favicon_ico -i assets/favicon.ico -p static -o static/favicon_ico.go


+ 1
- 1
obj/qurl.go Просмотреть файл

@@ -2,9 +2,9 @@ package obj

import (
"fmt"
"net/url"
"strings"
"time"
"net/url"
)

type QURL struct {


+ 3
- 3
pages/root.go Просмотреть файл

@@ -2,11 +2,11 @@ package pages

import (
"fmt"
"html/template"
"net/http"
"git.binarythought.com/cdramey/qurl/obj"
"git.binarythought.com/cdramey/qurl/static"
"git.binarythought.com/cdramey/qurl/storage"
"git.binarythought.com/cdramey/qurl/obj"
"html/template"
"net/http"
)

type RootHandler struct {


+ 5
- 5
pages/static.go Просмотреть файл

@@ -10,11 +10,11 @@ import (
)

type StaticContent struct {
Type string
Content []byte
ETag string
Type string
Content []byte
ETag string
GZIPContent []byte
GZIPETag string
GZIPETag string
}

func (sc *StaticContent) Init() {
@@ -40,7 +40,7 @@ func (sc *StaticContent) Init() {

// Using gzip encoding adds a minimum of 24 characters to the HTTP
// header, so only accept gzip encoding if we save that much or more
if (buf.Len()+24) < len(sc.Content) {
if (buf.Len() + 24) < len(sc.Content) {
sc.GZIPContent = buf.Bytes()
sc.GZIPETag = fmt.Sprintf("%x", md5.Sum(sc.GZIPContent))
}


+ 1
- 1
storage/bolt/bolt.go Просмотреть файл

@@ -3,8 +3,8 @@ package bolt
import (
bolt "go.etcd.io/bbolt"
"net/url"
"time"
"os"
"time"
)

type BoltStorage struct {


+ 1
- 1
storage/storage.go Просмотреть файл

@@ -2,9 +2,9 @@ package storage

import (
"fmt"
"net/url"
"git.binarythought.com/cdramey/qurl/obj"
"git.binarythought.com/cdramey/qurl/storage/bolt"
"net/url"
"strings"
)



Загрузка…
Отмена
Сохранить