diff --git a/go.mod b/go.mod index 5b27f25d..d71245a7 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,8 @@ module github.com/kcoderhtml/hackatime go 1.23 require ( + codeberg.org/Codeberg/avatars v1.0.0 + github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b github.com/alexedwards/argon2id v1.0.0 github.com/alitto/pond v1.9.2 github.com/dchest/captcha v1.0.0 @@ -12,7 +14,9 @@ require ( github.com/getsentry/sentry-go v0.28.1 github.com/glebarez/sqlite v1.11.0 github.com/go-chi/chi/v5 v5.1.0 + github.com/go-chi/httprate v0.14.1 github.com/gofrs/uuid/v5 v5.3.0 + github.com/gorilla/schema v1.4.1 github.com/gorilla/securecookie v1.1.2 github.com/gorilla/sessions v1.4.0 github.com/hashicorp/golang-lru v1.0.2 @@ -38,6 +42,8 @@ require ( gorm.io/gorm v1.25.11 ) +require github.com/cespare/xxhash/v2 v2.3.0 // indirect + require ( filippo.io/edwards25519 v1.1.0 // indirect github.com/BurntSushi/toml v1.4.0 // indirect diff --git a/go.sum b/go.sum index 63e59b3f..43189623 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +codeberg.org/Codeberg/avatars v1.0.0 h1:MRx5QxuT/oVCcPvC5rXwgwWKD7hc6J0GnZ0Kl67lYEM= +codeberg.org/Codeberg/avatars v1.0.0/go.mod h1:ML/htpPRb3+owhkm4+qG2ZrXnk5WXaQLASOZ5GLCPi8= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= @@ -24,17 +26,24 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDm github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= +github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= +github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= +github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= github.com/alexedwards/argon2id v1.0.0 h1:wJzDx66hqWX7siL/SRUmgz3F8YMrd/nfX/xHHcQQP0w= github.com/alexedwards/argon2id v1.0.0/go.mod h1:tYKkqIjzXvZdzPvADMWOEZ+l6+BD6CtBXMj5fnJppiw= github.com/alitto/pond v1.9.2 h1:9Qb75z/scEZVCoSU+osVmQ0I0JOeLfdTDafrbcJ8CLs= github.com/alitto/pond v1.9.2/go.mod h1:xQn3P/sHTYcU/1BR3i86IGIrilcrGC2LiS+E2+CJWsI= github.com/becheran/wildmatch-go v1.0.0 h1:mE3dGGkTmpKtT4Z+88t8RStG40yN9T+kFEGj2PZFSzA= github.com/becheran/wildmatch-go v1.0.0/go.mod h1:gbMvj0NtVdJ15Mg/mH9uxk2R1QCistMyU7d9KFzroX4= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 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= @@ -59,6 +68,8 @@ github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GM github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/httprate v0.14.1 h1:EKZHYEZ58Cg6hWcYzoZILsv7ppb46Wt4uQ738IRtpZs= +github.com/go-chi/httprate v0.14.1/go.mod h1:TUepLXaz/pCjmCtf/obgOQJ2Sz6rC8fSf5cAt5cnTt0= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= @@ -94,6 +105,8 @@ github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwg github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E= +github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= @@ -128,6 +141,7 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kevinpollet/nego v0.0.0-20211010160919-a65cd48cee43 h1:Pdirg1gwhEcGjMLyuSxGn9664p+P8J9SrfMgpFwrDyg= github.com/kevinpollet/nego v0.0.0-20211010160919-a65cd48cee43/go.mod h1:ahLMuLCUyDdXqtqGyuwGev7/PGtO7r7ocvdwDuEN/3E= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -207,10 +221,12 @@ github.com/swaggo/http-swagger v1.3.4 h1:q7t/XLx0n15H1Q9/tk3Y9L4n210XzJF5WtnDX64 github.com/swaggo/http-swagger v1.3.4/go.mod h1:9dAh0unqMBAlbp1uE2Uc2mQTxNMU/ha4UbucIg1MFkQ= github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= @@ -224,6 +240,7 @@ golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/image v0.20.0 h1:7cVCUjQwfL18gyBJOmYvptfSHS8Fb3YUDtfLIZ7Nbpw= golang.org/x/image v0.20.0/go.mod h1:0a88To4CYVBAHp5FXJm8o7QbUl37Vd85ply1vyD8auM= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= @@ -232,6 +249,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -243,6 +261,7 @@ golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= @@ -251,6 +270,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -283,11 +303,14 @@ golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -310,6 +333,7 @@ gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg= gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ= modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= modernc.org/ccgo/v4 v4.20.7 h1:skrinQsjxWfvj6nbC3ztZPJy+NuwmB3hV9zX/pthNYQ= diff --git a/models/view/settings.go b/models/view/settings.go index de9f420b..9fa4b7b1 100644 --- a/models/view/settings.go +++ b/models/view/settings.go @@ -1,7 +1,7 @@ package view import ( - "github.com/kcoderhtml/hackatime/ + "time" "github.com/kcoderhtml/hackatime/models" ) diff --git a/routes/api/activity.go b/routes/api/activity.go index 97b1df61..37c0a008 100644 --- a/routes/api/activity.go +++ b/routes/api/activity.go @@ -3,12 +3,12 @@ package api import ( "net/http" "regexp" - "stri"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/" - "github.com/kcoderhtml/hackatime//middleware" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" + "strings" + "time" + + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" + conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models" diff --git a/routes/api/avatar.go b/routes/api/avatar.go index 49c24cbe..46b01dbc 100644 --- a/routes/api/avatar.go +++ b/routes/api/avatar.go @@ -5,8 +5,8 @@ import ( "time" "codeberg.org/Codeberg/avatars" - "gith"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime//middleware" + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" lru "github.com/hashicorp/golang-lru" conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/utils" diff --git a/routes/api/badge_test.go b/routes/api/badge_test.go index cf463085..ba68e901 100644 --- a/routes/api/badge_test.go +++ b/routes/api/badge_test.go @@ -2,10 +2,10 @@ package api import ( "io" - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ + "net/http" + "net/http/httptest" + "regexp" + "strings" "testing" "time" diff --git a/routes/api/diagnostics.go b/routes/api/diagnostics.go index e9f50f2c..28f25e66 100644 --- a/routes/api/diagnostics.go +++ b/routes/api/diagnostics.go @@ -3,11 +3,11 @@ package api import ( "encoding/json" "net/http" -"github.com/kcoderhtml/hackatime/ + "github.com/go-chi/chi/v5" "github.com/kcoderhtml/hackatime/helpers" -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ml/hackatime/config" + + conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/services" ) diff --git a/routes/api/heartbeat.go b/routes/api/heartbeat.go index 9825bab5..df5c8b98 100644 --- a/routes/api/heartbeat.go +++ b/routes/api/heartbeat.go @@ -3,17 +3,17 @@ package api import ( "net/http" - "github.com/kcoderhtml/hackatime/et/v2/condition" + "github.com/duke-git/lancet/v2/condition" "github.com/go-chi/chi/v5" "github.com/kcoderhtml/hackatime/helpers" -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ml/hackatime/config" - "github.com/kcode"github.com/kcoderhtml/hackatime/es" - customMiddl"github.com/kcoderhtml/hackatime/tml/hackatime/middlewares/custom" - "github.com/kcoderhtml/hackatime/oderhtml/hackatime/routes/utils" + + conf "github.com/kcoderhtml/hackatime/config" + "github.com/kcoderhtml/hackatime/middlewares" + customMiddleware "github.com/kcoderhtml/hackatime/middlewares/custom" + routeutils "github.com/kcoderhtml/hackatime/routes/utils" "github.com/kcoderhtml/hackatime/services" "github.com/kcoderhtml/hackatime/utils" -"github.com/kcoderhtml/hackatime/ + "github.com/kcoderhtml/hackatime/models" ) @@ -43,7 +43,7 @@ func (h *HeartbeatApiHandler) RegisterRoutes(router chi.Router) { middlewares.NewAuthenticateMiddleware(h.userSrvc).Handler, customMiddleware.NewWakatimeRelayMiddleware().Handler, ) - // see https://github.com/muety/wakapi/issues/203 + // see https://github.com/kcoderhtml/hackatime/issues/203 r.Post("/heartbeat", h.Post) r.Post("/heartbeats", h.Post) r.Post("/users/{user}/heartbeats", h.Post) diff --git a/routes/api/metrics.go b/routes/api/metrics.go index 7b44bc9a..1b918eb3 100644 --- a/routes/api/metrics.go +++ b/routes/api/metrics.go @@ -4,14 +4,14 @@ import ( "errors" "log/slog" "net/http" - "runt"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "gi"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" + "runtime" + "sort" + "sync" + "time" + + "github.com/alitto/pond" + "github.com/go-chi/chi/v5" + conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models" diff --git a/routes/compat/shields/v1/badge.go b/routes/compat/shields/v1/badge.go index b34c2d3e..18709f07 100644 --- a/routes/compat/shields/v1/badge.go +++ b/routes/compat/shields/v1/badge.go @@ -3,16 +3,16 @@ package v1 import ( "fmt" "net/http" - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com"github.com/kcoderhtml/hackatime/ + "time" + + "github.com/go-chi/chi/v5" "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/models/types" routeutils "github.com/kcoderhtml/hackatime/routes/utils" -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ml/hackatime/config" - "gi"github.com/kcoderhtml/hackatime/time/models" - "github.com/kcoderhtml/hackatime//hackatime/models/compat/shields/v1" + + conf "github.com/kcoderhtml/hackatime/config" + "github.com/kcoderhtml/hackatime/models" + v1 "github.com/kcoderhtml/hackatime/models/compat/shields/v1" "github.com/kcoderhtml/hackatime/services" "github.com/patrickmn/go-cache" ) diff --git a/routes/compat/wakatime/v1/all_time.go b/routes/compat/wakatime/v1/all_time.go index 3c9be8f9..d894a736 100644 --- a/routes/compat/wakatime/v1/all_time.go +++ b/routes/compat/wakatime/v1/all_time.go @@ -2,14 +2,14 @@ package v1 import ( "net/http" - "time"github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" - "gi"github.com/kcoderhtml/hackatime/time/helpers" + "time" + + "github.com/go-chi/chi/v5" + conf "github.com/kcoderhtml/hackatime/config" + "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/middlewares" - "github.com"github.com/kcoderhtml/hackatime/els" - "github.com/kcoderhtml/hackatime//hackatime/models/compat/wakatime/v1" + "github.com/kcoderhtml/hackatime/models" + v1 "github.com/kcoderhtml/hackatime/models/compat/wakatime/v1" "github.com/kcoderhtml/hackatime/models/types" routeutils "github.com/kcoderhtml/hackatime/routes/utils" "github.com/kcoderhtml/hackatime/services" diff --git a/routes/compat/wakatime/v1/leaders.go b/routes/compat/wakatime/v1/leaders.go index 127269af..bdd23113 100644 --- a/routes/compat/wakatime/v1/leaders.go +++ b/routes/compat/wakatime/v1/leaders.go @@ -3,18 +3,18 @@ package v1 import ( "math" "net/http" - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/et/v2/slice" + "strings" + "time" + + "github.com/duke-git/lancet/v2/slice" "github.com/go-chi/chi/v5" "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/utils" -"github.com/kcoderhtml/hackatime/ - con"github.com/kcoderhtml/hackatime/hackatime/config" - "github.com/kcoderhtml/hackatime//hackatime/models/compat/wakatime/v1" + + conf "github.com/kcoderhtml/hackatime/config" + v1 "github.com/kcoderhtml/hackatime/models/compat/wakatime/v1" "github.com/kcoderhtml/hackatime/services" ) diff --git a/routes/compat/wakatime/v1/projects.go b/routes/compat/wakatime/v1/projects.go index c89a208f..ad804f76 100644 --- a/routes/compat/wakatime/v1/projects.go +++ b/routes/compat/wakatime/v1/projects.go @@ -1,20 +1,20 @@ package v1 import ( - "github.com/kcoderhtml/hackatime/ + "net/http" "net/url" "strings" "time" "github.com/kcoderhtml/hackatime/models" - "github.com/kcoderhtml/hackatime/" + "github.com/go-chi/chi/v5" "github.com/kcoderhtml/hackatime/helpers" -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ml/hackatime/config" - "gi"github.com/kcoderhtml/hackatime/time/middlewares" - v1 "github."github.com/kcoderhtml/hackatime/models/compat/wakatime/v1" - "github.com/kcoderhtml/hackatime/oderhtml/hackatime/routes/utils" + + conf "github.com/kcoderhtml/hackatime/config" + "github.com/kcoderhtml/hackatime/middlewares" + v1 "github.com/kcoderhtml/hackatime/models/compat/wakatime/v1" + routeutils "github.com/kcoderhtml/hackatime/routes/utils" "github.com/kcoderhtml/hackatime/services" "github.com/kcoderhtml/hackatime/utils" ) diff --git a/routes/home.go b/routes/home.go index 6872e501..0e2bffd1 100644 --- a/routes/home.go +++ b/routes/home.go @@ -5,11 +5,11 @@ import ( "fmt" "net/http" "strconv" - "stri"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/a" + "strings" + "time" + + "github.com/go-chi/chi/v5" + "github.com/gorilla/schema" conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models/view" diff --git a/routes/home_test.go b/routes/home_test.go index 45d44f33..9fe7487e 100644 --- a/routes/home_test.go +++ b/routes/home_test.go @@ -2,10 +2,10 @@ package routes import ( "io" - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ + "net/http" + "net/http/httptest" + "os" + "strings" "testing" "github.com/go-chi/chi/v5" diff --git a/routes/imprint.go b/routes/imprint.go index 3e169178..e38ec05c 100644 --- a/routes/imprint.go +++ b/routes/imprint.go @@ -2,9 +2,9 @@ package routes import ( "net/http" -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" + + "github.com/go-chi/chi/v5" + conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/models/view" "github.com/kcoderhtml/hackatime/services" diff --git a/routes/login.go b/routes/login.go index 2fd17911..67b9b5a9 100644 --- a/routes/login.go +++ b/routes/login.go @@ -5,13 +5,13 @@ import ( "log/slog" "net/http" "net/url" - "stri"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/a" - "github.com"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/te" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" + "strings" + "time" + + "github.com/dchest/captcha" + "github.com/go-chi/chi/v5" + "github.com/go-chi/httprate" + conf "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/models/view" diff --git a/routes/projects.go b/routes/projects.go index 8c79f7d3..224c4c75 100644 --- a/routes/projects.go +++ b/routes/projects.go @@ -2,11 +2,11 @@ package routes import ( "net/http" - "time"github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" - "github.com"github.com/kcoderhtml/hackatime/dlewares" + "time" + + "github.com/go-chi/chi/v5" + conf "github.com/kcoderhtml/hackatime/config" + "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/models/view" routeutils "github.com/kcoderhtml/hackatime/routes/utils" diff --git a/routes/routes.go b/routes/routes.go index 55cb1d4a..e57aa7c4 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -2,12 +2,12 @@ package routes import ( "html/template" - "github.com/kcoderhtml/hackatime/ + "strings" "github.com/duke-git/lancet/v2/strutil" "github.com/kcoderhtml/hackatime/helpers" - "github.com/kcoderhtml/hackatime/et/v2/datetime" + "github.com/duke-git/lancet/v2/datetime" "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/utils" diff --git a/routes/settings.go b/routes/settings.go index c32462b9..f26c88d3 100644 --- a/routes/settings.go +++ b/routes/settings.go @@ -14,14 +14,14 @@ import ( "github.com/gofrs/uuid/v5" "log/slog" -"github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime//duke-git/lancet/v2/datastructure/set" - "github.com/kcoderhtml/hackatime/a" - "github.com/kcoderhtml/hackatime/ml/hackatime/config" - "github.com"github.com/kcoderhtml/hackatime/dlewares" + + datastructure "github.com/duke-git/lancet/v2/datastructure/set" + "github.com/gorilla/schema" + conf "github.com/kcoderhtml/hackatime/config" + "github.com/kcoderhtml/hackatime/middlewares" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/models/view" - "github.com/kcoderhtml/hackatime/oderhtml/hackatime/routes/utils" + routeutils "github.com/kcoderhtml/hackatime/routes/utils" "github.com/kcoderhtml/hackatime/services" "github.com/kcoderhtml/hackatime/services/imports" "github.com/kcoderhtml/hackatime/utils" diff --git a/routes/utils/badge_utils.go b/routes/utils/badge_utils.go index 55992e45..e0b372c4 100644 --- a/routes/utils/badge_utils.go +++ b/routes/utils/badge_utils.go @@ -2,8 +2,8 @@ package utils import ( "errors" - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ + "regexp" + "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/models" ) diff --git a/routes/utils/heartbeat_utils.go b/routes/utils/heartbeat_utils.go index 9fbb7535..bcafb4be 100644 --- a/routes/utils/heartbeat_utils.go +++ b/routes/utils/heartbeat_utils.go @@ -3,7 +3,7 @@ package utils import ( "bytes" "encoding/json" - "github.com/kcoderhtml/hackatime/ + "io" "net/http" "github.com/kcoderhtml/hackatime/models" diff --git a/routes/utils/summary_utils.go b/routes/utils/summary_utils.go index d4361bb4..fd685933 100644 --- a/routes/utils/summary_utils.go +++ b/routes/utils/summary_utils.go @@ -1,9 +1,9 @@ package utils import ( - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ -"github.com/kcoderhtml/hackatime/ + "net/http" + "strings" + "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/models" "github.com/kcoderhtml/hackatime/models/types" diff --git a/routes/utils/user_utils_test.go b/routes/utils/user_utils_test.go index c42761ac..19080f55 100644 --- a/routes/utils/user_utils_test.go +++ b/routes/utils/user_utils_test.go @@ -3,9 +3,9 @@ package utils import ( "context" "net/http" - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/ + "net/http/httptest" + "strings" + "testing" "github.com/go-chi/chi/v5" "github.com/kcoderhtml/hackatime/middlewares" diff --git a/services/activity.go b/services/activity.go index 82c76d2a..969cf463 100644 --- a/services/activity.go +++ b/services/activity.go @@ -9,10 +9,10 @@ import ( "sync" "time" - "github.com/kcoderhtml/hackatime/svgo/float" - "github.com/kcoderhtml/hackatime/ - "github.com/kcoderhtml/hackatime/et/v2/condition" - "github.com/kcoderhtml/hackatime/et/v2/datetime" + svg "github.com/ajstarks/svgo/float" + "github.com/alitto/pond" + "github.com/duke-git/lancet/v2/condition" + "github.com/duke-git/lancet/v2/datetime" "github.com/kcoderhtml/hackatime/config" "github.com/kcoderhtml/hackatime/helpers" "github.com/kcoderhtml/hackatime/models" diff --git a/services/aggregation.go b/services/aggregation.go index d9d3c5eb..49f2f750 100644 --- a/services/aggregation.go +++ b/services/aggregation.go @@ -4,12 +4,12 @@ import ( "errors" "log/slog" "sync" - "github.com/kcoderhtml/hackatime/ + "time" datastructure "github.com/duke-git/lancet/v2/datastructure/set" "github.com/kcoderhtml/hackatime/config" "github.com/muety/artifex/v2" -"github.com/kcoderhtml/hackatime/ + "github.com/kcoderhtml/hackatime/models" )