-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Complete upload/delete/move/rename/download 2. Deploy to Dockerhub.
- Loading branch information
0 parents
commit a9ca9a2
Showing
92 changed files
with
11,363 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Caiyun-Webdav-CI | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
# schedule: | ||
# - cron: "0 0 * * */3" | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
tags: | ||
description: 'Test scenario tags' | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Get current date | ||
id: date | ||
run: echo "::set-output name=today::$(date +'%Y-%m-%d')" | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
- | ||
name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} | ||
- | ||
name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
tags: | | ||
vgearen/caiyun-webdav:latest | ||
vgearen/caiyun-webdav:${{ steps.date.outputs.today }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
name: Upload Release Asset | ||
|
||
jobs: | ||
build: | ||
name: Upload Release Asset | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: master | ||
- name: Setup java | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
- name: Build with Maven | ||
run: | | ||
mvn clean package -Dmaven.test.skip=true | ||
mv ./target/*.jar ./target/caiyun-webdav.jar | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
files: ./target/caiyun-webdav.jar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
/.mvn/ | ||
/doc/ | ||
/src/main/resources/json/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM maven:3.6.3-jdk-11 AS maven | ||
USER root | ||
COPY ./ /tmp/code | ||
RUN cd /tmp/code && mvn clean package -Dmaven.test.skip=true -Dmaven.javadoc.skip=true | ||
|
||
|
||
FROM openjdk:11-jdk-oracle | ||
COPY --from=maven /tmp/code/target/*.jar /caiyun-webdav.jar | ||
EXPOSE 8080 | ||
ENV JAVA_OPTS="-Xmx512m" | ||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /caiyun-webdav.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
![CI](https://github.com/vgearen/webdav-caiyun/actions/workflows/CI.yml/badge.svg) | ||
|
||
# 和彩云Webdav | ||
|
||
本项目实现了和彩云网盘的Webdav协议,可以通过此协议将网盘挂载到Windows或者Nas中。 | ||
|
||
由于本人时间精力水平有限,本项目是基于 [zxbu/webdav-aliyundriver](https://github.com/zxbu/webdav-aliyundriver) 修改实现的,如有侵权请联系删除。 | ||
|
||
|
||
|
||
## 使用方法 | ||
|
||
- [Jar包运行](#jar包运行) | ||
- [Docker](#Docker) | ||
- [Docker Compose](#Docker-Compose) | ||
|
||
|
||
|
||
### Jar包运行 | ||
|
||
```bash | ||
[root@localhost ~]# java -jar caiyun.jar --caiyun.account="orches-c-account" --caiyun.token="orches-c-token" --caiyun.encrypt="orches-i-account-encrypt" --caiyun.tel="user telnum" | ||
``` | ||
|
||
其中: | ||
|
||
- `account`:网页版和彩云Cookie中的 **ORCHES-C-ACCOUNT** 字段 | ||
- `token`:Cookie中的 **ORCHES-C-TOKEN** | ||
- `encrypt`:Cookie中的 **ORCHES-I-ACCOUNT-ENCRYPT** | ||
- `tel`: 和彩云的注册号码 | ||
|
||
|
||
|
||
### Docker | ||
|
||
```bash | ||
[root@localhost ~]# docker run -d --name=caiyun-webdav --restart=unless-stopped -p 8080:8080 -v /etc/localtime:/etc/localtime -e TZ="Asia/Shanghai" -e JAVA_OPTS="-Xmx512m" -e CAIYUN_ACCOUNT="ORCHES-C-ACCOUNT" -e CAIYUN_TOKEN="ORCHES-C-TOKEN" -e CAIYUN_ENCRYPT="ORCHES-I-ACCOUNT-ENCRYPT" -e CAIYUN_TEL="YOUR PHONE" vgearen/caiyun-webdav | ||
``` | ||
|
||
|
||
|
||
### Docker Compose | ||
|
||
```yaml | ||
version: '3' | ||
services: | ||
caiyun-webdav: | ||
image: vgearen/caiyun-webdav | ||
container_name: caiyun-webdav | ||
restart: unless-stopped | ||
volumes: | ||
- /etc/localtime:/etc/localtime | ||
ports: | ||
- "8080:8080" | ||
tty: true | ||
environment: | ||
- TZ=Asia/Shanghai | ||
- CAIYUN_ACCOUNT=<change me> | ||
- CAIYUN_TOKEN=<change me> | ||
- CAIYUN_ENCRYPT=<change me> | ||
- CAIYUN_TEL=<change me> | ||
|
||
``` | ||
|
||
|
||
|
||
## 使用教程 | ||
|
||
1. [Windows RaiDrive挂载]() | ||
2. [Qnap威联通挂载]() | ||
|
||
|
||
|
||
## TODO | ||
|
||
1. 由于时间原因,还没研究和彩云Cookie过期机制,需要做续期 | ||
|
||
|
||
|
||
|
||
|
||
## License | ||
This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3' | ||
services: | ||
webdav-aliyundriver: | ||
image: vgearen/caiyun-webdav | ||
container_name: caiyun-webdav | ||
restart: always | ||
volumes: | ||
- /etc/localtime:/etc/localtime | ||
ports: | ||
- "8080:8080" | ||
tty: true | ||
environment: | ||
- TZ=Asia/Shanghai | ||
- ALIYUNDRIVE_REFRESH_TOKEN=<change me> | ||
- ALIYUNDRIVE_AUTH_PASSWORD=<change me> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.6.1</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>com.vgearen</groupId> | ||
<artifactId>webdav-caiyundrive</artifactId> | ||
<version>1.0.0</version> | ||
<name>webdav-caiyundrive</name> | ||
<description>Demo project for Spring Boot</description> | ||
<properties> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
<version>3.14.9</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.github.ben-manes.caffeine</groupId> | ||
<artifactId>caffeine</artifactId> | ||
<version>2.7.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/vgearen/webdavcaiyundrive/WebdavCaiyundriveApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.vgearen.webdavcaiyundrive; | ||
|
||
import com.vgearen.webdavcaiyundrive.store.CaiyunDriverFileSystemStore; | ||
import net.sf.webdav.WebdavServlet; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
@EnableScheduling | ||
@SpringBootApplication | ||
public class WebdavCaiyundriveApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(WebdavCaiyundriveApplication.class, args); | ||
} | ||
@Bean | ||
public ServletRegistrationBean<WebdavServlet> myServlet(){ | ||
ServletRegistrationBean<WebdavServlet> servletRegistrationBean = new ServletRegistrationBean<>(new WebdavServlet(), "/*"); | ||
Map<String, String> inits = new LinkedHashMap<>(); | ||
inits.put("ResourceHandlerImplementation", CaiyunDriverFileSystemStore.class.getName()); | ||
inits.put("rootpath", "./"); | ||
inits.put("storeDebug", "1"); | ||
servletRegistrationBean.setInitParameters(inits); | ||
return servletRegistrationBean; | ||
} | ||
} |
Oops, something went wrong.