Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46ee02f4 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Merge upstream/master to 1292-Update_with_upstream

parent 5fc22d05
Loading
Loading
Loading
Loading
+26 −15
Original line number Diff line number Diff line
@@ -2,28 +2,39 @@ name: Build KDoc
on:
  push:
    branches: [main]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    name: Build and publish KDoc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - uses: actions/setup-java@v2
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: 11
          cache: 'gradle'
      - uses: gradle/wrapper-validation-action@v1
          java-version: 17
      - uses: gradle/gradle-build-action@v2

      - name: Build KDoc
        run: ./gradlew dokkaHtml
      - name: Publish KDoc
        if: success()
        uses: crazy-max/ghaction-github-pages@v2.5.0
        run: ./gradlew --no-daemon dokkaHtml

      - uses: actions/upload-pages-artifact@v1
        with:
          target_branch: gh-pages
          build_dir: build/dokka/html
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          path: build/dokka/html

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2
+0 −19
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@ jobs:
      fail-fast: false
      matrix:
        language: [ 'java' ]
        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
        # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

    steps:
    - name: Checkout repository
@@ -45,29 +43,12 @@ jobs:
      uses: github/codeql-action/init@v2
      with:
        languages: ${{ matrix.language }}
        # If you wish to specify custom queries, you can do so here or in a config file.
        # By default, queries listed here will override any specified in a config file.
        # Prefix the list here with "+" to use these queries and those in the config file.

        # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
        # queries: security-extended,security-and-quality


    # Autobuild attempts to build any compiled languages  (C/C++, C#, Go, or Java).
    # If this step fails, then you should remove it and run the build manually (see below)
    - name: Autobuild
      uses: github/codeql-action/autobuild@v2

    # ℹ️ Command-line programs to run using the OS shell.
    # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

    #   If the Autobuild fails above, remove it and uncomment the following three lines.
    #   modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

    # - run: |
    #   echo "Run, Build Application using script"
    #   ./location_of_script_within_repo/buildscript.sh

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v2
      with:
+5 −8
Original line number Diff line number Diff line
@@ -5,18 +5,15 @@ jobs:
    name: Run tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - uses: actions/setup-java@v2
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: 11
          cache: 'gradle'
      - uses: gradle/wrapper-validation-action@v1
          java-version: 17
      - uses: gradle/gradle-build-action@v2

      - name: Check
        run: ./gradlew check
        run: ./gradlew --no-daemon check

      - name: Archive results
        uses: actions/upload-artifact@v2
+51 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ We're happy about contributions, but please let us know in the discussions befor
in your own repository and send a pull request.


## How to use
## Installation

You can use jitpack.io to include dav4jvm:

@@ -38,12 +38,62 @@ XPP and you don't need to include one; on other systems, you may need to
import for instance `org.ogce:xpp3` to get dav4jvm to work.


## Usage

First, you'll need to set up an OkHttp instance. Use `BasicDigestAuthHandler` to configure the credentials:

    val authHandler = BasicDigestAuthHandler(
        domain = null, // Optional, to only authenticate against hosts with this domain.
        username = "user1",
        password = "pass1"
    )
    val okHttpClient = OkHttpClient.Builder()
        .followRedirects(false)
        .authenticator(authHandler)
        .addNetworkInterceptor(authHandler)
        .build()


### Files

Here's an example to create and download a file:

    val location = "https://example.com/webdav/hello.txt".toHttpUrl()
    val davCollection = DavCollection(account.requireClient(), location)

    // Create a text file
    davCollection.put("World".toRequestBody(contentType = "text/plain".toMediaType()) { response ->
        // Upload successful!
    }

    // Download a text file
    davCollection.get(accept = "", headers = null) { response ->
        response.body?.string()
        // Download successful!
    }

To list a folder's contents, you need to pass in which properties to fetch:

    val location = "https://example.com/webdav/".toHttpUrl()
    val davCollection = DavCollection(account.requireClient(), location)

    davCollection.propfind(depth = 1, DisplayName.NAME, GetLastModified.NAME) { response, relation ->
        // This callback will be called for every file in the folder.
        // Use `response.properties` to access the successfully retrieved properties.
    }

## Custom properties

If you use custom WebDAV properties, register the corresponding factories with `PropertyRegistry.register()`
before calling other dav4jvm methods.


# Useful forks

For specific use-cases, we have a list of forks that cover them:
- Kotlin Multiplatform (maintained by [McDjuady](https://github.com/McDjuady)): https://github.com/McDjuady/dav4jvm


## Contact / License

dav4jvm is licensed under [Mozilla Public License, v. 2.0](LICENSE).

SECURITY.md

0 → 100644
+5 −0
Original line number Diff line number Diff line
# Security Policy

## Reporting a Vulnerability

Please report security vulnerabilities using the [DAVx⁵ support form](https://www.davx5.com/support) or via email to support@davx5.com.
Loading