From 78d6562094d4206749a0775019c73942809ac2fe Mon Sep 17 00:00:00 2001 From: Naohide Sano Date: Thu, 8 Feb 2024 01:11:12 +0900 Subject: [PATCH] initial imports --- .github/workflows/codeql.yml | 81 +++++++++ .github/workflows/maven-publish.yml | 32 ++++ .github/workflows/maven.yml | 35 ++++ README.md | 20 +++ pom.xml | 163 ++++++++++++++++++ src/main/resources/META-INF/services/.gitkeep | 0 src/test/java/vavi/net/auth/cookie/Test1.java | 41 +++++ src/test/resources/logging.properties | 7 + 8 files changed, 379 insertions(+) create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/maven-publish.yml create mode 100644 .github/workflows/maven.yml create mode 100644 README.md create mode 100644 pom.xml create mode 100644 src/main/resources/META-INF/services/.gitkeep create mode 100644 src/test/java/vavi/net/auth/cookie/Test1.java create mode 100644 src/test/resources/logging.properties diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..8716de0 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,81 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] +# schedule: +# - cron: '19 18 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + 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. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, 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 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + # server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + # settings-path: ${{ github.workspace }} # location for the settings.xml file + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + - name: Build with Maven + run: mvn -B package --file pom.xml -DskipTests + #run: mvn package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml -DskipTests + #env: + # GITHUB_TOKEN: ${{ github.token }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..cad3e6c --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,32 @@ +name: GitHub Packages + +on: + release: + types: [created] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml -DskipTests + #run: mvn package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml -DskipTests + #env: + # GITHUB_TOKEN: ${{ github.token }} + + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml --file pom.xml -DskipTests + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..6fb8ea2 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,35 @@ +name: Java CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Check w/o SNAPSHOT when "bump version" + if: ${{ contains(github.event.head_commit.message, 'bump version') }} + run: grep "" pom.xml | head -1 | grep -v SNAPSHOT + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + #server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + #settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml + #run: mvn package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml + #env: + # GITHUB_TOKEN: ${{ github.token }} diff --git a/README.md b/README.md new file mode 100644 index 0000000..f114ed7 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +[![GitHub Packages](https://github.com/umjammer/vavi-net-auth-mac/actions/workflows/maven-publish.yml/badge.svg)](https://github.com/umjammer?tab=packages&repo_name=vavi-net-auth-mac) +[![Java CI](https://github.com/umjammer/vavi-net-auth-mac/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-net-auth-mac/actions/workflows/maven.yml) +[![CodeQL](https://github.com/umjammer/vavi-net-auth-mac/actions/workflows/codeql.yml/badge.svg)](https://github.com/umjammer/vavi-net-auth-mac/actions/workflows/codeql-analysis.yml) +![Java](https://img.shields.io/badge/Java-17-b07219) + +# vavi-net-auth-mac + + *  mac chrome cookie + +## Install + + * [maven](https://jitpack.io/#umjammer/vavi-net-auth-mac) + * this project uses gitlab package registry. add a personal access token to `~/.m2/settings.xml` + * see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#authenticate-to-the-package-registry-with-maven + +## Usage + +## References + +## TDDO \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5bf7d35 --- /dev/null +++ b/pom.xml @@ -0,0 +1,163 @@ + + 4.0.0 + + vavi + vavi-net-auth-mac + 0.0.1-SNAPSHOT + + + + github + https://maven.pkg.github.com/umjammer/vavi-net-auth-mac + + + + + + local (not on jitpack) + + + mac + + + env.JITPACK + !true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.3.0 + + + copy + generate-resources + + copy + + + + + org.rococoa + rococoa-core + dylib + false + ${project.build.testOutputDirectory} + librococoa.dylib + + + + + + + + + + + github + https://maven.pkg.github.com/umjammer/* + + + + + org.rococoa + rococoa-core + 0.8.6 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 17 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.2 + + + -Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties + + false + + + + + + + + jitpack.io + https://jitpack.io + + + github + https://maven.pkg.github.com/umjammer/* + + + + + + + org.junit + junit-bom + 5.10.1 + pom + import + + + + + + + com.github.umjammer + vavi-commons + 1.1.10 + + + + com.github.umjammer.vavi-net-auth + vavi-net-auth-common + 0.1.9 + + + + vavi + vavi-crypto-sandbox + 1.0.2 + + + org.xerial + sqlite-jdbc + 3.42.0.0 + runtime + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.platform + junit-platform-commons + test + + + diff --git a/src/main/resources/META-INF/services/.gitkeep b/src/main/resources/META-INF/services/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/test/java/vavi/net/auth/cookie/Test1.java b/src/test/java/vavi/net/auth/cookie/Test1.java new file mode 100644 index 0000000..b2eb912 --- /dev/null +++ b/src/test/java/vavi/net/auth/cookie/Test1.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023 by Naohide Sano, All rights reserved. + * + * Programmed by Naohide Sano + */ + +package vavi.net.auth.cookie; + +import java.util.Map; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; +import vavi.net.auth.cookie.chrome.mac.MacChromeCookie; +import vavi.util.Debug; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + + +/** + * Test1. + * + * @author Naohide Sano (nsano) + * @version 0.00 2023-01-23 nsano initial version
+ */ +class Test1 { + + @Test + @EnabledOnOs(OS.MAC) + @DisabledIfEnvironmentVariable(named = "GITHUB_WORKFLOW", matches = ".*") // cause a dialog will be shown + void test1() throws Exception { + MacChromeCookie chromeCookie = new MacChromeCookie(); + Map cookie = chromeCookie.getCookie(".google.com"); + cookie.forEach((k, v) -> System.err.println(k + "=" + v)); +Debug.println(cookie.get("cf_clearance")); + assertNotNull(cookie.get("user_id")); + } +} + +/* */ diff --git a/src/test/resources/logging.properties b/src/test/resources/logging.properties new file mode 100644 index 0000000..1ae3610 --- /dev/null +++ b/src/test/resources/logging.properties @@ -0,0 +1,7 @@ +handlers=java.util.logging.ConsoleHandler +.level=INFO +java.util.logging.ConsoleHandler.level=ALL +java.util.logging.ConsoleHandler.formatter=vavi.util.logging.VaviFormatter +#java.util.logging.ConsoleHandler.formatter=vavi.util.logging.BetterFormatter + +#vavi.util.level=FINE