mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-12-23 21:14:41 +00:00
Compare commits
7 Commits
v0.4.2-alp
...
v0.4.2-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5def3e5856 | ||
|
|
c768260b1b | ||
|
|
46e146e633 | ||
|
|
1a2f917b30 | ||
|
|
86adfbaef8 | ||
|
|
143af78745 | ||
|
|
7b07f22685 |
2
.github/workflows/demo.yml
vendored
2
.github/workflows/demo.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get old instance and snapshot name, create new instance name
|
- name: Get old instance and snapshot name, create new instance name
|
||||||
run: |
|
run: |
|
||||||
echo "OLD_INSTANCE_SNAPSHOT_NAME=$(aws lightsail get-instance-snapshots | grep '"name": "casaos-0.3.6-1666150291' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
|
echo "OLD_INSTANCE_SNAPSHOT_NAME=$(aws lightsail get-instance-snapshots | grep '"name": "updateto_to_0.4.1-1676285322' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
|
||||||
echo "OLD_INSTANCE_NAME=$(aws lightsail get-instances | grep '"name": "CasaOS-Demo-[0-9]' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
|
echo "OLD_INSTANCE_NAME=$(aws lightsail get-instances | grep '"name": "CasaOS-Demo-[0-9]' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
|
||||||
echo "NEW_INSTANCE_NAME=CasaOS-Demo-$(date +%s)" >> $GITHUB_ENV
|
echo "NEW_INSTANCE_NAME=CasaOS-Demo-$(date +%s)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
|||||||
23
CHANGELOG.md
23
CHANGELOG.md
@@ -17,6 +17,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Security
|
### Security
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.2]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- [App] Increase the display of progress during the installation process
|
||||||
|
- [App] Label whether the current app supports x86 or Pi devices
|
||||||
|
- [App] Support single app version upgrade
|
||||||
|
- [File] Support mounting of Google Drive and Dropbox cloud drives
|
||||||
|
- [System] Support Mint Linux
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- [File] Optimize the download speed of a single file
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- [Share] Fix the samba permission issue
|
||||||
|
- [Disk] Fix the problem of disk mount point plus 1 after upgrade ([#770](https://github.com/IceWhaleTech/CasaOS/issues/770))
|
||||||
|
- [File] Fix the problem of file permission change caused by modifying files in casaos ([#829](https://github.com/IceWhaleTech/CasaOS/issues/829))
|
||||||
|
- [Share] Fix the problem of files being deleted due to samba uninstallation failure ([#843](https://github.com/IceWhaleTech/CasaOS/issues/843))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.4.1] - 2023-1-19
|
## [0.4.1] - 2023-1-19
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
128
CODE_OF_CONDUCT.md
Normal file
128
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
wiki@casaos.io.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
|
https://www.contributor-covenant.org/translations.
|
||||||
@@ -17,12 +17,14 @@ type MountList struct {
|
|||||||
MountPoint string `json:"MountPoint"`
|
MountPoint string `json:"MountPoint"`
|
||||||
Fs string `json:"Fs"`
|
Fs string `json:"Fs"`
|
||||||
Icon string `json:"Icon"`
|
Icon string `json:"Icon"`
|
||||||
|
Name string `json:"Name"`
|
||||||
} `json:"mountPoints"`
|
} `json:"mountPoints"`
|
||||||
}
|
}
|
||||||
type MountPoint struct {
|
type MountPoint struct {
|
||||||
MountPoint string `json:"mount_point"`
|
MountPoint string `json:"mount_point"`
|
||||||
Fs string `json:"fs"`
|
Fs string `json:"fs"`
|
||||||
Icon string `json:"icon"`
|
Icon string `json:"icon"`
|
||||||
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
type MountResult struct {
|
type MountResult struct {
|
||||||
Error string `json:"error"`
|
Error string `json:"error"`
|
||||||
@@ -77,6 +79,7 @@ func Mount(mountPoint string, fs string) error {
|
|||||||
res, err := NewRestyClient().R().SetFormData(map[string]string{
|
res, err := NewRestyClient().R().SetFormData(map[string]string{
|
||||||
"mountPoint": mountPoint,
|
"mountPoint": mountPoint,
|
||||||
"fs": fs,
|
"fs": fs,
|
||||||
|
"mountOpt": `{"AllowOther": true}`,
|
||||||
}).Post("/mount/mount")
|
}).Post("/mount/mount")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ func DirPath(c *gin.Context) {
|
|||||||
t.IsDir = info[i].IsDir
|
t.IsDir = info[i].IsDir
|
||||||
t.Name = info[i].Name
|
t.Name = info[i].Name
|
||||||
t.Modified = info[i].Date
|
t.Modified = info[i].Date
|
||||||
|
t.Date = info[i].Date
|
||||||
t.Size = info[i].Size
|
t.Size = info[i].Size
|
||||||
t.Path = info[i].Path
|
t.Path = info[i].Path
|
||||||
t.Extensions = info[i].Extensions
|
t.Extensions = info[i].Extensions
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type ObjResp struct {
|
|||||||
Thumb string `json:"thumb"`
|
Thumb string `json:"thumb"`
|
||||||
Type int `json:"type"`
|
Type int `json:"type"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
|
Date time.Time `json:"date"`
|
||||||
Extensions map[string]interface{} `json:"extensions"`
|
Extensions map[string]interface{} `json:"extensions"`
|
||||||
}
|
}
|
||||||
type FsListResp struct {
|
type FsListResp struct {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
||||||
"github.com/IceWhaleTech/CasaOS/drivers/dropbox"
|
"github.com/IceWhaleTech/CasaOS/drivers/dropbox"
|
||||||
"github.com/IceWhaleTech/CasaOS/drivers/google_drive"
|
"github.com/IceWhaleTech/CasaOS/drivers/google_drive"
|
||||||
fileutil "github.com/IceWhaleTech/CasaOS/pkg/utils/file"
|
|
||||||
"github.com/IceWhaleTech/CasaOS/service"
|
"github.com/IceWhaleTech/CasaOS/service"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@@ -26,6 +26,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
c.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
c.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Code cannot be empty"
|
notify["message"] = "Code cannot be empty"
|
||||||
|
logger.Error("Then code is empty: ", zap.String("code", add.Code), zap.Any("name", "google_drive"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -41,6 +42,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
c.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
c.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Initialization failure"
|
notify["message"] = "Initialization failure"
|
||||||
|
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -50,6 +52,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
c.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
c.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get user information"
|
||||||
|
logger.Error("Then get user info error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -57,9 +60,10 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
dmap["username"] = username
|
dmap["username"] = username
|
||||||
configs, err := service.MyService.Storage().GetConfig()
|
configs, err := service.MyService.Storage().GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
c.String(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get rclone config"
|
||||||
|
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -71,7 +75,10 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
if cf["type"] == "drive" && cf["username"] == dmap["username"] {
|
if cf["type"] == "drive" && cf["username"] == dmap["username"] {
|
||||||
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
||||||
service.MyService.Storage().CheckAndMountByName(cf["username"])
|
err := service.MyService.Storage().CheckAndMountByName(v)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
||||||
|
}
|
||||||
notify["status"] = "warn"
|
notify["status"] = "warn"
|
||||||
notify["message"] = "The same configuration has been added"
|
notify["message"] = "The same configuration has been added"
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
@@ -82,13 +89,10 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
a := strings.Split(username, "@")
|
a := strings.Split(username, "@")
|
||||||
username = a[0]
|
username = a[0]
|
||||||
}
|
}
|
||||||
username = fileutil.NameAccumulation(username, "/mnt")
|
|
||||||
|
|
||||||
dataMap, _ := service.MyService.Storage().GetConfigByName(username)
|
//username = fileutil.NameAccumulation(username, "/mnt")
|
||||||
if len(dataMap) > 0 {
|
username += "_google_drive_" + strconv.FormatInt(time.Now().Unix(), 10)
|
||||||
service.MyService.Storage().UnmountStorage("/mnt/" + username)
|
|
||||||
service.MyService.Storage().DeleteConfigByName(username)
|
|
||||||
}
|
|
||||||
dmap["client_id"] = add.ClientID
|
dmap["client_id"] = add.ClientID
|
||||||
dmap["client_secret"] = add.ClientSecret
|
dmap["client_secret"] = add.ClientSecret
|
||||||
dmap["scope"] = "drive"
|
dmap["scope"] = "drive"
|
||||||
@@ -107,6 +111,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
c.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
c.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Code cannot be empty"
|
notify["message"] = "Code cannot be empty"
|
||||||
|
logger.Error("Then code is empty error: ", zap.String("code", add.Code), zap.Any("name", "dropbox"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -120,6 +125,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
c.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
c.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Initialization failure"
|
notify["message"] = "Initialization failure"
|
||||||
|
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "dropbox"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -128,6 +134,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
c.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
c.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get user information"
|
||||||
|
logger.Error("Then get user information: ", zap.Error(err), zap.Any("name", "dropbox"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -136,9 +143,10 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
|
|
||||||
configs, err := service.MyService.Storage().GetConfig()
|
configs, err := service.MyService.Storage().GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
c.String(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get rclone config"
|
||||||
|
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "dropbox"))
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -150,7 +158,11 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
if cf["type"] == "dropbox" && cf["username"] == dmap["username"] {
|
if cf["type"] == "dropbox" && cf["username"] == dmap["username"] {
|
||||||
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
||||||
service.MyService.Storage().CheckAndMountByName(cf["username"])
|
err := service.MyService.Storage().CheckAndMountByName(v)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
||||||
|
}
|
||||||
|
|
||||||
notify["status"] = "warn"
|
notify["status"] = "warn"
|
||||||
notify["message"] = "The same configuration has been added"
|
notify["message"] = "The same configuration has been added"
|
||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
@@ -161,13 +173,7 @@ func GetRecoverStorage(c *gin.Context) {
|
|||||||
a := strings.Split(username, "@")
|
a := strings.Split(username, "@")
|
||||||
username = a[0]
|
username = a[0]
|
||||||
}
|
}
|
||||||
username = fileutil.NameAccumulation(username, "/mnt")
|
username += "_dropbox_" + strconv.FormatInt(time.Now().Unix(), 10)
|
||||||
dataMap, _ := service.MyService.Storage().GetConfigByName(username)
|
|
||||||
if len(dataMap) > 0 {
|
|
||||||
|
|
||||||
service.MyService.Storage().UnmountStorage("/mnt/" + username)
|
|
||||||
service.MyService.Storage().DeleteConfigByName(username)
|
|
||||||
}
|
|
||||||
|
|
||||||
dmap["client_id"] = add.AppKey
|
dmap["client_id"] = add.AppKey
|
||||||
dmap["client_secret"] = add.AppSecret
|
dmap["client_secret"] = add.AppSecret
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ func ListStorages(c *gin.Context) {
|
|||||||
if dataMap["type"] == "dropbox" {
|
if dataMap["type"] == "dropbox" {
|
||||||
r.MountPoints[i].Icon = dropbox.ICONURL
|
r.MountPoints[i].Icon = dropbox.ICONURL
|
||||||
}
|
}
|
||||||
|
r.MountPoints[i].Name = dataMap["username"]
|
||||||
}
|
}
|
||||||
list := []httper.MountPoint{}
|
list := []httper.MountPoint{}
|
||||||
|
|
||||||
@@ -60,6 +61,7 @@ func ListStorages(c *gin.Context) {
|
|||||||
Fs: v.Fs,
|
Fs: v.Fs,
|
||||||
Icon: v.Icon,
|
Icon: v.Icon,
|
||||||
MountPoint: v.MountPoint,
|
MountPoint: v.MountPoint,
|
||||||
|
Name: v.Name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -138,8 +139,10 @@ func InitV2DocRouter(docHTML string, docYAML string) http.Handler {
|
|||||||
}
|
}
|
||||||
func InitFile() http.Handler {
|
func InitFile() http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
path := r.URL.Query().Get("path")
|
filePath := r.URL.Query().Get("path")
|
||||||
http.ServeFile(w, r, path)
|
fileName := path.Base(filePath)
|
||||||
|
w.Header().Add("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(fileName))
|
||||||
|
http.ServeFile(w, r, filePath)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ func (s *storageStruct) CheckAndMountAll() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storageStruct) GetConfigByName(name string) (map[string]string, error) {
|
func (s *storageStruct) GetConfigByName(name string) (map[string]string, error) {
|
||||||
return httper.GetConfigByName(name)
|
return httper.GetConfigByName(name)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user