Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0892fc4c0 | ||
|
|
c1e365fdfd | ||
|
|
e6e6d2aa54 | ||
|
|
ac70cd4c9d | ||
|
|
600030b528 | ||
|
|
4e1537b4f0 | ||
|
|
8a8aac945d | ||
|
|
89be748dee | ||
|
|
6c35fe9ded | ||
|
|
9ea6e8d981 |
No files matched your search
@@ -30,23 +30,25 @@ jobs:
|
||||
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
|
||||
- name: Docker Image Cache
|
||||
id: docker-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ env.CACHE_DIR }}
|
||||
key: docker-image-go-cross-${{ env.GO_VERSION }}
|
||||
# disable cache because the err `no space left on device`
|
||||
# - name: Docker Image Cache
|
||||
# id: docker-cache
|
||||
# uses: actions/cache@v3
|
||||
# with:
|
||||
# path: ${{ env.CACHE_DIR }}
|
||||
# key: docker-image-go-cross-${{ env.GO_VERSION }}
|
||||
|
||||
- name: Pull Docker Image
|
||||
if: steps.docker-cache.outputs.cache-hit != 'true'
|
||||
# if: steps.docker-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
docker pull "${DOCKER_IMG}:v${GO_VERSION}"
|
||||
mkdir -p "${CACHE_DIR}"
|
||||
docker save -o "${CACHE_DIR}/go-cross.tar" "${DOCKER_IMG}:v${GO_VERSION}"
|
||||
|
||||
- name: Restore Docker Image from Cache
|
||||
if: steps.docker-cache.outputs.cache-hit == 'true'
|
||||
run: docker load -i ${CACHE_DIR}/go-cross.tar
|
||||
# mkdir -p "${CACHE_DIR}"
|
||||
# docker save -o "${CACHE_DIR}/go-cross.tar" "${DOCKER_IMG}:v${GO_VERSION}"
|
||||
|
||||
# - name: Restore Docker Image from Cache
|
||||
# if: steps.docker-cache.outputs.cache-hit == 'true'
|
||||
# run: docker load -i ${CACHE_DIR}/go-cross.tar
|
||||
|
||||
- name: Setup git-chglog
|
||||
run: |
|
||||
|
||||
Vendored
+2
-2
@@ -8,7 +8,7 @@
|
||||
"mode": "exec",
|
||||
"program": "${workspaceFolder}/bin/artalk",
|
||||
"preLaunchTask": "Build for debugging",
|
||||
"args": ["server", "-c", "${workspaceFolder}/local/local.yml"]
|
||||
"args": ["server", "-c", "${workspaceFolder}/data/artalk.yml"]
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,27 @@
|
||||
|
||||
## [v2.6.2](https://github.com/ArtalkJS/Artalk/compare/v2.6.1...v2.6.2) (2023-09-12)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cmd:** remove app instance creation when mini boot ([#577](https://github.com/ArtalkJS/Artalk/issues/577))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **style:** modify `z-index` less than 5 ([#578](https://github.com/ArtalkJS/Artalk/issues/578))
|
||||
|
||||
|
||||
## [v2.6.1](https://github.com/ArtalkJS/Artalk/compare/v2.6.0...v2.6.1) (2023-09-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **captcha:** image captcha base64 response issue ([#575](https://github.com/ArtalkJS/Artalk/issues/575))
|
||||
|
||||
### Documentation
|
||||
|
||||
* **config:** add info about env variables ([#566](https://github.com/ArtalkJS/Artalk/issues/566))
|
||||
* **extras:** add deploy guide for railway.app ([#567](https://github.com/ArtalkJS/Artalk/issues/567))
|
||||
|
||||
|
||||
## [v2.6.0](https://github.com/ArtalkJS/Artalk/compare/v2.5.5...v2.6.0) (2023-09-01)
|
||||
|
||||
### Features
|
||||
|
||||
+3
-3
@@ -50,12 +50,12 @@ If you want to run a demo site, you can use the following command:
|
||||
./scripts/setup-example-site.sh
|
||||
```
|
||||
|
||||
This script sets up a local example site for testing at `local` folder, with Artalk integrated into its theme.
|
||||
This script sets up a local example site for testing at `data` folder, with Artalk integrated into its theme.
|
||||
|
||||
After running this script, run:
|
||||
|
||||
```sh
|
||||
./bin/artalk server -c ./local/local.yml
|
||||
./bin/artalk server -c ./data/artalk.yml
|
||||
```
|
||||
|
||||
to start the artalk server.
|
||||
@@ -80,7 +80,7 @@ Artalk is a monorepo project, which means all the source code is in the same rep
|
||||
- `docs/` - The documentation site source code.
|
||||
- `i18n/` - The translation files.
|
||||
- `internal/` - The internal packages.
|
||||
- `local/` - The local example site. This directory is ignored by git.
|
||||
- `data/` - The local data. This directory is ignored by git.
|
||||
- `public/` - The static files. Built frontend files will be copied here.
|
||||
- `scripts/` - The scripts for development.
|
||||
- `server/` - The source code for the server.
|
||||
|
||||
@@ -1,165 +1,21 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Copyright (c) 2018-present, qwqcode and other contributors
|
||||
|
||||
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:
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
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.
|
||||
+1
-1
@@ -131,7 +131,7 @@ Thanks for the help and feedback provided by the community, if you have good sug
|
||||
|
||||
## License
|
||||
|
||||
[LGPL-3.0](./LICENSE)
|
||||
[MIT](./LICENSE)
|
||||
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2FArtalkJS%2FArtalk?ref=badge_shield)
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ see [CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
[LGPL-3.0](./LICENSE)
|
||||
[MIT](./LICENSE)
|
||||
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2FArtalkJS%2FArtalk?ref=badge_shield)
|
||||
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/ArtalkJS/Artalk/internal/entity"
|
||||
"github.com/ArtalkJS/Artalk/internal/i18n"
|
||||
"github.com/ArtalkJS/Artalk/internal/log"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
func NewAdminCommand(app *core.App) *cobra.Command {
|
||||
func NewAdminCommand(app *ArtalkCmd) *cobra.Command {
|
||||
adminCmd := &cobra.Command{
|
||||
Use: "admin",
|
||||
Short: "Create or edit an administrator account",
|
||||
|
||||
+34
-25
@@ -62,23 +62,17 @@ func New() *ArtalkCmd {
|
||||
}
|
||||
|
||||
cmd.RootCmd.SetVersionTemplate("Artalk ({{printf \"%s\" .Version}})\n")
|
||||
cmd.eagerParseFlags() // parse base flags
|
||||
|
||||
// 切换工作目录
|
||||
// Parse base flags
|
||||
cmd.eagerParseFlags()
|
||||
|
||||
// Change work directory
|
||||
if cmd.workDir != "" {
|
||||
if err := os.Chdir(cmd.workDir); err != nil {
|
||||
log.Fatal("Working directory change error: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
// initialize app instance
|
||||
config, err := getConfig(cmd.cfgFile)
|
||||
if err != nil {
|
||||
log.Fatal("Config fail: ", err)
|
||||
}
|
||||
|
||||
cmd.App = core.NewApp(config)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -99,7 +93,17 @@ func (atk *ArtalkCmd) addCommand(cmd *cobra.Command) {
|
||||
// APP Bootstrap
|
||||
// ================
|
||||
if cmd.Annotations[BootModeKey] != string(MODE_MINI_BOOT) {
|
||||
if err := atk.Bootstrap(); err != nil {
|
||||
// Load config
|
||||
config, err := getConfig(atk.cfgFile)
|
||||
if err != nil {
|
||||
log.Fatal("Config fail: ", err)
|
||||
}
|
||||
|
||||
// Create new instance
|
||||
atk.App = core.NewApp(config)
|
||||
|
||||
// Bootstrap APP
|
||||
if err := atk.App.Bootstrap(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -113,14 +117,14 @@ func (atk *ArtalkCmd) addCommand(cmd *cobra.Command) {
|
||||
}
|
||||
|
||||
func (atk *ArtalkCmd) mountCommands() {
|
||||
atk.addCommand(NewServeCommand(atk.App))
|
||||
atk.addCommand(NewAdminCommand(atk.App))
|
||||
atk.addCommand(NewExportCommand(atk.App))
|
||||
atk.addCommand(NewImportCommand(atk.App))
|
||||
atk.addCommand(NewConfigCommand(atk.App))
|
||||
atk.addCommand(NewGenCommand(atk.App))
|
||||
atk.addCommand(NewUpgradeCommand(atk.App))
|
||||
atk.addCommand(NewVersionCommand(atk.App))
|
||||
atk.addCommand(NewServeCommand(atk))
|
||||
atk.addCommand(NewAdminCommand(atk))
|
||||
atk.addCommand(NewExportCommand(atk))
|
||||
atk.addCommand(NewImportCommand(atk))
|
||||
atk.addCommand(NewConfigCommand())
|
||||
atk.addCommand(NewGenCommand())
|
||||
atk.addCommand(NewUpgradeCommand())
|
||||
atk.addCommand(NewVersionCommand())
|
||||
}
|
||||
|
||||
func (atk *ArtalkCmd) Launch() error {
|
||||
@@ -156,24 +160,29 @@ func (atk *ArtalkCmd) Launch() error {
|
||||
// ===================
|
||||
// 3. App Cleanups
|
||||
// ===================
|
||||
return atk.OnTerminate().Trigger(&core.TerminateEvent{
|
||||
App: atk.App,
|
||||
})
|
||||
if atk.App != nil {
|
||||
return atk.App.OnTerminate().Trigger(&core.TerminateEvent{
|
||||
App: atk.App,
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取配置
|
||||
// Create new config instance by specific config filename
|
||||
func getConfig(cfgFile string) (*config.Config, error) {
|
||||
// 尝试查找配置文件
|
||||
// Retrieve config file by default names when specific filename is empty
|
||||
if cfgFile == "" {
|
||||
cfgFile = config.RetrieveConfigFile()
|
||||
}
|
||||
|
||||
// 自动生成新配置文件
|
||||
// Generate new config file when retrieve failed
|
||||
if cfgFile == "" {
|
||||
cfgFile = config.CONF_DEFAULT_FILENAMES[0]
|
||||
core.Gen("config", cfgFile, false)
|
||||
}
|
||||
|
||||
// Create new config instance and return
|
||||
return config.NewFromFile(cfgFile)
|
||||
}
|
||||
|
||||
|
||||
+13
-3
@@ -4,16 +4,26 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/ArtalkJS/Artalk/internal/log"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewConfigCommand(app *core.App) *cobra.Command {
|
||||
func NewConfigCommand() *cobra.Command {
|
||||
configCmd := &cobra.Command{
|
||||
Use: "config",
|
||||
Short: "Output Config Information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
buf, _ := json.MarshalIndent(app.Conf(), "", " ")
|
||||
// Get config filename from cmd flags
|
||||
filename, _ := cmd.Flags().GetString("config")
|
||||
|
||||
// Get new config instance
|
||||
config, err := getConfig(filename)
|
||||
if err != nil {
|
||||
log.Fatal("Config fail: ", err)
|
||||
}
|
||||
|
||||
// Output JSON of config
|
||||
buf, _ := json.MarshalIndent(config, "", " ")
|
||||
fmt.Println(string(buf))
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
|
||||
+1
-2
@@ -8,14 +8,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/artransfer"
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/ArtalkJS/Artalk/internal/i18n"
|
||||
"github.com/ArtalkJS/Artalk/internal/log"
|
||||
"github.com/ArtalkJS/Artalk/internal/utils"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewExportCommand(app *core.App) *cobra.Command {
|
||||
func NewExportCommand(app *ArtalkCmd) *cobra.Command {
|
||||
exportCmd := &cobra.Command{
|
||||
Use: "export",
|
||||
Aliases: []string{},
|
||||
|
||||
+1
-8
@@ -5,20 +5,13 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewGenCommand(app *core.App) *cobra.Command {
|
||||
func NewGenCommand() *cobra.Command {
|
||||
genCmd := &cobra.Command{
|
||||
Use: "gen <TYPE> <DEST>",
|
||||
Short: "A collection of several useful generators",
|
||||
Long: "Generate some content\ne.g. `artalk gen config ./artalk.yml`",
|
||||
Args: cobra.RangeArgs(1, 2),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// change working directory
|
||||
// if workDir != "" {
|
||||
// if err := os.Chdir(workDir); err != nil {
|
||||
// log.Fatal("change working directory error ", err)
|
||||
// }
|
||||
// }
|
||||
|
||||
var (
|
||||
specificPath string
|
||||
isForce bool
|
||||
|
||||
+1
-2
@@ -5,13 +5,12 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/artransfer"
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/ArtalkJS/Artalk/internal/i18n"
|
||||
"github.com/ArtalkJS/Artalk/internal/log"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewImportCommand(app *core.App) *cobra.Command {
|
||||
func NewImportCommand(app *ArtalkCmd) *cobra.Command {
|
||||
importCmd := &cobra.Command{
|
||||
Use: "import <FILENAME>",
|
||||
Aliases: []string{},
|
||||
|
||||
+2
-3
@@ -3,14 +3,13 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/ArtalkJS/Artalk/internal/log"
|
||||
"github.com/ArtalkJS/Artalk/server"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewServeCommand(app *core.App) *cobra.Command {
|
||||
func NewServeCommand(app *ArtalkCmd) *cobra.Command {
|
||||
var serverCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Aliases: []string{"serve"},
|
||||
@@ -22,7 +21,7 @@ func NewServeCommand(app *core.App) *cobra.Command {
|
||||
fmt.Print("-------------------------------\n\n")
|
||||
|
||||
// init fiber app
|
||||
_, err := server.Serve(app)
|
||||
_, err := server.Serve(app.App)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
+7
-9
@@ -6,7 +6,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/config"
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/ArtalkJS/Artalk/internal/i18n"
|
||||
"github.com/ArtalkJS/Artalk/internal/log"
|
||||
"github.com/blang/semver"
|
||||
@@ -14,7 +13,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewUpgradeCommand(app *core.App) *cobra.Command {
|
||||
func NewUpgradeCommand() *cobra.Command {
|
||||
upgradeCmd := &cobra.Command{
|
||||
Use: "upgrade",
|
||||
Aliases: []string{"update"},
|
||||
@@ -22,8 +21,6 @@ func NewUpgradeCommand(app *core.App) *cobra.Command {
|
||||
Long: "Upgrade Artalk to the latest version, \n update source is GitHub Releases, \n update need to restart Artalk to take effect.",
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// core.LoadConfOnly(cfgFile, workDir)
|
||||
|
||||
log.Info(i18n.T("Checking for updates") + "...")
|
||||
|
||||
latest, found, err := selfupdate.DetectLatest("ArtalkJS/Artalk")
|
||||
@@ -53,11 +50,12 @@ func NewUpgradeCommand(app *core.App) *cobra.Command {
|
||||
}
|
||||
|
||||
log.Println(i18n.T("Update complete"))
|
||||
fmt.Println("\n-------------------------------\n v" +
|
||||
latest.Version.String() +
|
||||
" Release Note\n" +
|
||||
"-------------------------------\n\n" +
|
||||
latest.ReleaseNotes)
|
||||
fmt.Printf("\n"+
|
||||
"-------------------------------\n"+
|
||||
" v%s Release Note\n"+
|
||||
"-------------------------------\n\n"+
|
||||
"%s\n",
|
||||
latest.Version.String(), latest.ReleaseNotes)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
BootModeKey: MODE_MINI_BOOT,
|
||||
|
||||
+1
-2
@@ -3,11 +3,10 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ArtalkJS/Artalk/internal/core"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewVersionCommand(app *core.App) *cobra.Command {
|
||||
func NewVersionCommand() *cobra.Command {
|
||||
versionCmd := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Output version information",
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"latest": "2.6.0"
|
||||
"latest": "2.6.2"
|
||||
}
|
||||
@@ -12,6 +12,25 @@ Artalk 默认以工作目录下的 `artalk.yml` 作为配置文件,可使用
|
||||
artalk -c ./conf.yml
|
||||
```
|
||||
|
||||
## 通过环境变量配置
|
||||
|
||||
Artalk 读取以 `ATK_` 为前缀的环境变量,并且全部大写,子节点用单个下划线表示,配置名含下划线请用双下划线表示:
|
||||
|
||||
- `_` (单下划线) 转为 `.` 表示子节点
|
||||
- `__` (双下划线) 转为 `_` 表示配置名的下划线
|
||||
|
||||
e.g.
|
||||
|
||||
```bash
|
||||
ATK_TIMEZONE -> timezone
|
||||
ATK_LOGIN__TIMEOUT -> login_timeout
|
||||
ATK_SITE__DEFAULT -> site_default
|
||||
ATK_DB_TYPE -> db.type
|
||||
ATK_DB_TABLE__PREFIX -> db.table_prefix
|
||||
ATK_CACHE_REDIS_USERNAME -> cache.redis.username
|
||||
ATK_ADMIN_USERS_0_NAME -> admin_users[0].name
|
||||
```
|
||||
|
||||
## 获取模版配置文件
|
||||
|
||||
可参考一份「完整的配置文件」:[artalk.example.zh-CN.yml](https://github.com/ArtalkJS/Artalk/blob/master/conf/artalk.example.zh-CN.yml)
|
||||
|
||||
@@ -13,6 +13,7 @@ Artalk 离不开社区的支持与帮助,**是你们让 Artalk 走得更远!
|
||||
- [宝塔安装过程大概记录 (By @xiamuguizhi)](https://github.com/ArtalkJS/Artalk/discussions/46)
|
||||
- [Vuepress配置评论插件为Artalk](https://wiki.eryajf.net/pages/b74c2b/)
|
||||
- [Fly.io 部署 Artalk 评论系统](https://wayjam.me/posts/artalk-deploy-on-flyio/)
|
||||
- [Railway.app 部署 Artalk 评论系统](https://blog.moraxyc.com/post/eidb8276/)
|
||||
|
||||
更多新版读物正在撰写当中(
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ Artalk 社区是包容开放的社区,我们欢迎不同水平的人员帮助
|
||||
|
||||
“More action, less talk”,Artalk 社区不欢迎无意义的争论,我们希望社区成员和谐共处、为社区发展出谋划策。在提出问题前,你应当读过《[提问的智慧](https://lug.ustc.edu.cn/wiki/doc/smart-questions/)》,这可能决定了你最终是否能得到有用的回答。在表达观点前,你应当具备基本的礼仪,比如保持平和的态度、使用得体的语言,切忌恶语相向、冷嘲热讽、不尊重他人信仰和立场等。
|
||||
|
||||
我们作为开源精神的推崇者以及实践者,希望我们所创造的自由软件,都应该被自由的使用,自由的研究,自由的更改和自由的分享。本项目前后端代码使用第 3 版 GNU 宽通用公共许可证([GNU Lesser General Public License V3](https://www.gnu.org/licenses/lgpl-3.0.html))开源,文档请遵循知识共享许可协议 ([Creative Commons License](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh))。
|
||||
我们作为开源精神的推崇者以及实践者,希望我们所创造的自由软件,都应该被自由的使用,自由的研究,自由的更改和自由的分享。本项目前后端代码使用 [MIT](https://github.com/ArtalkJS/Artalk/blob/master/LICENSE) 协议开源,文档请遵循知识共享许可协议 ([Creative Commons License](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh))。
|
||||
::: tip 立即为社区贡献力量?
|
||||
|
||||
- 浏览开发者资料([开发文档](../develop/index.md) / [CONTRIBUTING.md](https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md))
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# with Artalk integrated.
|
||||
# Build frontend and backend before running this script.
|
||||
# After running this script, run:
|
||||
# ./bin/artalk server -c ./local/local.yml
|
||||
# ./bin/artalk server -c ./data/artalk.yml
|
||||
# to start the comment server.
|
||||
# And open http://localhost:1313/ in your browser to view the example site.
|
||||
#
|
||||
@@ -25,35 +25,35 @@ if ! [ -f "./public/dist/Artalk.css" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p ./local
|
||||
mkdir -p ./data
|
||||
|
||||
# copy internal/query/testdata/example_site_conf.yml to ./local/local.yml if it does not exist
|
||||
if ! [ -f "./local/artalk.yml" ]; then
|
||||
echo "Copying internal/query/testdata/example_site_conf.yml to ./local/artalk.yml"
|
||||
cp ./internal/query/testdata/example_site_conf.yml ./local/local.yml
|
||||
# copy test/testdata/example_site_conf.yml to ./data/artalk.yml if it does not exist
|
||||
if ! [ -f "./data/artalk.yml" ]; then
|
||||
echo "Copying test/testdata/example_site_conf.yml to ./data/artalk.yml"
|
||||
cp ./test/testdata/example_site_conf.yml ./data/artalk.yml
|
||||
fi
|
||||
|
||||
# clean up local/example_site if it exists
|
||||
if [ -d "./local/example_site" ]; then
|
||||
echo "Cleaning up local/example_site"
|
||||
rm -rfd ./local/example_site
|
||||
# clean up data/example_site if it exists
|
||||
if [ -d "./data/example_site" ]; then
|
||||
echo "Cleaning up data/example_site"
|
||||
rm -rfd ./data/example_site
|
||||
fi
|
||||
|
||||
echo "Setting up local/example_site"
|
||||
echo "Setting up data/example_site"
|
||||
# create a new example site
|
||||
hugo new site ./local/example_site
|
||||
hugo new site ./data/example_site
|
||||
|
||||
# copy the theme to the example site
|
||||
theme_repo="https://github.com/ph-ph/chalk"
|
||||
theme_dir="./local/example_site/themes/chalk"
|
||||
theme_dir="./data/example_site/themes/chalk"
|
||||
echo "Cloning theme from ${theme_repo} to ${theme_dir}"
|
||||
git clone ${theme_repo} ${theme_dir}
|
||||
|
||||
|
||||
# create comment partial
|
||||
echo "Creating comment partial in local/example_site"
|
||||
mkdir -p ./local/example_site/layouts/partials/comments
|
||||
cat << EOF > ./local/example_site/layouts/partials/comments/comments.html
|
||||
echo "Creating comment partial in data/example_site"
|
||||
mkdir -p ./data/example_site/layouts/partials/comments
|
||||
cat << EOF > ./data/example_site/layouts/partials/comments/comments.html
|
||||
<link href="/lib/artalk/Artalk.css" rel="stylesheet">
|
||||
<script src="/lib/artalk/Artalk.js"></script>
|
||||
|
||||
@@ -72,12 +72,12 @@ cat << EOF > ./local/example_site/layouts/partials/comments/comments.html
|
||||
EOF
|
||||
|
||||
# patch ${single_template}, insert code before last </article> tag
|
||||
single_template=local/example_site/themes/chalk/layouts/_default/single.html
|
||||
single_template=data/example_site/themes/chalk/layouts/_default/single.html
|
||||
echo "Patching ${single_template}"
|
||||
sed -i '/<\/article>/i {{ partial "comments/comments.html" . }}' ./${single_template}
|
||||
|
||||
# update the example site config
|
||||
cat << EOF > ./local/example_site/config.toml
|
||||
cat << EOF > ./data/example_site/config.toml
|
||||
baseURL = 'http://example.org/'
|
||||
languageCode = 'en-us'
|
||||
title = 'My New Hugo Site'
|
||||
@@ -100,14 +100,14 @@ EOF
|
||||
|
||||
# copy ./public/dist/Artalk.css/js to /lib/artalk/Artalk.css/js
|
||||
echo "Copying ./public/dist/Artalk.css/js to /lib/artalk/Artalk.css/js"
|
||||
mkdir -p ./local/example_site/static/lib/artalk
|
||||
cp ./public/dist/Artalk.css ./local/example_site/static/lib/artalk/Artalk.css
|
||||
cp ./public/dist/Artalk.js ./local/example_site/static/lib/artalk/Artalk.js
|
||||
mkdir -p ./data/example_site/static/lib/artalk
|
||||
cp ./public/dist/Artalk.css ./data/example_site/static/lib/artalk/Artalk.css
|
||||
cp ./public/dist/Artalk.js ./data/example_site/static/lib/artalk/Artalk.js
|
||||
|
||||
# create a post in the example site
|
||||
echo "Creating a post in local/example_site"
|
||||
mkdir -p ./local/example_site/content/posts
|
||||
cat << EOF > ./local/example_site/content/posts/my-first-post.md
|
||||
echo "Creating a post in data/example_site"
|
||||
mkdir -p ./data/example_site/content/posts
|
||||
cat << EOF > ./data/example_site/content/posts/my-first-post.md
|
||||
---
|
||||
title: "My First Post"
|
||||
---
|
||||
@@ -172,7 +172,7 @@ EOF
|
||||
|
||||
|
||||
# run the example site
|
||||
echo "Running local/example_site"
|
||||
pushd ./local/example_site
|
||||
echo "Running data/example_site"
|
||||
pushd ./data/example_site
|
||||
hugo server
|
||||
popd
|
||||
@@ -64,7 +64,7 @@ func captchaGet(app *core.App) func(c *fiber.Ctx) error {
|
||||
switch cap.Type() {
|
||||
case captcha.Image:
|
||||
return common.RespData(c, common.Map{
|
||||
"img_data": got,
|
||||
"img_data": string(got),
|
||||
})
|
||||
|
||||
case captcha.IFrame:
|
||||
@@ -128,7 +128,7 @@ func captchaCheck(app *core.App) func(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
return common.RespError(c, i18n.T("Wrong captcha"), common.Map{
|
||||
"img_data": img,
|
||||
"img_data": string(img),
|
||||
})
|
||||
}
|
||||
case captcha.IFrame:
|
||||
|
||||
@@ -70,7 +70,7 @@ func ActionLimitMiddleware(app *core.App, conf ActionLimitConf) fiber.Handler {
|
||||
case captcha.Image:
|
||||
// 图片验证码
|
||||
img, _ := cap.Get()
|
||||
respData["img_data"] = img
|
||||
respData["img_data"] = string(img)
|
||||
case captcha.IFrame:
|
||||
// iFrame 验证模式
|
||||
respData["iframe"] = true
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import (
|
||||
// @Contact.url https://artalk.js.org
|
||||
// @Contact.email artalkjs@gmail.com
|
||||
|
||||
// @License.name LGPL-3.0
|
||||
// @License.name MIT
|
||||
// @License.url https://github.com/ArtalkJS/Artalk/blob/master/LICENSE
|
||||
|
||||
// @SecurityDefinitions.apikey ApiKeyAuth
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@artalk/artalk-sidebar",
|
||||
"version": "1.0.2",
|
||||
"license": "LGPL-3.0",
|
||||
"license": "MIT",
|
||||
"description": "The sidebar of artalk",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -24,4 +24,4 @@ Please make sure to read the [Contributing Guide](https://github.com/ArtalkJS/Ar
|
||||
|
||||
## License
|
||||
|
||||
[LGPL-3.0](https://github.com/ArtalkJS/Artalk/blob/master/LICENSE)
|
||||
[MIT](https://github.com/ArtalkJS/Artalk/blob/master/LICENSE)
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "artalk",
|
||||
"version": "2.6.0",
|
||||
"license": "LGPL-3.0",
|
||||
"version": "2.6.2",
|
||||
"license": "MIT",
|
||||
"description": "A Selfhosted Comment System",
|
||||
"keywords": [
|
||||
"comment-system",
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
}
|
||||
|
||||
.atk-height-limit-btn {
|
||||
z-index: 10;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 10px;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
.atk-main-editor {
|
||||
$editor-padding: 10px;
|
||||
z-index: 5;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: var(--at-color-bg);
|
||||
@@ -180,7 +179,7 @@
|
||||
}
|
||||
|
||||
& > .atk-notify-wrap {
|
||||
z-index: 9;
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
right: -2px;
|
||||
bottom: 40px;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
.atk-dropdown {
|
||||
z-index: 888;
|
||||
z-index: 3;
|
||||
display: none;
|
||||
height: auto !important;
|
||||
max-height: calc(100vh - 2.7rem);
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: var(--at-color-bg);
|
||||
z-index: 10;
|
||||
z-index: 4;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-flow: column;
|
||||
@@ -144,7 +144,6 @@
|
||||
/* Loading */
|
||||
.atk-loading {
|
||||
@extend .atk-full-layer;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
.atk-loading-spinner {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@artalk/plugin-katex",
|
||||
"version": "0.1.5",
|
||||
"license": "LGPL-3.0",
|
||||
"license": "MIT",
|
||||
"description": "The katex plugin for artalk",
|
||||
"main": "./dist/artalk-plugin-katex.js",
|
||||
"module": "./dist/artalk-plugin-katex.es.js",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@artalk/plugin-lightbox",
|
||||
"version": "0.1.1",
|
||||
"license": "LGPL-3.0",
|
||||
"license": "MIT",
|
||||
"description": "The image lightbox plugin for artalk",
|
||||
"main": "./dist/artalk-plugin-lightbox.js",
|
||||
"module": "./dist/artalk-plugin-lightbox.es.js",
|
||||
|
||||
Reference in new issue
Block a user