diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7ac156 --- /dev/null +++ b/.gitignore @@ -0,0 +1,183 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + + +###### VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +###### Linux +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +###### Mac +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +###### Windows +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7991595 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "apk"] + path = apk + url = git@github.com:Biu-X/TikTok-apk.git diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/TikTok.iml b/.idea/TikTok.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/TikTok.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..abbbaa8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ebe348a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Build X + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cdc75c --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# 第六届字节青训营后端大项目-抖音 + +## 一、背景 + 1.1 **项目介绍** +一句话介绍,实现极简版抖音。每一个应用都是从基础版本逐渐发展迭代过来的,希望同学们能通过实现一个极简版的抖音,来切实实践课程中学到的知识点,如 Go 语言编程,常用框架、数据库、对象存储等内容,同时对开发工作有更多的深入了解与认识,长远讲能对大家的个人技术成长或视野有启发。 diff --git a/TikTok.go b/TikTok.go new file mode 100644 index 0000000..d7ee49d --- /dev/null +++ b/TikTok.go @@ -0,0 +1,22 @@ +package main + +import ( + "hiif.ong/TikTok/cmd" + "log" + "os" +) + +const version = "v0.1" + +func main() { + app := cmd.NewApp() + app.Name = "TikTok" + app.Usage = "TikTok Server" + app.Description = "A TikTok Server Written in Go" + app.Version = version + + err := app.Run(os.Args) + if err != nil { + log.Printf("Failed to run with %s: %v\\n", os.Args, err) + } +} diff --git a/apk b/apk new file mode 160000 index 0000000..32c4888 --- /dev/null +++ b/apk @@ -0,0 +1 @@ +Subproject commit 32c4888175c7bb82e2e320b0298196140a558fb9 diff --git a/cmd/api.go b/cmd/api.go new file mode 100644 index 0000000..a03cfc5 --- /dev/null +++ b/cmd/api.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "github.com/urfave/cli/v2" +) + +// CmdApi api 子命令 +var CmdApi = &cli.Command{ + Name: "api", + Usage: "Start TikTok api server", + Description: `Star TikTok api server`, + Action: runApi, + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: "port", + Aliases: []string{"p"}, + Value: "3000", + Usage: "Temporary port number to prevent conflict", + }, + }, +} + +func runApi(ctx *cli.Context) error { + return nil +} diff --git a/cmd/cmd.go b/cmd/cmd.go new file mode 100644 index 0000000..791b7d3 --- /dev/null +++ b/cmd/cmd.go @@ -0,0 +1,16 @@ +package cmd + +import "github.com/urfave/cli/v2" + +func NewApp() *cli.App { + app := cli.NewApp() + app.EnableBashCompletion = true + + // 子命令集 + subCmdWithConfig := []*cli.Command{ + CmdApi, + } + + app.Commands = append(app.Commands, subCmdWithConfig...) + return app +} diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..2570dd4 --- /dev/null +++ b/docs/README.md @@ -0,0 +1 @@ +# 项目文档 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..424cfa9 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module hiif.ong/TikTok + +go 1.20 + +require github.com/urfave/cli/v2 v2.25.7 + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..54cdbc1 --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= diff --git a/models/db/db.go b/models/db/db.go new file mode 100644 index 0000000..3a49c63 --- /dev/null +++ b/models/db/db.go @@ -0,0 +1 @@ +package db diff --git a/models/user/user.go b/models/user/user.go new file mode 100644 index 0000000..a00006b --- /dev/null +++ b/models/user/user.go @@ -0,0 +1 @@ +package user diff --git a/modules/middleware/middleware.go b/modules/middleware/middleware.go new file mode 100644 index 0000000..c870d7c --- /dev/null +++ b/modules/middleware/middleware.go @@ -0,0 +1 @@ +package middleware diff --git a/routers/api/init.go b/routers/api/init.go new file mode 100644 index 0000000..778f64e --- /dev/null +++ b/routers/api/init.go @@ -0,0 +1 @@ +package api diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go new file mode 100644 index 0000000..b7b1f99 --- /dev/null +++ b/routers/api/v1/api.go @@ -0,0 +1 @@ +package v1 diff --git a/services/auth/auth.go b/services/auth/auth.go new file mode 100644 index 0000000..8832b06 --- /dev/null +++ b/services/auth/auth.go @@ -0,0 +1 @@ +package auth