This commit is contained in:
commit
c3c19c3da0
21
.editorconfig
Normal file
21
.editorconfig
Normal file
@ -0,0 +1,21 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
eclint_indent_style = unset
|
||||
|
||||
[Dockerfile]
|
||||
indent_size = 4
|
54
.gitea/workflows/build-image.yaml
Normal file
54
.gitea/workflows/build-image.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
name: BuildImage
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
# tags:
|
||||
# - '*'
|
||||
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# 使用这个镜像,不然Docker无法打包镜像
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
steps:
|
||||
- name: Setup Golang
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '>=1.21.0'
|
||||
cache: false
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Gen Tags
|
||||
id: gen_tags
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: gitee.ltd/lxh/go-wxhelper
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
|
||||
- name: Print Tags
|
||||
run: |
|
||||
echo "${{ steps.gen_tags.outputs.tags }}"
|
||||
echo "----------------- labels -----------------"
|
||||
echo "${{ steps.meta.outputs.labels }}"
|
||||
|
||||
- name: Login to Repository
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: gitee.ltd
|
||||
username: ${{ secrets.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ steps.gen_tags.outputs.tags }}
|
||||
labels: ${{ steps.gen_tags.outputs.labels }}
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.idea
|
||||
vendor
|
||||
logs
|
||||
*.exe
|
||||
*.pprof
|
||||
cache
|
||||
log
|
||||
dist
|
||||
*.log
|
||||
blacklist.txt
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM golang:alpine as builder
|
||||
WORKDIR /builder
|
||||
COPY . .
|
||||
|
||||
#ENV GO111MODULE=on
|
||||
#ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN go version
|
||||
RUN go mod download && go build -o app
|
||||
RUN ls -lh && chmod -R +x ./*
|
||||
|
||||
FROM code.hyxc1.com/open/alpine:3.16.0 as runner
|
||||
LABEL org.opencontainers.image.authors="lxh@cxh.cn"
|
||||
|
||||
EXPOSE 1234
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /builder/app ./app
|
||||
COPY --from=builder /builder/views ./views
|
||||
COPY --from=builder /builder/assets ./assets
|
||||
CMD ./app
|
14
api/pages.go
Normal file
14
api/pages.go
Normal file
@ -0,0 +1,14 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// PageNotFound
|
||||
// @description: 404页面
|
||||
// @param ctx
|
||||
func PageNotFound(ctx *gin.Context) {
|
||||
// 渲染页面
|
||||
ctx.HTML(http.StatusOK, "404.html", nil)
|
||||
}
|
37
api/redirect.go
Normal file
37
api/redirect.go
Normal file
@ -0,0 +1,37 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"github.com/gin-gonic/gin"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// Redirect
|
||||
// @description: 重定向
|
||||
// @param ctx
|
||||
func Redirect(ctx *gin.Context) {
|
||||
// 取出base64之后的目的地字段
|
||||
s := ctx.Query("s")
|
||||
if s == "" {
|
||||
ctx.Redirect(http.StatusNotFound, "/404.html")
|
||||
return
|
||||
}
|
||||
// base64解码
|
||||
decodeBytes, err := base64.StdEncoding.DecodeString(s)
|
||||
if err != nil {
|
||||
log.Printf("base64解码失败: %s", err.Error())
|
||||
ctx.Redirect(http.StatusNotFound, "/404.html")
|
||||
return
|
||||
}
|
||||
log.Printf("重定向到: %s", string(decodeBytes))
|
||||
if _, err = url.Parse(string(decodeBytes)); err != nil {
|
||||
log.Printf("url解析失败: %s", err.Error())
|
||||
ctx.Redirect(http.StatusNotFound, "/404.html")
|
||||
return
|
||||
}
|
||||
ctx.HTML(http.StatusOK, "redirect.html", gin.H{
|
||||
"url": string(decodeBytes),
|
||||
})
|
||||
}
|
429
assets/css/404.css
Normal file
429
assets/css/404.css
Normal file
@ -0,0 +1,429 @@
|
||||
body {
|
||||
background-color: #FF7F2E;
|
||||
font-family: "Concert One", cursive;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*/////////////////// rules */
|
||||
/*/////////////////// scene */
|
||||
.text {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: rgba(19, 36, 44, 0.1);
|
||||
font-size: 30em;
|
||||
text-align: center;
|
||||
top: 40%;
|
||||
}
|
||||
|
||||
.container {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
height: 300px;
|
||||
width: 500px;
|
||||
}
|
||||
.container:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
background-color: rgba(19, 36, 44, 0.1);
|
||||
border-radius: 12px;
|
||||
bottom: 40px;
|
||||
height: 12px;
|
||||
left: 80px;
|
||||
width: 350px;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/*/////////////////// caveman */
|
||||
.caveman {
|
||||
height: 300px;
|
||||
position: absolute;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.caveman:nth-child(1) {
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.caveman:nth-child(2) {
|
||||
left: 20px;
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
.head {
|
||||
position: absolute;
|
||||
background-color: #13242C;
|
||||
border-radius: 50px;
|
||||
height: 140px;
|
||||
left: 60px;
|
||||
top: 25px;
|
||||
width: 65px;
|
||||
}
|
||||
.head:after, .head:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
background-color: #13242C;
|
||||
border-radius: 10px;
|
||||
height: 20px;
|
||||
width: 7px;
|
||||
}
|
||||
.head:after {
|
||||
left: 35px;
|
||||
top: -8px;
|
||||
transform: rotate(20deg);
|
||||
}
|
||||
.head:before {
|
||||
left: 30px;
|
||||
top: -8px;
|
||||
transform: rotate(-20deg);
|
||||
}
|
||||
.head .eye {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
transform: translateX(-50%);
|
||||
background-color: #EAB08C;
|
||||
border-radius: 50px;
|
||||
height: 16px;
|
||||
left: 45%;
|
||||
top: 40px;
|
||||
width: 48px;
|
||||
}
|
||||
.head .eye:after, .head .eye:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background-color: #13242C;
|
||||
border-radius: 50%;
|
||||
height: 5px;
|
||||
width: 5px;
|
||||
}
|
||||
.head .eye:after {
|
||||
left: 5px;
|
||||
}
|
||||
.head .eye:before {
|
||||
right: 9px;
|
||||
}
|
||||
.head .eye .nose {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: #D9766C;
|
||||
border-left: 8px solid rgba(19, 36, 44, 0.1);
|
||||
border-radius: 10px;
|
||||
box-sizing: border-box;
|
||||
height: 35px;
|
||||
left: 45%;
|
||||
top: 12px;
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
.shape {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
transform: translateX(-50%);
|
||||
border-radius: 50%;
|
||||
height: 140px;
|
||||
overflow: hidden;
|
||||
top: 70px;
|
||||
width: 140px;
|
||||
}
|
||||
.shape .circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
}
|
||||
.shape .circle:after, .shape .circle:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
.shape .circle:after {
|
||||
left: 50px;
|
||||
top: 10px;
|
||||
}
|
||||
.shape .circle:before {
|
||||
left: 60px;
|
||||
top: 45px;
|
||||
}
|
||||
.shape .circle:nth-child(1) {
|
||||
left: -12px;
|
||||
top: 80px;
|
||||
}
|
||||
.shape .circle:nth-child(2) {
|
||||
right: 10px;
|
||||
top: 0px;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.shape .circle:nth-child(2):after {
|
||||
left: 65px;
|
||||
top: 10px;
|
||||
}
|
||||
.shape .circle:nth-child(2):before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.caveman:nth-child(1) .shape {
|
||||
background-color: #D13433;
|
||||
}
|
||||
.caveman:nth-child(1) .shape .circle {
|
||||
background-color: #932422;
|
||||
}
|
||||
.caveman:nth-child(1) .shape .circle:after, .caveman:nth-child(1) .shape .circle:before {
|
||||
background-color: #932422;
|
||||
}
|
||||
|
||||
.caveman:nth-child(2) .shape {
|
||||
background-color: #932422;
|
||||
}
|
||||
.caveman:nth-child(2) .shape .circle {
|
||||
background-color: #D13433;
|
||||
}
|
||||
.caveman:nth-child(2) .shape .circle:after, .caveman:nth-child(2) .shape .circle:before {
|
||||
background-color: #D13433;
|
||||
}
|
||||
|
||||
.arm-right {
|
||||
position: absolute;
|
||||
background-color: #EAB08C;
|
||||
border-left: 8px solid rgba(19, 36, 44, 0.1);
|
||||
border-radius: 50px;
|
||||
box-sizing: border-box;
|
||||
height: 180px;
|
||||
left: 135px;
|
||||
top: 80px;
|
||||
transform-origin: 30px 30px;
|
||||
width: 60px;
|
||||
z-index: 1;
|
||||
}
|
||||
.arm-right .club {
|
||||
position: absolute;
|
||||
border-bottom: 110px solid #601513;
|
||||
border-left: 10px solid transparent;
|
||||
border-right: 10px solid transparent;
|
||||
height: 0;
|
||||
left: -60px;
|
||||
top: 120px;
|
||||
transform: rotate(70deg);
|
||||
width: 20px;
|
||||
}
|
||||
.arm-right .club:after, .arm-right .club:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
background-color: #601513;
|
||||
border-radius: 50%;
|
||||
left: 0;
|
||||
}
|
||||
.arm-right .club:after {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
top: -10px;
|
||||
}
|
||||
.arm-right .club:before {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
left: -10px;
|
||||
top: 90px;
|
||||
}
|
||||
|
||||
.leg {
|
||||
position: absolute;
|
||||
border-radius: 10px;
|
||||
height: 55px;
|
||||
top: 200px;
|
||||
width: 10px;
|
||||
}
|
||||
.leg:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
border-radius: 50%;
|
||||
height: 10px;
|
||||
left: -5px;
|
||||
top: 15px;
|
||||
width: 10px;
|
||||
}
|
||||
.leg .foot {
|
||||
position: absolute;
|
||||
border-radius: 25px 25px 0 0;
|
||||
height: 25px;
|
||||
left: -38px;
|
||||
top: 30px;
|
||||
width: 50px;
|
||||
}
|
||||
.leg .foot:after, .leg .foot:before, .leg .foot .fingers, .leg .foot .fingers:after {
|
||||
position: absolute;
|
||||
background-color: #EAB08C;
|
||||
border-radius: 50%;
|
||||
bottom: 0px;
|
||||
height: 15px;
|
||||
transform-origin: bottom;
|
||||
width: 15px;
|
||||
}
|
||||
.leg .foot:after {
|
||||
left: -6px;
|
||||
content: "";
|
||||
}
|
||||
.leg .foot:before {
|
||||
left: 8px;
|
||||
transform: scale(0.6);
|
||||
content: "";
|
||||
}
|
||||
.leg .foot .fingers {
|
||||
left: 15px;
|
||||
transform: scale(0.6);
|
||||
}
|
||||
.leg .foot .fingers:after {
|
||||
left: 11px;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.leg:nth-child(1) {
|
||||
background-color: #B2524D;
|
||||
left: 95px;
|
||||
}
|
||||
.leg:nth-child(1):after {
|
||||
background-color: #B2524D;
|
||||
}
|
||||
.leg:nth-child(1) .foot {
|
||||
background-color: #B2524D;
|
||||
}
|
||||
.leg:nth-child(1) .foot:after {
|
||||
background-color: #B2524D;
|
||||
}
|
||||
.leg:nth-child(1) .foot:before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.leg:nth-child(2) {
|
||||
background-color: #D9766C;
|
||||
left: 115px;
|
||||
}
|
||||
.leg:nth-child(2):after {
|
||||
background-color: #D9766C;
|
||||
}
|
||||
.leg:nth-child(2) .foot {
|
||||
background-color: #D9766C;
|
||||
}
|
||||
|
||||
/*/////////////////// animation */
|
||||
.caveman:nth-child(1) .arm-right {
|
||||
animation: arm-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
}
|
||||
|
||||
.caveman:nth-child(2) .arm-right {
|
||||
animation: arm-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
|
||||
@keyframes arm-anima {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(-360deg);
|
||||
}
|
||||
}
|
||||
.caveman:nth-child(2) .head {
|
||||
animation: head-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
}
|
||||
|
||||
.caveman:nth-child(1) .head {
|
||||
animation: head-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
|
||||
@keyframes head-anima {
|
||||
0% {
|
||||
top: 25px;
|
||||
}
|
||||
42% {
|
||||
top: 25px;
|
||||
}
|
||||
45% {
|
||||
top: 50px;
|
||||
}
|
||||
100% {
|
||||
top: 25px;
|
||||
}
|
||||
}
|
||||
.caveman:nth-child(2) .eye:after,
|
||||
.caveman:nth-child(2) .eye:before {
|
||||
animation: eye-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
}
|
||||
|
||||
.caveman:nth-child(1) .eye:after,
|
||||
.caveman:nth-child(1) .eye:before {
|
||||
animation: eye-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
|
||||
@keyframes eye-anima {
|
||||
0% {
|
||||
height: 5px;
|
||||
}
|
||||
42% {
|
||||
height: 5px;
|
||||
}
|
||||
45% {
|
||||
height: 1px;
|
||||
}
|
||||
100% {
|
||||
height: 5px;
|
||||
}
|
||||
}
|
||||
.container:after {
|
||||
animation: shadow-anima 1.2s infinite cubic-bezier(0.55, 0.01, 0.16, 1.34);
|
||||
animation-delay: 0.1s;
|
||||
}
|
||||
|
||||
@keyframes shadow-anima {
|
||||
0% {
|
||||
width: 350px;
|
||||
left: 80px;
|
||||
}
|
||||
25% {
|
||||
width: 450px;
|
||||
left: 80px;
|
||||
}
|
||||
50% {
|
||||
width: 350px;
|
||||
left: 80px;
|
||||
}
|
||||
75% {
|
||||
width: 450px;
|
||||
left: 0px;
|
||||
}
|
||||
100% {
|
||||
width: 350px;
|
||||
left: 80px;
|
||||
}
|
||||
}
|
||||
/*/////////////////////// credit ////*/
|
||||
#link {
|
||||
bottom: 20px;
|
||||
color: #000;
|
||||
opacity: 0.2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
#link p {
|
||||
margin: 0;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#link:hover {
|
||||
opacity: 1;
|
||||
}
|
1
assets/js/404.js
Normal file
1
assets/js/404.js
Normal file
@ -0,0 +1 @@
|
||||
// no JS this time !
|
34
go.mod
Normal file
34
go.mod
Normal file
@ -0,0 +1,34 @@
|
||||
module redirect
|
||||
|
||||
go 1.23.0
|
||||
|
||||
require github.com/gin-gonic/gin v1.10.0
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.23.0 // indirect
|
||||
golang.org/x/net v0.25.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/text v0.15.0 // indirect
|
||||
google.golang.org/protobuf v1.34.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
89
go.sum
Normal file
89
go.sum
Normal file
@ -0,0 +1,89 @@
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
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=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
27
main.go
Normal file
27
main.go
Normal file
@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"redirect/api"
|
||||
)
|
||||
|
||||
// main
|
||||
// @description: 入口函数
|
||||
func main() {
|
||||
eng := gin.Default()
|
||||
|
||||
// 加载静态页面
|
||||
eng.LoadHTMLGlob("views/*.html")
|
||||
|
||||
// 404返回数据
|
||||
eng.NoRoute(func(ctx *gin.Context) {
|
||||
// 404直接跳转到首页
|
||||
ctx.Redirect(302, "/404.html")
|
||||
})
|
||||
|
||||
eng.GET("", api.Redirect)
|
||||
eng.GET("/404.html", api.PageNotFound)
|
||||
eng.Static("/assets", "./assets")
|
||||
|
||||
_ = eng.Run(":1234")
|
||||
}
|
78
views/404.html
Normal file
78
views/404.html
Normal file
@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>看起来你好像迷路了~</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Concert+One" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/404.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<div class="text">
|
||||
<p>404</p>
|
||||
</div>
|
||||
<div class="container">
|
||||
<!-- caveman left -->
|
||||
<div class="caveman">
|
||||
<div class="leg">
|
||||
<div class="foot">
|
||||
<div class="fingers"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="leg">
|
||||
<div class="foot">
|
||||
<div class="fingers"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shape">
|
||||
<div class="circle"></div>
|
||||
<div class="circle"></div>
|
||||
</div>
|
||||
<div class="head">
|
||||
<div class="eye">
|
||||
<div class="nose"></div>
|
||||
</div>
|
||||
<div class="mouth"></div>
|
||||
</div>
|
||||
<div class="arm-right">
|
||||
<div class="club"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- caveman right -->
|
||||
<div class="caveman">
|
||||
<div class="leg">
|
||||
<div class="foot">
|
||||
<div class="fingers"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="leg">
|
||||
<div class="foot">
|
||||
<div class="fingers"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="shape">
|
||||
<div class="circle"></div>
|
||||
<div class="circle"></div>
|
||||
</div>
|
||||
<div class="head">
|
||||
<div class="eye">
|
||||
<div class="nose"></div>
|
||||
</div>
|
||||
<div class="mouth"></div>
|
||||
</div>
|
||||
<div class="arm-right">
|
||||
<div class="club"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //////////////// CREDIT //////////////// -->
|
||||
<!-- partial -->
|
||||
<script src='https://use.fontawesome.com/releases/v5.0.7/js/all.js'></script>
|
||||
<script src="assets/js/404.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
16
views/redirect.html
Normal file
16
views/redirect.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>呀呼</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>即将打开,如果提示非微信官方网页,点击继续访问或者复制页面地址到浏览器打开</h1>
|
||||
|
||||
<script>
|
||||
setTimeout(function () {
|
||||
window.location.href = "{{ .url }}";
|
||||
}, 2000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user