Skip to content

Commit

Permalink
initial imports
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Feb 7, 2024
1 parent 8afcfcc commit 78d6562
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
35 changes: 35 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -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 "<version>" 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 }}
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
163 changes: 163 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<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>

<groupId>vavi</groupId>
<artifactId>vavi-net-auth-mac</artifactId>
<version>0.0.1-SNAPSHOT</version>

<distributionManagement>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/umjammer/vavi-net-auth-mac</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>local (not on jitpack)</id>
<activation>
<os>
<family>mac</family>
</os>
<property>
<name>env.JITPACK</name>
<value>!true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.rococoa</groupId>
<artifactId>rococoa-core</artifactId>
<type>dylib</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<destFileName>librococoa.dylib</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/umjammer/*</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.rococoa</groupId>
<artifactId>rococoa-core</artifactId>
<version>0.8.6</version>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/umjammer/*</url>
</repository>
</repositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.10</version>
</dependency>

<dependency>
<groupId>com.github.umjammer.vavi-net-auth</groupId> <!-- vavi / com.github.umjammer.vavi-net-auth -->
<artifactId>vavi-net-auth-common</artifactId>
<version>0.1.9</version>
</dependency>

<dependency>
<groupId>vavi</groupId>
<artifactId>vavi-crypto-sandbox</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.42.0.0</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Empty file.
41 changes: 41 additions & 0 deletions src/test/java/vavi/net/auth/cookie/Test1.java
Original file line number Diff line number Diff line change
@@ -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 <a href="mailto:umjammer@gmail.com">Naohide Sano</a> (nsano)
* @version 0.00 2023-01-23 nsano initial version <br>
*/
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<String, String> 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"));
}
}

/* */
7 changes: 7 additions & 0 deletions src/test/resources/logging.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 78d6562

Please sign in to comment.