Compare commits

..

No commits in common. "master" and "1.0.0.3" have entirely different histories.

54 changed files with 212 additions and 1276 deletions

5
.github/FUNDING.yml vendored
View File

@ -1,8 +1,7 @@
# These are supported funding model platforms # These are supported funding model platforms
patreon: kasthack patreon: epicmorg
custom: https://www.patreon.com/epicmorg
ko_fi: epicmorg ko_fi: epicmorg
custom: https://ko-fi.com/alexz696
#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] #github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#open_collective: # Replace with a single Open Collective username #open_collective: # Replace with a single Open Collective username

20
.github/config.yml vendored
View File

@ -1,20 +0,0 @@
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
:wave: Thank you for opening your first issue. I'm just an automated bot that's here to help you get the information you need quicker, so please ignore this message if it doesn't apply to your issue.
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Congratulations on opening your first Pull Request, this is a momentous day for you and us! :sparkles:
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user
firstPRMergeComment: >
Hooray! Your first Pull Request was merged, here's to many more :rocket:
# It is recommend to include as many gifs and emojis as possible

View File

@ -1,8 +0,0 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/src"
schedule:
interval: "daily"
time: "02:00"
open-pull-requests-limit: 10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

View File

@ -1,13 +0,0 @@
# Configuration for probot-no-response - https://github.com/probot/no-response
# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 7
# Label requiring a response
responseRequiredLabel: more-information-needed
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response
to our request for more information from the original author. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further.

BIN
.github/screenshot-1.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,47 +0,0 @@
name: develop
on:
pull_request:
branches:
- '*'
tags:
- '*'
push:
branches:
- 'develop'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 8
dotnet-quality: 'preview'
- name: Restore
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
cd src
dotnet restore
- name: Build
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
cd src
dotnet build --no-restore
- name: Test
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
cd src
dotnet test --no-build --verbosity normal

View File

@ -1,46 +0,0 @@
name: master
on:
push:
branches:
- 'master'
tags:
- '*'
schedule:
- cron: '02 00 * * 6' # At 02:00, only on Saturday
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 8
dotnet-quality: 'preview'
- name: Restore
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
cd src
dotnet restore
- name: Build
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
cd src
dotnet build --no-restore
- name: Test
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
cd src
dotnet test --no-build --verbosity normal

View File

@ -1,28 +1,7 @@
# [![Activity](https://img.shields.io/github/commit-activity/m/EpicMorg/atlassian-downloader?label=commits&style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/commits) [![GitHub issues](https://img.shields.io/github/issues/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/issues) [![GitHub forks](https://img.shields.io/github/forks/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/network) [![GitHub stars](https://img.shields.io/github/stars/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/stargazers) [![Size](https://img.shields.io/github/repo-size/EpicMorg/atlassian-downloader?label=size&style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/archive/master.zip) [![Release](https://img.shields.io/github/v/release/EpicMorg/atlassian-downloader?style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/releases) [![GitHub license](https://img.shields.io/github/license/EpicMorg/atlassian-downloader.svg?style=popout-square)](LICENSE.md) [![Changelog](https://img.shields.io/badge/Changelog-yellow.svg?style=popout-square)](CHANGELOG.md)
# Atlassian Downloader - Changelog # Atlassian Downloader - Changelog
## 2.x
* `2.0.0.2` - minor update:
* Added `maxRetries (default: 5)` and `delayBetweenRetries (default: 2500, milliseconds)` args, to redownload file if connection will be reset.
* Updated dependencies.
* `2.0.0.1` - minor update:
* Fix default output dir, enable nullables, fix compiler warnings #43
* Remove redundant parameters from publish profiles #42
* `2.0.0.0` - migrated to `dotnet8` and updated libs.
* code optimized by [@kasthack](https://github.com/kasthack).
* reworked build scripts via `cli` and `vs`.
* added new dists - `osx-arm64`, `linux-bionic-x64`.
* added support of custom useragent via flag
* added suppor of skipping existing files via flag
## 1.x
* `1.1.0.0` - added automatic compare of local and remote file sizes. If they differ - the file will be re-downloaded.
* `1.0.1.1` - minor update: added `UserAgent` to HTTP headers and added mirrors of json files.
* `1.0.1.0` - added support of `Atlassian Bitbucket (Mesh)` product, updated deps, fixed `Chocolatey` support and start logic.
* `1.0.0.9` - updated deps.
* `1.0.0.8` - switched to `dontet6.0`, updated deps.
* `1.0.0.7` - added `unofficial support` of `sourcetree` via automatic mirror [from github](https://github.com/EpicMorg/atlassian-json). fixed `logger` output, code improvments.
* `1.0.0.6` - added support of `clover`. fixed broken json parsing. added new `logger`.
* `1.0.0.5` - added support for `EAP` releases.
* `1.0.0.4` - bump version. rewrited build scripts. added support of `arm` and `arm64`.
* `1.0.0.3` - some cosmetics improvements. * `1.0.0.3` - some cosmetics improvements.
* `1.0.0.2` - some cosmetics improvements. * `1.0.0.2` - some cosmetics improvements.
* `1.0.0.1` - some improvements. added support of all available products. * `1.0.0.1` - some improvements. added support of all available products.

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2009 EpicMorg Copyright (c) 2018-2021 EpicMorg: Main
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

215
README.md
View File

@ -1,150 +1,77 @@
# [![Activity](https://img.shields.io/github/commit-activity/m/EpicMorg/atlassian-downloader?label=commits&style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/commits) [![GitHub issues](https://img.shields.io/github/issues/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/issues) [![GitHub forks](https://img.shields.io/github/forks/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/network) [![GitHub stars](https://img.shields.io/github/stars/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/stargazers) [![Size](https://img.shields.io/github/repo-size/EpicMorg/atlassian-downloader?label=size&style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/archive/master.zip) [![Release](https://img.shields.io/github/v/release/EpicMorg/atlassian-downloader?style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/releases) [![Downloads](https://img.shields.io/github/downloads/EpicMorg/atlassian-downloader/total.svg?style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/releases) [![GitHub license](https://img.shields.io/github/license/EpicMorg/atlassian-downloader.svg?style=popout-square)](LICENSE.md) [![Changelog](https://img.shields.io/badge/Changelog-yellow.svg?style=popout-square)](CHANGELOG.md) # [![Activity](https://img.shields.io/github/commit-activity/m/EpicMorg/atlassian-downloader?label=commits&style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/commits) [![GitHub issues](https://img.shields.io/github/issues/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/issues) [![GitHub forks](https://img.shields.io/github/forks/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/network) [![GitHub stars](https://img.shields.io/github/stars/EpicMorg/atlassian-downloader.svg?style=popout-square)](https://github.com/EpicMorg/atlassian-downloader/stargazers) [![Size](https://img.shields.io/github/repo-size/EpicMorg/atlassian-downloader?label=size&style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/archive/master.zip) [![Release](https://img.shields.io/github/v/release/EpicMorg/atlassian-downloader?style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/releases) [![GitHub license](https://img.shields.io/github/license/EpicMorg/atlassian-downloader.svg?style=popout-square)](LICENSE.md) [![Changelog](https://img.shields.io/badge/Changelog-yellow.svg?style=popout-square)](CHANGELOG.md)
# Atlassian Downloader # Atlassian Downloader
Console app written with `c#` and `dotnet8` for downloading all avalible products from `Atlassian`. Why not? Simple script written with `c#` and `dotnet5` for downloadind all avalible products from `Atlassian`. Why not?
![Atlassian Downloader](https://rawcdn.githack.com/EpicMorg/atlassian-downloader/28d17af55fbd4944d75f70d6bcb702e409820f64/.github/media/screenshot-01.png) ![Atlassian Downloader](https://rawcdn.githack.com/EpicMorg/atlassian-downloader/8fc9c772e9518a1cb23246ee8cc4cb8a58d9ff22/.github/screenshot-1.png)
![Atlassian Downloader](https://rawcdn.githack.com/EpicMorg/atlassian-downloader/28d17af55fbd4944d75f70d6bcb702e409820f64/.github/media/screenshot-03.png)
# Supported OS:
`win-x86`, `win-x64`, `win-arm64`, `linux-x86`, `linux-x64`, `linux-musl-x64`, `linux-arm`, `linux-arm64`, `linux-bionic-x64`, `osx-x64`, `osx-arm64`
-------------------
# How to...
## ..develop
1. preinstall `dotnet8`. Download [here](https://dotnet.microsoft.com/download/dotnet/8.0).
2. preinstall `VS2022`. Download [here](https://visualstudio.microsoft.com/vs/).
3. `git clone` this repo.
4. `cd` to `<repo>/src`.
5. open `*.sln` file
6. ...
7. profit!
## ..build from scratch
1. `git clone` this repo.
2. `cd` to `<repo>/src`.
3. execute `build.bat(sh)` in `src` folder.
4. by default all data will be downloaded to `src/Atlassian` folder and subfolders.
## ..use binary versions
1. just download latest [![Downloads](https://img.shields.io/github/downloads/EpicMorg/atlassian-downloader/total.svg?style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/releases) [![Release](https://img.shields.io/github/v/release/EpicMorg/atlassian-downloader?style=flat-square)](https://github.com/EpicMorg/atlassian-downloader/releases)
2. ...
3. profit!
## ..intall via Chocolatey
| CLI | Version | Downloads
| ------ | ------ | ------
| :computer: `choco install atlassian-downloader` | [![Version](https://img.shields.io/chocolatey/v/atlassian-downloader?label=version&style=for-the-badge)](https://chocolatey.org/packages/atlassian-downloader/) | [![Version](https://img.shields.io/chocolatey/dt/atlassian-downloader?style=for-the-badge)](https://chocolatey.org/packages/atlassian-downloader/)
-------------------
# Usage and settings
## CLI args
![Atlassian Downloader](https://rawcdn.githack.com/EpicMorg/atlassian-downloader/28d17af55fbd4944d75f70d6bcb702e409820f64/.github/media/screenshot-02.png)
```
atlassian-downloader:
Atlassian archive downloader. See https://github.com/EpicMorg/atlassian-downloader for more info
Usage:
atlassian-downloader [options]
Options:
--output-dir <output-dir> Override output directory to download
--custom-feed <custom-feed> Override URIs to import []
--action <Download|ListURLs|ListVersions|ShowRawJson> Action to perform [default: Download]
--about Show credits banner [default: False]
--product-version <product-version> Override target version to download some product. Advice: Use
it with "customFeed". []
--skip-file-check Skip compare of file sizes if a local file already exists.
Existing file will be skipped to check and redownload.
[default: False]
--user-agent <user-agent> Set custom user agent via this feature flag. [default:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0)
Gecko/20100101 Firefox/101.0]
--version Show version information
-?, -h, --help Show help and usage information
```
## Example of usage:
### How to download it all at first time, or get update of local archive
```
PS> .\atlassian-downloader.exe --output-dir "P:\Atlassian"
or
bash# ./atlassian-downloader --output-dir "/mnt/nfs/atlassian"
```
If you already have some folders at output path - they will be ignored and not be downloaded again and skipped. Downloader will be download only new versions of files which not be present locally yet.
### Set only some url feed and dowload it:
```
PS> .\atlassian-downloader.exe --output-dir "P:\Atlassian" --custom-feed https://my.atlassian.com/download/feeds/current/bamboo.json
or
bash# ./atlassian-downloader --output-dir "/mnt/nfs/atlassian" --custom-feed https://my.atlassian.com/download/feeds/current/bamboo.json
```
### cron or crontab example
```
0 0 * 1 0 /opt/epicmorg/atlassian-downloader/atlassian-downloader --output-dir "/mnt/nfs/atlassian"
```
### Show only urls from jsons
```
PS> .\atlassian-downloader.exe --action ListURLs
or
bash# ./atlassian-downloader --action ListURLs
```
## Additional settings
File `src/appSettings.json` contains additional settings, like [loglevel](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel?view=dotnet-plat-ext-5.0#fields) and [console output theme](https://github.com/serilog/serilog-sinks-console). You can set it up via editing this file.
### Supported log levels
| Level | Enum | Description
|-------------|:-------------:|-------------|
| `Critical` | `5` | Logs that describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention.
| `Debug` | `1` | Logs that are used for interactive investigation during development. These logs should primarily contain information useful for debugging and have no long-term value.
| `Error` | `4` | Logs that highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure.
| `Information` | `2` | Logs that track the general flow of the application. These logs should have long-term value.
| `None` | `6` | Not used for writing log messages. Specifies that a logging category should not write any messages.
| `Trace` | `0` | Logs that contain the most detailed messages. These messages may contain sensitive application data. These messages are disabled by default and should never be enabled in a production environment.
| `Warning` | `3` | Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.
### Supported console themes
The following built-in themes are available, provided by `Serilog.Sinks.Console` package:
* `ConsoleTheme.None` - no styling
* `SystemConsoleTheme.Literate` - styled to replicate _Serilog.Sinks.Literate_, using the `System.Console` coloring modes supported on all Windows/.NET targets; **this is the default when no theme is specified**
* `SystemConsoleTheme.Grayscale` - a theme using only shades of gray, white, and black
* `AnsiConsoleTheme.Literate` - an ANSI 16-color version of the "literate" theme; we expect to update this to use 256-colors for a more refined look in future
* `AnsiConsoleTheme.Grayscale` - an ANSI 256-color version of the "grayscale" theme
* `AnsiConsoleTheme.Code` - an ANSI 256-color Visual Studio Code-inspired theme
-------------------
# Supported products:
| Product | Current | Archive | EAP |
|-------------|:-------------:|:-------------:|:-------------:|
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Bamboo&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/bamboo) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Bitbucket%20(Stash)&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/bitbucket) | :white_check_mark: | :white_check_mark: | :interrobang: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Bitbucket%20(Mesh)&color=bright%20green&style=for-the-badge)](https://confluence.atlassian.com/bitbucketserver/bitbucket-mesh-compatibility-matrix-1127254859.html) | :white_check_mark: | :white_check_mark: | :interrobang: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Clover&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/clover) | :white_check_mark: | :white_check_mark: | :x: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Confluence&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/confluence) | :white_check_mark: | :white_check_mark: | :x: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Crowd&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/crowd) | :white_check_mark: | :white_check_mark: | :x: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Crucible&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/crucible) | :white_check_mark: | :white_check_mark: | :x: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=FishEye&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/fisheye) | :white_check_mark: | :white_check_mark: | :x: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Jira%20Core&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/jira/core) | :white_check_mark: | :white_check_mark: | :x: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Jira%20Software&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/jira) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=Jira%20Servicedesk&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/jira/service-management) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| [![Product](https://img.shields.io/static/v1?label=Atlassian&message=SourceTree&color=bright%20green&style=for-the-badge)](https://www.atlassian.com/software/sourcetree) | :white_check_mark: | :white_check_mark: | :x: |
* Archive of `Atlassian` jsons available [here](https://github.com/EpicMorg/atlassian-json).
-------------------
## Authors ## Authors
* [@kasthack](https://github.com/kasthack) - code * [@kasthack](https://github.com/kasthack) - core code
* [@stam](https://github.com/stamepicmorg) - code, repo * [@stam](https://github.com/stamepicmorg) - edits
## Requerments
1. Preinstalled `dotnet5`. Download [here](https://dotnet.microsoft.com/download/dotnet/5.0).
2. Supported OS: `win32`, `win64`, `linux`, `macosx`
## How to
1. `git clone` this repo.
2. `cd` to `<repo>/src`.
3. execute `donten run` in `src` folder.
4. all data will be downloaded to `src/output` folder and subfolders
------
## Supported products:
### Current links
#### Bamboo
* https://my.atlassian.com/download/feeds/current/bamboo.json
#### Bitbucket (Stash)
* https://my.atlassian.com/download/feeds/current/stash.json
#### Confluence
* https://my.atlassian.com/download/feeds/current/confluence.json
#### Crowd
* https://my.atlassian.com/download/feeds/current/crowd.json
#### Crucible
* https://my.atlassian.com/download/feeds/current/crucible.json
#### FishEye
* https://my.atlassian.com/download/feeds/current/fisheye.json
#### Jira
* https://my.atlassian.com/download/feeds/current/jira-core.json
* https://my.atlassian.com/download/feeds/current/jira-software.json
* https://my.atlassian.com/download/feeds/current/jira-servicedesk.json
### Archived links
#### Bamboo
* https://my.atlassian.com/download/feeds/archived/bamboo.json
#### Bitbucket (Stash)
* https://my.atlassian.com/download/feeds/archived/stash.json
#### Confluence
* https://my.atlassian.com/download/feeds/archived/confluence.json
#### Crowd
* https://my.atlassian.com/download/feeds/archived/crowd.json
#### Crucible
* https://my.atlassian.com/download/feeds/archived/crucible.json
#### FishEye
* https://my.atlassian.com/download/feeds/archived/fisheye.json
#### Jira
* https://my.atlassian.com/download/feeds/archived/jira.json
* https://my.atlassian.com/download/feeds/archived/jira-core.json
* https://my.atlassian.com/download/feeds/archived/jira-software.json
* https://my.atlassian.com/download/feeds/archived/jira-servicedesk.json

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,4 +0,0 @@
[*.cs]
# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none

View File

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<PackageId>EpicMorg.Atlassian.Downloader</PackageId>
<Authors>Atlassian Downloader</Authors>
<Description>Atlassian Downloader by EpicMorg, code by kasthack</Description>
<PackageProjectUrl>https://github.com/EpicMorg/atlassian-downloader</PackageProjectUrl>
<PackageIcon>favicon.png</PackageIcon>
<FileVersion>1.0.0.2</FileVersion>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
<AssemblyVersion>1.0.0.3</AssemblyVersion>
<Version>1.0.0.3</Version>
<Copyright>EpicMorg 20201</Copyright>
<Product>Atlassian Downloader</Product>
</PropertyGroup>
<ItemGroup>
<None Include="favicon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>

View File

@ -3,12 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.30803.129 VisualStudioVersion = 16.0.30803.129
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "atlassian-downloader", "atlassian-downloader.csproj", "{9C7EA014-5883-4FCD-BF1D-DC561F8958DD}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AtlassianDownloader", "AtlassianDownloader.csproj", "{9C7EA014-5883-4FCD-BF1D-DC561F8958DD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{119D41DA-BD17-42D2-8AC7-806C3B68223D}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,121 +0,0 @@
namespace EpicMorg.Atlassian.Downloader.Models;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Logging;
internal class BellsAndWhistles
{
private static readonly string assemblyEnvironment = string.Format("[{1}, {0}]", RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(), RuntimeInformation.FrameworkDescription);
private static readonly Assembly entryAssembly = Assembly.GetEntryAssembly()!;
private static readonly string assemblyVersion = entryAssembly.GetName().Version!.ToString();
private static readonly string fileVersion = entryAssembly.GetCustomAttribute<AssemblyFileVersionAttribute>()!.Version;
private static readonly string assemblyName = entryAssembly.GetCustomAttribute<AssemblyProductAttribute>()!.Product;
const string assemblyBuildType =
#if DEBUG
"[Debug]"
#else
"[Release]"
#endif
;
private const ConsoleColor DEFAULT = ConsoleColor.Blue;
public static void ShowVersionInfo(ILogger logger)
{
logger.LogInformation(
"{assemblyName} {assemblyVersion} {assemblyEnvironment} {assemblyBuildType}",
assemblyName,
assemblyVersion,
assemblyEnvironment,
assemblyBuildType);
Console.BackgroundColor = ConsoleColor.Black;
WriteColorLine("%╔═╦═══════════════════════════════════════════════════════════════════════════════════════╦═╗");
WriteColorLine("%╠═╝ .''. %╚═%╣");
WriteColorLine("%║ .:cc;. %║");
WriteColorLine("%║ .;cccc;. %║");
WriteColorLine("%║ .;cccccc;. !╔══════════════════════════════════════════════╗ %║");
WriteColorLine($"%║ .:ccccccc;. !║ {assemblyName} !║ %║");
WriteColorLine("%║ 'ccccccccc;. !╠══════════════════════════════════════════════╣ %║");
WriteColorLine("%║ ,cccccccccc;. !║ &Code: @kasthack !║ %║");
WriteColorLine("%║ ,ccccccccccc;. !║ &GFX: @stam !║ %║");
WriteColorLine("%║ .... .:ccccccccccc;. !╠══════════════════════════════════════════════╣ %║");
WriteColorLine($"%║ .',,'..;cccccccccccc;. !║ &Version: {fileVersion} !║ %║");
WriteColorLine("%║ .,,,,,'.';cccccccccccc;. !║ &GitHub: $EpicMorg/atlassian-downloader !║ %║");
WriteColorLine("%║ .,;;;;;,'.':cccccccccccc;. !╚══════════════════════════════════════════════╝ %║");
WriteColorLine("%║ .;:;;;;;;,...:cccccccccccc;. %║");
WriteColorLine("%║ .;:::::;;;;'. .;:ccccccccccc;. %║");
WriteColorLine("%║ .:cc::::::::,. ..:ccccccccccc;. %║");
WriteColorLine("%║ .:cccccc:::::' .:ccccccccccc;. %║");
WriteColorLine("%║ .;:::::::::::,. .;:::::::::::,. %║");
WriteColorLine("%╠═╗ ............ ............ %╔═╣");
WriteColorLine("%╚═╩═══════════════════════════════════════════════════════════════════════════════════════╩═╝");
Console.ResetColor();
}
public static void SetConsoleTitle() => Console.Title = $@"{assemblyName} {assemblyVersion} {assemblyEnvironment} - {assemblyBuildType}";
private static void WriteColorLine(string text, params object[] args)
{
Dictionary<char, ConsoleColor> colors = new()
{
{ '!', ConsoleColor.Red },
{ '@', ConsoleColor.Green },
{ '#', ConsoleColor.Blue },
{ '$', ConsoleColor.Magenta },
{ '&', ConsoleColor.Yellow },
{ '%', ConsoleColor.Cyan }
};
// TODO: word wrap, backslash escapes
text = string.Format(text, args);
var chunk = "";
var paren = false;
for (var i = 0; i < text.Length; i++)
{
var c = text[i];
if (colors.ContainsKey(c) && StringNext(text, i) != ' ')
{
Console.Write(chunk);
chunk = "";
if (StringNext(text, i) == '(')
{
i++; // skip past the paren
paren = true;
}
Console.ForegroundColor = colors[c];
}
else if (paren && c == ')')
{
paren = false;
Console.ForegroundColor = DEFAULT;
}
else if (Console.ForegroundColor != DEFAULT)
{
Console.Write(c);
if (c == ' ' && !paren)
{
Console.ForegroundColor = DEFAULT;
}
}
else
{
chunk += c;
}
}
Console.WriteLine(chunk);
Console.ForegroundColor = DEFAULT;
}
private static char StringNext(string text, int index) => index < text.Length ? text[index + 1] : '\0';
}

View File

@ -1,259 +0,0 @@
namespace EpicMorg.Atlassian.Downloader.Core;
using EpicMorg.Atlassian.Downloader.Models;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
internal class DownloaderService : IHostedService
{
private static readonly JsonSerializerOptions jsonOptions = new()
{
PropertyNameCaseInsensitive = true
};
private readonly ILogger<DownloaderService> logger;
private readonly DownloaderOptions options;
private readonly HttpClient client;
private readonly IHostApplicationLifetime hostApplicationLifetime;
public DownloaderService(IHostApplicationLifetime hostApplicationLifetime, ILogger<DownloaderService> logger, HttpClient client, DownloaderOptions options)
{
this.logger = logger;
this.client = client;
client.DefaultRequestHeaders.Add("User-Agent", options.UserAgent);
this.options = options;
this.hostApplicationLifetime = hostApplicationLifetime;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
BellsAndWhistles.SetConsoleTitle();
BellsAndWhistles.ShowVersionInfo(this.logger);
if (!this.options.Version && !string.IsNullOrWhiteSpace(this.options.OutputDir))
{
var feedUrls = this.GetFeedUrls();
this.logger.LogInformation($"Task started");
foreach (var feedUrl in feedUrls)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}
var (json, versions) = await this.GetJson(feedUrl, this.options.ProductVersion, cancellationToken).ConfigureAwait(false);
switch (this.options.Action)
{
case DownloadAction.ShowRawJson:
Console.Out.WriteLine(json);
break;
case DownloadAction.Download:
await this.DownloadFilesFromFeed(feedUrl, versions, cancellationToken).ConfigureAwait(false);
break;
case DownloadAction.ListURLs:
foreach (var versionProg in versions)
{
foreach (var file in versionProg.Value)
{
Console.Out.WriteLine(file.ZipUrl);
}
}
break;
case DownloadAction.ListVersions:
foreach (var versionProg in versions)
{
foreach (var file in versionProg.Value)
{
Console.Out.WriteLine(file.Version);
}
}
break;
}
}
}
this.logger.LogInformation($"Complete");
this.hostApplicationLifetime.StopApplication();
}
private async Task<(string json, IDictionary<string, ResponseItem[]> versions)> GetJson(string feedUrl, string? productVersion = null, CancellationToken cancellationToken = default)
{
var atlassianJson = await this.client.GetStringAsync(feedUrl, cancellationToken).ConfigureAwait(false);
var json = atlassianJson.Trim()["downloads(".Length..^1];
this.logger.LogTrace("Downloaded json: {json}", json);
var parsed = JsonSerializer.Deserialize<ResponseItem[]>(json, jsonOptions)!;
this.logger.LogDebug("Found {releaseCount} releases", parsed.Length);
var versions = parsed
.GroupBy(a => a.Version)
.Where(a => productVersion is null || a.Key == productVersion)
.ToDictionary(a => a.Key, a => a.ToArray());
this.logger.LogDebug("Found {releaseCount} releases", versions.Count);
return (json, versions);
}
private IReadOnlyList<string> GetFeedUrls() => this.options.CustomFeed != null
? this.options.CustomFeed.Select(a => a.ToString()).ToArray()
: SourceInformation.AtlassianSources;
private async Task DownloadFilesFromFeed(string feedUrl, IDictionary<string, ResponseItem[]> versions, CancellationToken cancellationToken)
{
var feedDir = Path.Combine(this.options.OutputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..feedUrl.LastIndexOf('.')]);
this.logger.LogInformation("Download from JSON \"{feedUrl}\" started", feedUrl);
foreach (var version in versions)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}
var directory = Path.Combine(feedDir, version.Key);
if (!Directory.Exists(directory))
{
_ = Directory.CreateDirectory(directory);
}
foreach (var file in version.Value)
{
if (cancellationToken.IsCancellationRequested)
{
return;
}
if (file.ZipUrl == null)
{
this.logger.LogWarning("Empty ZipUrl found for version '{version}' in {feedUrl}", version.Key, feedUrl);
continue;
}
var serverPath = file.ZipUrl.PathAndQuery;
var outputFile = Path.Combine(directory, serverPath[(serverPath.LastIndexOf('/') + 1)..]);
if (!File.Exists(outputFile))
{
await this.DownloadFile(file, outputFile, cancellationToken).ConfigureAwait(false);
}
else
{
if (this.options.SkipFileCheck == false)
{
this.logger.LogWarning("File \"{outputFile}\" already exists. File sizes will be compared.", outputFile);
var localFileSize = new FileInfo(outputFile).Length;
this.logger.LogInformation("Size of local file is {localFileSize} bytes.", localFileSize);
try
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("User-Agent", options.UserAgent);
var response = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, file.ZipUrl), cancellationToken);
if (response.IsSuccessStatusCode)
{
if (response.Content.Headers.ContentLength.HasValue)
{
var remoteFileSize = response.Content.Headers.ContentLength.Value;
this.logger.LogInformation("Size of remote file is \"{remoteFileSize}\" bytes.", remoteFileSize);
if (remoteFileSize == localFileSize)
{
this.logger.LogInformation(
"Size of remote and local files and are same ({remoteFileSize} bytes and {localFileSize} bytes). Nothing to download. Operation skipped.",
remoteFileSize,
localFileSize);
}
else
{
this.logger.LogWarning(
"Size of remote and local files and are not same ({remoteFileSize} bytes and {localFileSize} bytes). Download started.",
remoteFileSize,
localFileSize);
File.Delete(outputFile);
await this.DownloadFile(file, outputFile, cancellationToken).ConfigureAwait(false);
}
}
else
{
this.logger.LogWarning("Cant get size of remote file \"{uri}\". May be server not support it feature. Sorry.", file.ZipUrl);
continue;
}
}
else
{
this.logger.LogError("Request execution error for {uri}: \"{statusCode}\". Sorry.", file.ZipUrl, response.StatusCode);
}
}
catch (HttpRequestException ex)
{
this.logger.LogError(ex, "HTTP request error for {uri}: \"{message}\", \"{statusCode}\". Sorry.", file.ZipUrl, ex.Message, ex.StatusCode);
}
}
else
{
logger.LogWarning("File \"{outputFile}\" already exists. Download from \"{uri}\" skipped.", outputFile, file.ZipUrl);
continue;
}
}
}
}
this.logger.LogInformation("All files from \"{feedUrl}\" successfully downloaded.", feedUrl);
}
private async Task DownloadFile(ResponseItem file, string outputFile, CancellationToken cancellationToken)
{
for (int attempt = 1; attempt <= options.MaxRetries; attempt++)
{
if (!string.IsNullOrEmpty(file.Md5))
{
File.WriteAllText(outputFile + ".md5", file.Md5);
}
try
{
using var outputStream = File.OpenWrite(outputFile);
using var request = await this.client.GetStreamAsync(file.ZipUrl, cancellationToken).ConfigureAwait(false);
await request.CopyToAsync(outputStream, cancellationToken).ConfigureAwait(false);
}
catch (Exception downloadEx)
{
this.logger.LogError(downloadEx, "Attempt {attempt} failed to download file \"{uri}\" to \"{outputFile}\".", attempt, file.ZipUrl, outputFile);
if (attempt == options.MaxRetries)
{
this.logger.LogError(downloadEx, "Failed to download file \"{uri}\" to \"{outputFile}\".", file.ZipUrl, outputFile);
try
{
File.Delete(outputFile);
}
catch (Exception removeEx)
{
this.logger.LogError(removeEx, "Failed to remove incomplete file \"{outputFile}\".", outputFile);
}
throw;
}
else
{
await Task.Delay(options.DelayBetweenRetries, cancellationToken).ConfigureAwait(false);
}
}
this.logger.LogInformation("File \"{uri}\" successfully downloaded to \"{outputFile}\".", file.ZipUrl, outputFile);
}
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
public async Task StopAsync(CancellationToken cancellationToken) { }
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
}

View File

@ -1,21 +0,0 @@
namespace EpicMorg.Atlassian.Downloader;
public enum DownloadAction
{
/// <summary>
/// Download application files
/// </summary>
Download,
/// <summary>
/// Print download URLs and exit
/// </summary>
ListURLs,
/// <summary>
/// Print available application versions and exit
/// </summary>
ListVersions,
/// <summary>
/// Print feed JSONs to stdout and exit
/// </summary>
ShowRawJson,
}

View File

@ -1,14 +0,0 @@
namespace EpicMorg.Atlassian.Downloader;
using System;
public record DownloaderOptions(
string OutputDir,
Uri[]? CustomFeed,
DownloadAction Action,
bool Version,
string? ProductVersion,
bool SkipFileCheck,
string UserAgent,
int MaxRetries,
int DelayBetweenRetries
) { }

View File

@ -1,19 +0,0 @@
namespace EpicMorg.Atlassian.Downloader;
using System;
public partial class ResponseItem
{
public string? Description { get; set; }
public string? Edition { get; set; }
public Uri? ZipUrl { get; set; }
public object? TarUrl { get; set; }
public string? Md5 { get; set; }
public string? Size { get; set; }
public string? Released { get; set; }
public string? Type { get; set; }
public string? Platform { get; set; }
public required string Version { get; set; }
public Uri? ReleaseNotes { get; set; }
public Uri? UpgradeNotes { get; set; }
}

View File

@ -1,85 +0,0 @@
namespace EpicMorg.Atlassian.Downloader.Models;
using System.Collections.Generic;
internal static class SourceInformation
{
public static IReadOnlyList<string> AtlassianSources { get; } = new[] {
//official links
"https://my.atlassian.com/download/feeds/archived/bamboo.json",
"https://my.atlassian.com/download/feeds/archived/clover.json",
"https://my.atlassian.com/download/feeds/archived/confluence.json",
"https://my.atlassian.com/download/feeds/archived/crowd.json",
"https://my.atlassian.com/download/feeds/archived/crucible.json",
"https://my.atlassian.com/download/feeds/archived/fisheye.json",
"https://my.atlassian.com/download/feeds/archived/jira-core.json",
"https://my.atlassian.com/download/feeds/archived/jira-servicedesk.json",
"https://my.atlassian.com/download/feeds/archived/jira-software.json",
"https://my.atlassian.com/download/feeds/archived/jira.json",
"https://my.atlassian.com/download/feeds/archived/stash.json",
"https://my.atlassian.com/download/feeds/archived/mesh.json",
//cdn mirror of official links
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/bamboo.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/clover.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/confluence.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/crowd.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/crucible.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/fisheye.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira-core.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira-servicedesk.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira-software.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/jira.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/stash.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/mesh.json",
//official links
"https://my.atlassian.com/download/feeds/current/bamboo.json",
"https://my.atlassian.com/download/feeds/current/clover.json",
"https://my.atlassian.com/download/feeds/current/confluence.json",
"https://my.atlassian.com/download/feeds/current/crowd.json",
"https://my.atlassian.com/download/feeds/current/crucible.json",
"https://my.atlassian.com/download/feeds/current/fisheye.json",
"https://my.atlassian.com/download/feeds/current/jira-core.json",
"https://my.atlassian.com/download/feeds/current/jira-servicedesk.json",
"https://my.atlassian.com/download/feeds/current/jira-software.json",
"https://my.atlassian.com/download/feeds/current/stash.json",
"https://my.atlassian.com/download/feeds/current/mesh.json",
//cdn mirror of official links
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/bamboo.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/clover.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/confluence.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/crowd.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/crucible.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/fisheye.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/jira-core.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/jira-servicedesk.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/jira-software.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/stash.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/mesh.json",
//official links
"https://my.atlassian.com/download/feeds/eap/bamboo.json",
"https://my.atlassian.com/download/feeds/eap/confluence.json",
"https://my.atlassian.com/download/feeds/eap/jira.json",
"https://my.atlassian.com/download/feeds/eap/jira-servicedesk.json",
"https://my.atlassian.com/download/feeds/eap/stash.json",
//"https://my.atlassian.com/download/feeds/eap/mesh.json", //404
//cdn mirror of official links
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/bamboo.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/confluence.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/jira.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/jira-servicedesk.json",
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/stash.json",
//"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/eap/mesh.json", //404
//https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json //unstable link with r\l
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/archived/sourcetree.json",
//https://raw.githubusercontent.com/EpicMorg/atlassian-json/master/json-backups/current/sourcetree.json //unstable link with r\l
"https://raw.githack.com/EpicMorg/atlassian-json/master/json-backups/current/sourcetree.json"
};
}

View File

@ -1,73 +1,106 @@
namespace EpicMorg.Atlassian.Downloader; using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using EpicMorg.Atlassian.Downloader.Core; var appTitle = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var appStartupDate = DateTime.Now;
var appBuildType = "[Release]";
#if DEBUG
appBuildType = "[Debug]";
#endif
using Microsoft.Extensions.Configuration; var outputDir = "output";
using Microsoft.Extensions.DependencyInjection; var feedUrls =
using Microsoft.Extensions.Hosting; new[] {
using Microsoft.Extensions.Logging; "https://my.atlassian.com/download/feeds/archived/bamboo.json",
"https://my.atlassian.com/download/feeds/archived/confluence.json",
"https://my.atlassian.com/download/feeds/archived/crowd.json",
"https://my.atlassian.com/download/feeds/archived/crucible.json",
"https://my.atlassian.com/download/feeds/archived/fisheye.json",
"https://my.atlassian.com/download/feeds/archived/jira-core.json",
"https://my.atlassian.com/download/feeds/archived/jira-servicedesk.json",
"https://my.atlassian.com/download/feeds/archived/jira-software.json",
"https://my.atlassian.com/download/feeds/archived/jira.json",
"https://my.atlassian.com/download/feeds/archived/stash.json",
using Serilog; "https://my.atlassian.com/download/feeds/current/bamboo.json",
"https://my.atlassian.com/download/feeds/current/confluence.json",
"https://my.atlassian.com/download/feeds/current/crowd.json",
"https://my.atlassian.com/download/feeds/current/crucible.json",
"https://my.atlassian.com/download/feeds/current/fisheye.json",
"https://my.atlassian.com/download/feeds/current/jira-core.json",
"https://my.atlassian.com/download/feeds/current/jira-servicedesk.json",
"https://my.atlassian.com/download/feeds/current/jira-software.json",
"https://my.atlassian.com/download/feeds/current/stash.json"
};
using System; Console.Title = $"{appTitle} {appVersion} {appBuildType}";
using System.Threading.Tasks; Console.WriteLine($"Download started at {appStartupDate}.");
public class Program var client = new HttpClient();
foreach (var feedUrl in feedUrls)
{ {
/// <summary> var feedDir = Path.Combine(outputDir, feedUrl[(feedUrl.LastIndexOf('/') + 1)..(feedUrl.LastIndexOf('.'))]);
/// Atlassian archive downloader. See https://github.com/EpicMorg/atlassian-downloader for more info var atlassianJson = await client.GetStringAsync(feedUrl);
/// </summary> var callString = "downloads(";
/// <param name="action">Action to perform</param> var json = atlassianJson[callString.Length..^1];
/// <param name="outputDir">Override output directory to download</param> var parsed = JsonSerializer.Deserialize<ResponseArray[]>(json, new JsonSerializerOptions
/// <param name="customFeed">Override URIs to import</param>
/// <param name="about">Show credits banner</param>
/// <param name="productVersion">Override target version to download some product. Advice: Use it with "customFeed".</param>
/// <param name="skipFileCheck">Skip compare of file sizes if a local file already exists. Existing file will be skipped to check and redownload.</param>
/// <param name="userAgent">Set custom user agent via this feature flag.</param>
/// <param name="maxRetries">Set custom count of download retries.</param>
/// <param name="delayBetweenRetries">Set custom delay between retries (in milliseconds).</param>
static async Task Main(
string? outputDir = default,
Uri[]? customFeed = null,
DownloadAction action = DownloadAction.Download,
bool about = false,
string? productVersion = null,
bool skipFileCheck = false,
int maxRetries = 5,
int delayBetweenRetries = 2500,
string userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0") => await
Host
.CreateDefaultBuilder()
.ConfigureHostConfiguration(configHost => configHost.AddEnvironmentVariables())
.ConfigureAppConfiguration((ctx, configuration) =>
configuration
.SetBasePath(System.AppContext.BaseDirectory)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables())
.ConfigureServices((ctx, services) => services
.AddOptions()
.AddLogging(builder =>
{ {
Log.Logger = new LoggerConfiguration() PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
.ReadFrom.Configuration(ctx.Configuration) });
.CreateLogger(); var versions = parsed.GroupBy(a => a.Version).ToDictionary(a => a.Key, a => a.ToArray());
_ = builder
.ClearProviders() foreach (var version in versions)
.AddSerilog(dispose: true); {
}) var directory = Path.Combine(feedDir, version.Key);
.AddHostedService<DownloaderService>() if (!Directory.Exists(directory))
.AddSingleton(new DownloaderOptions( {
outputDir ?? Environment.CurrentDirectory, Directory.CreateDirectory(directory);
customFeed, }
action, foreach (var file in version.Value)
about, {
productVersion, var serverPath = file.ZipUrl.PathAndQuery;
skipFileCheck, var outputFile = Path.Combine(directory, serverPath[(serverPath.LastIndexOf("/") + 1)..]);
userAgent, if (!File.Exists(outputFile))
maxRetries, {
delayBetweenRetries)) if (!string.IsNullOrEmpty(file.Md5))
.AddHttpClient()) {
.RunConsoleAsync() File.WriteAllText(outputFile + ".md5", file.Md5);
.ConfigureAwait(false); }
using var outputStream = File.OpenWrite(outputFile);
using var request = await client.GetStreamAsync(file.ZipUrl).ConfigureAwait(false);
await request.CopyToAsync(outputStream).ConfigureAwait(false);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"[INFO] File \"{file.ZipUrl}\" successfully downloaded to \"{outputFile}\".");
Console.ResetColor();
}
else
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"[WARN] File \"{outputFile}\" already exists. Download from \"{file.ZipUrl}\" skipped.");
Console.ResetColor();
}
}
}
Console.WriteLine($"[SUCCESS] All files from \"{feedUrl}\" successfully downloaded.");
}
Console.WriteLine($"Download complete at {appStartupDate}.");
public partial class ResponseArray
{
public string Description { get; set; }
public string Edition { get; set; }
public Uri ZipUrl { get; set; }
public object TarUrl { get; set; }
public string Md5 { get; set; }
public string Size { get; set; }
public string Released { get; set; }
public string Type { get; set; }
public string Platform { get; set; }
public string Version { get; set; }
public Uri ReleaseNotes { get; set; }
public Uri UpgradeNotes { get; set; }
} }

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\linux-arm\publish\</PublishDir>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\linux-arm64\publish\</PublishDir>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\linux-bionic-x64\publish\</PublishDir>
<RuntimeIdentifier>linux-bionic-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\linux-musl-x64\publish\</PublishDir>
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\linux-x64\publish\</PublishDir>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\osx-arm64\publish\</PublishDir>
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\osx-x64\publish\</PublishDir>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\win-arm64\publish\</PublishDir>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\win-x64\publish\</PublishDir>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<!--target runtime-->
<PublishDir>bin\Release\net8.0\win-x86\publish\</PublishDir>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
</Project>

View File

@ -1,10 +0,0 @@
{
"profiles": {
"atlassian-downloader": {
"commandName": "Project",
//"commandLineArgs": "--version"
"commandLineArgs": "--help"
// "commandLineArgs": "--action=ShowRawJson --output-dir=F:\\temp\\atlassian\\test1"
}
}
}

View File

@ -1,30 +0,0 @@
{
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Literate, Serilog.Sinks.Console"
}
}
,
{
"Name": "Logger",
"Args": {
"configureLogger": {
"WriteTo": [
{
"Name": "RollingFile",
"Args": {
"pathFormat": "log.{Date}.log",
"retainedFileCountLimit": 5
}
}
]
}
}
}
]
}
}

View File

@ -1,65 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!--publish config-->
<PublishSingleFile>false</PublishSingleFile>
<PublishTrimmed>false</PublishTrimmed>
<PublishAot>false</PublishAot>
<SelfContained>true</SelfContained>
<PublishReadyToRun>false</PublishReadyToRun>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<!--build props-->
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<!--package metadata-->
<PackageId>EpicMorg.Atlassian.Downloader</PackageId>
<Authors>EpicMorg, kasthack, stam</Authors>
<Description>Atlassian Downloader by EpicMorg</Description>
<PackageProjectUrl>https://github.com/EpicMorg/atlassian-downloader</PackageProjectUrl>
<PackageIcon>favicon.png</PackageIcon>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
<AssemblyVersion>2.0.0.2</AssemblyVersion>
<FileVersion>2.0.0.2</FileVersion>
<Version>2.0.0.2</Version>
<Copyright>EpicMorg 2024</Copyright>
<Product>Atlassian Downloader</Product>
<Company>EpicMorg</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RootNamespace>EpicMorg.Atlassian.Downloader</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.4.0-alpha.22272.1" />
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="favicon.png">
<Pack>True</Pack>
<PackagePath>
</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -1,47 +0,0 @@
SET DOTNET_CLI_TELEMETRY_OPTOUT=true
SET DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
dotnet.exe publish -p:PublishProfile=win-x64 --force
dotnet.exe publish -p:PublishProfile=win-x86 --force
dotnet.exe publish -p:PublishProfile=win-arm64 --force
dotnet.exe publish -p:PublishProfile=osx-x64 --force
dotnet.exe publish -p:PublishProfile=osx-arm64 --force
dotnet.exe publish -p:PublishProfile=linux-x64 --force
dotnet.exe publish -p:PublishProfile=linux-musl-x64 --force
dotnet.exe publish -p:PublishProfile=linux-arm --force
dotnet.exe publish -p:PublishProfile=linux-arm64 --force
dotnet.exe publish -p:PublishProfile=linux-bionic-x64 --force
del /F bin\\Release\\net8.0\\win-x64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\win-x86\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\win-arm64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\osx-x64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\osx-arm64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\linux-x64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\linux-musl-x64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\linux-arm\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\linux-arm64\\publish\\atlassian-downloader.pdb
del /F bin\\Release\\net8.0\\linux-bionic-x64\\publish\\atlassian-downloader.pdb
type nul > bin/Release/net8.0/win-x64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/win-x86/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/win-arm64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/osx-x64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/osx-arm64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/linux-x64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/linux-musl-x64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/linux-arm/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/linux-arm64/publish/createdump.exe.ignore
type nul > bin/Release/net8.0/linux-bionic-x64/publish/createdump.exe.ignore
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x64.zip ./bin/Release/net8.0/win-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x86.zip ./bin/Release/net8.0/win-x86/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-arm64.zip ./bin/Release/net8.0/win-arm64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-x64.zip ./bin/Release/net8.0/osx-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-arm64.zip ./bin/Release/net8.0/osx-arm64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-x64.zip ./bin/Release/net8.0/linux-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-musl-x64.zip ./bin/Release/net8.0/linux-musl-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm.zip ./bin/Release/net8.0/linux-arm/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm64.zip ./bin/Release/net8.0/linux-arm64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-bionic-x64.zip ./bin/Release/net8.0/linux-bionic-x64/publish/*

View File

@ -1,47 +0,0 @@
#!/./bin/bash
export DOTNET_CLI_TELEMETRY_OPTOUT=true
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
dotnet publish -p:PublishProfile=win-x64 --force
dotnet publish -p:PublishProfile=win-x86 --force
dotnet publish -p:PublishProfile=win-arm64 --force
dotnet publish -p:PublishProfile=osx-x64 --force
dotnet publish -p:PublishProfile=osx-arm64 --force
dotnet publish -p:PublishProfile=linux-x64 --force
dotnet publish -p:PublishProfile=linux-musl-x64 --force
dotnet publish -p:PublishProfile=linux-arm --force
dotnet publish -p:PublishProfile=linux-arm64 --force
dotnet publish -p:PublishProfile=linux-bionic-x64 --force
rm -rfv ./bin/Release/net8.0/win-x64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/win-x86/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/win-arm64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/osx-x64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/osx-arm64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/linux-x64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/linux-musl-x64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/linux-arm/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/linux-arm64/publish/atlassian-downloader.pdb
rm -rfv ./bin/Release/net8.0/linux-bionic-x64/publish/atlassian-downloader.pdb
touch ./bin/Release/net8.0/win-x64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/win-x86/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/win-arm64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/osx-x64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/osx-arm64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/linux-x64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/linux-musl-x64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/linux-arm/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/linux-arm64/publish/createdump.exe.ignore
touch ./bin/Release/net8.0/linux-bionic-x64/publish/createdump.exe.ignore
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x64.zip ././bin/Release/net8.0/win-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-x86.zip ././bin/Release/net8.0/win-x86/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-win-arm64.zip ././bin/Release/net8.0/win-arm64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-x64.zip ././bin/Release/net8.0/osx-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-osx-arm64.zip ././bin/Release/net8.0/osx-arm64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-x64.zip ././bin/Release/net8.0/linux-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-musl-x64.zip ././bin/Release/net8.0/linu-musl-x64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm.zip ././bin/Release/net8.0/linux-arm/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-arm64.zip ././bin/Release/net8.0/linux-arm64/publish/*
7z a -tzip -mx5 -r0 ./bin/atlassian-downloader-net8.0-linux-bionic-x64.zip ././bin/Release/net8.0/linu-bionic-x64/publish/*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 15 KiB