2 Commits

Author SHA1 Message Date
Bel LaPointe
0a700f19c8 set /raw/ to cache 2024-01-09 15:04:51 -07:00
Bel LaPointe
5b645b1898 to gitea 2024-01-09 14:45:36 -07:00
43 changed files with 79 additions and 70 deletions

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
"gogs.inhome.blapointe.com/local/args"
"gitea.inhome.blapointe.com/local/args"
"log"
"os"
"path/filepath"

View File

@@ -1,4 +1,4 @@
#! /usr/gogs.inhome.blapointe.com/local/bin/python3
#! /usr/gitea.inhome.blapointe.com/local/bin/python3
def main(args) :
print("args", args)

View File

@@ -1,7 +1,7 @@
package filetree
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"testing"
)

View File

@@ -1,7 +1,7 @@
package filetree
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"testing"
)

View File

@@ -2,7 +2,7 @@ package filetree
import (
"fmt"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"path"
"strings"

View File

@@ -1,7 +1,7 @@
package filetree
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"testing"
)

10
go.mod
View File

@@ -1,15 +1,15 @@
module gogs.inhome.blapointe.com/local/notes-server
module gitea.inhome.blapointe.com/local/notes-server
go 1.16
require (
gitea.inhome.blapointe.com/local/args v0.0.0-20240109214601-658deda479a4
gitea.inhome.blapointe.com/local/gziphttp v0.0.0-20240109214739-0d639b0a9eb9
gitea.inhome.blapointe.com/local/oauth2 v0.0.0-20240109220403-8897142866f1
gitea.inhome.blapointe.com/local/router v0.0.0-20231109150317-e6b81bf7c23c
github.com/fairlyblank/md2min v0.0.0-20171213131418-39cd6e9904ac
github.com/gomarkdown/markdown v0.0.0-20220607163217-45f7c050e2d1
github.com/russross/blackfriday v1.6.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0
github.com/yuin/goldmark v1.3.4-0.20210326114109-75d8cce5b78c
gogs.inhome.blapointe.com/local/args v0.0.0-20230410154220-44370f257b34
gogs.inhome.blapointe.com/local/gziphttp v0.0.0-20230410171240-32da87640b26
gogs.inhome.blapointe.com/local/oauth2 v0.0.0-20230410162733-d39498ff8454
gogs.inhome.blapointe.com/local/router v0.0.0-20230410162418-08ccdc13df87
)

20
go.sum
View File

@@ -1,5 +1,15 @@
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
cloud.google.com/go v0.33.1/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
gitea.inhome.blapointe.com/local/args v0.0.0-20240109214601-658deda479a4 h1:4qBHjKAiEwRV1A1tN1JK6PsLV1+UwESXKrjGqfCCdNk=
gitea.inhome.blapointe.com/local/args v0.0.0-20240109214601-658deda479a4/go.mod h1:SqCOE3bE3wvrztVIQGHuyxHKfDjRKU9EWhBdkmkiwyc=
gitea.inhome.blapointe.com/local/gziphttp v0.0.0-20240109214739-0d639b0a9eb9 h1:Vq4jPYz6pCDMx7rxySw7SbKH3FHBywt1oS1TpXx4noM=
gitea.inhome.blapointe.com/local/gziphttp v0.0.0-20240109214739-0d639b0a9eb9/go.mod h1:YSOO/quInfKxfgqHH8exd71292hkLgqu2BO5oz6EATE=
gitea.inhome.blapointe.com/local/logb v0.0.0-20231109150430-1221d87a6dbc/go.mod h1:KwilawX4UgD4HxSJAVFEzkuckrnHeQrd49KwUX6GpYU=
gitea.inhome.blapointe.com/local/oauth2 v0.0.0-20240109220403-8897142866f1 h1:GO2/M+5a5i4FqiOnG6hq73nITDv2Rf8oTF973RsYQgo=
gitea.inhome.blapointe.com/local/oauth2 v0.0.0-20240109220403-8897142866f1/go.mod h1:XvS1/YJqCL+HoLo76dSLTjRYR+4Hfg4srhEVhMK3L8E=
gitea.inhome.blapointe.com/local/router v0.0.0-20231109150317-e6b81bf7c23c h1:+9kTZ3+ziuvmo+mC/xh/wVogFIAT1LeMzJMfSk0onsE=
gitea.inhome.blapointe.com/local/router v0.0.0-20231109150317-e6b81bf7c23c/go.mod h1:xYz/cn236KTBSWNQ9bqCyBmy8aQ7VL95pDDJmeupmN4=
gitea.inhome.blapointe.com/local/storage v0.0.0-20231109151605-736d446d407d/go.mod h1:TRK5z/XTT6jws++Q21Y8DQot+5vZGTNeHf+RjuY8aQk=
github.com/Azure/azure-pipeline-go v0.1.8/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg=
github.com/Azure/azure-storage-blob-go v0.0.0-20181023070848-cf01652132cc/go.mod h1:oGfmITT1V6x//CswqY2gtAHND+xIP64/qL7a5QJix0Y=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
@@ -148,16 +158,6 @@ github.com/yuin/goldmark v1.3.4-0.20210326114109-75d8cce5b78c h1:cPcogYxzMuZfHQk
github.com/yuin/goldmark v1.3.4-0.20210326114109-75d8cce5b78c/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yunify/qingstor-sdk-go v2.2.15+incompatible/go.mod h1:w6wqLDQ5bBTzxGJ55581UrSwLrsTAsdo9N6yX/8d9RY=
go.mongodb.org/mongo-driver v1.7.2/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8=
gogs.inhome.blapointe.com/local/args v0.0.0-20230410154220-44370f257b34 h1:0tuX5dfOksiOQD1vbJjVNVTVxTTIng7UrUdSLF5T+Ao=
gogs.inhome.blapointe.com/local/args v0.0.0-20230410154220-44370f257b34/go.mod h1:YG9n3Clg7683ohkVnJK2hdX8bBS9EojIsd1qPZumX0Y=
gogs.inhome.blapointe.com/local/gziphttp v0.0.0-20230410171240-32da87640b26 h1:zo9E05aBiyvtuuQiT3XjzBnpbm8+bVbzHe7soBQS0Tk=
gogs.inhome.blapointe.com/local/gziphttp v0.0.0-20230410171240-32da87640b26/go.mod h1:Sdj/NB9h3xrzPDqViQAHoDhA5gmpHkrWRXUauvLSA74=
gogs.inhome.blapointe.com/local/logb v0.0.0-20230410154319-880efa39d871/go.mod h1:E0pLNvMLzY0Kth1W078y+06z1AUyVMWnChMpRFf4w2Q=
gogs.inhome.blapointe.com/local/oauth2 v0.0.0-20230410162733-d39498ff8454 h1:U8gUhe9E97/uG3ne6D1VONCCVC6jjBbF1gDMKn3GCeo=
gogs.inhome.blapointe.com/local/oauth2 v0.0.0-20230410162733-d39498ff8454/go.mod h1:YDG4DAUbmKcQUDWdZAJyoUtX+N2zQIFQ0fz88lAPuiU=
gogs.inhome.blapointe.com/local/router v0.0.0-20230410162418-08ccdc13df87 h1:jlIDVPGFk42puv6NYzRkGFMhsZ0L1AHGRyx5ooGb4Ew=
gogs.inhome.blapointe.com/local/router v0.0.0-20230410162418-08ccdc13df87/go.mod h1:FCXhK6+lzJcxBsptnei6vw9pChuQvr4NtuosngjVJDk=
gogs.inhome.blapointe.com/local/storage v0.0.0-20230410162102-db39d7b02e29/go.mod h1:zk8Fe2Ezc2f6oOe2yllsbEhXqssUU1K2faoS0eQ9alY=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

View File

@@ -1,10 +1,10 @@
package main
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gogs.inhome.blapointe.com/local/notes-server/notes/editor"
"gogs.inhome.blapointe.com/local/notes-server/server"
"gogs.inhome.blapointe.com/local/notes-server/versions"
"gitea.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/notes/editor"
"gitea.inhome.blapointe.com/local/notes-server/server"
"gitea.inhome.blapointe.com/local/notes-server/versions"
"log"
"net/http"
"os"

View File

@@ -3,8 +3,8 @@ package main
import (
"fmt"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gogs.inhome.blapointe.com/local/notes-server/server"
"gitea.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/server"
"log"
"net/http"
"net/http/httptest"

View File

@@ -7,7 +7,7 @@ import (
"fmt"
"io"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"os"
"path"
"strings"

View File

@@ -3,7 +3,7 @@ package notes
import (
"bytes"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"path"
"strings"

View File

@@ -2,7 +2,7 @@ package notes
import (
"errors"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"path"
)

View File

@@ -1,7 +1,7 @@
package notes
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"testing"
)

View File

@@ -2,7 +2,7 @@ package notes
import (
"fmt"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"os"
)

View File

@@ -2,7 +2,7 @@ package notes
import (
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"path"
"testing"

View File

@@ -3,7 +3,7 @@ package notes
import (
"errors"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
)
func (n *Notes) Dir(urlPath string) (string, string, error) {

View File

@@ -1,7 +1,7 @@
package notes
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"testing"
)

View File

@@ -4,8 +4,8 @@ import (
"errors"
"fmt"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gogs.inhome.blapointe.com/local/notes-server/notes/editor"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/notes/editor"
"strings"
)

View File

@@ -1,7 +1,7 @@
package notes
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"strings"
"testing"
)

View File

@@ -7,8 +7,8 @@ import (
"fmt"
"io"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gogs.inhome.blapointe.com/local/notes-server/notes/md"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/notes/md"
"path"
"regexp"
"strings"

View File

@@ -3,7 +3,7 @@ package notes
import (
"fmt"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"path"
"strings"

View File

@@ -1,6 +1,6 @@
package notes
import "gogs.inhome.blapointe.com/local/notes-server/config"
import "gitea.inhome.blapointe.com/local/notes-server/config"
type Notes struct {
root string

View File

@@ -4,7 +4,7 @@ import (
"bufio"
"errors"
"io"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"log"
"os"
"path"

View File

@@ -45,7 +45,7 @@ func TestSearch(t *testing.T) {
func TestSearchBigFiles(t *testing.T) {
n := New()
n.root = "/usr/gogs.inhome.blapointe.com/local/bin"
n.root = "/usr/gitea.inhome.blapointe.com/local/bin"
_, err := n.Search("this file")
if err != nil {

View File

@@ -2,7 +2,7 @@ package notes
import (
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"os"
"path"
)

View File

@@ -2,7 +2,7 @@ package notes
import (
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"testing"
)

View File

@@ -3,7 +3,7 @@ package server
import (
"errors"
"io"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"net/http"
"os"
"path"

View File

@@ -2,7 +2,7 @@ package server
import (
"html"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"net/http"
"path"
"strconv"

View File

@@ -2,7 +2,7 @@ package server
import (
"fmt"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"net/http"
)

View File

@@ -2,7 +2,7 @@ package server
import (
"fmt"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"net/http"
)

View File

@@ -1,7 +1,7 @@
package server
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"net/http/httptest"
"regexp"
"strings"

View File

@@ -2,8 +2,8 @@ package server
import (
"fmt"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"net/http"
"path"
"regexp"

View File

@@ -5,8 +5,8 @@ import (
"net/http"
"os"
"gogs.inhome.blapointe.com/local/gziphttp"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/gziphttp"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
)
func (s *Server) raw(w http.ResponseWriter, r *http.Request) {

View File

@@ -2,12 +2,13 @@ package server
import (
"fmt"
"gogs.inhome.blapointe.com/local/gziphttp"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gogs.inhome.blapointe.com/local/router"
"net/http"
"path/filepath"
"strings"
"gitea.inhome.blapointe.com/local/gziphttp"
"gitea.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/router"
)
func (s *Server) Routes() error {
@@ -19,7 +20,7 @@ func (s *Server) Routes() error {
handler: s.root,
},
fmt.Sprintf("raw/%s%s", wildcard, wildcard): {
handler: s.gzip(s.authenticate(s.raw)),
handler: s.gzip(s.authenticate(s.cached(s.raw))),
},
fmt.Sprintf("notes/%s%s", wildcard, wildcard): {
handler: s.gzip(s.authenticate(s.notes)),

View File

@@ -3,7 +3,7 @@ package server
import (
"fmt"
"html"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"net/http"
)

View File

@@ -1,12 +1,13 @@
package server
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gogs.inhome.blapointe.com/local/notes-server/notes"
"gogs.inhome.blapointe.com/local/oauth2/oauth2client"
"gogs.inhome.blapointe.com/local/router"
"log"
"net/http"
"gitea.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/notes"
"gitea.inhome.blapointe.com/local/oauth2/oauth2client"
"gitea.inhome.blapointe.com/local/router"
)
type Server struct {
@@ -21,6 +22,13 @@ func New() *Server {
}
}
func (s *Server) cached(foo http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "private, max-age=7776000")
foo(w, r)
}
}
func (s *Server) authenticate(foo http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if config.OAuthServer != "" {

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
"html"
"gogs.inhome.blapointe.com/local/notes-server/filetree"
"gitea.inhome.blapointe.com/local/notes-server/filetree"
"net/http"
"path"
"strings"

View File

@@ -1,7 +1,7 @@
package versions
import (
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"time"
git "gopkg.in/src-d/go-git.v4"

View File

@@ -2,7 +2,7 @@ package versions
import (
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"path"
"testing"

View File

@@ -2,7 +2,7 @@ package versions
import (
"fmt"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"strings"
)

View File

@@ -3,7 +3,7 @@ package versions
import (
"fmt"
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"log"
"os"
"os/exec"

View File

@@ -2,7 +2,7 @@ package versions
import (
"io/ioutil"
"gogs.inhome.blapointe.com/local/notes-server/config"
"gitea.inhome.blapointe.com/local/notes-server/config"
"os"
"path"
"testing"