mirror of
https://github.com/EpicMorg/atlassian-json.git
synced 2025-01-14 15:48:17 +03:00
final sourcetree support by kasthack
This commit is contained in:
parent
def07345b1
commit
1ed5f22b7c
36
json-backups/sourcetreeapp.csx
Normal file
36
json-backups/sourcetreeapp.csx
Normal file
@ -0,0 +1,36 @@
|
||||
#r "nuget: AngleSharp, 1.0.0-alpha-844"
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
var source = await new System.Net.Http.HttpClient()
|
||||
.GetStringAsync("https://www.sourcetreeapp.com")
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var (startText, endText) = ("{ \"type\":\"imkt.components.SourcetreeDownload\"", "</scri");
|
||||
var startIndex = source.IndexOf(startText, System.StringComparison.Ordinal);
|
||||
var endIndex = source.IndexOf(endText, startIndex, System.StringComparison.Ordinal);
|
||||
source = source[startIndex..endIndex];
|
||||
|
||||
var json = JsonSerializer.Deserialize<Wrap>(source, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
var (a, b, c) = json.Params;
|
||||
var urls = new[] { a, b, c };
|
||||
|
||||
Console.Out.WriteLine(
|
||||
"download(" +
|
||||
JsonSerializer.Serialize(
|
||||
urls
|
||||
.Select(a => new Uri(a))
|
||||
.Select(a => new
|
||||
{
|
||||
ZipFile = a.ToString(),
|
||||
Version = new[] { "sourcetree", "enterprise", "setup", }
|
||||
.Aggregate(Path.GetFileNameWithoutExtension(a.AbsolutePath), (s, ptr) => s.Replace(ptr, "", StringComparison.OrdinalIgnoreCase))
|
||||
.TrimStart('-', '_')
|
||||
})
|
||||
.ToArray())+ ")");
|
||||
|
||||
public record Wrap(Params Params);
|
||||
public record Params(string MacUrl, string WindowsUrl, string EnterpriseUrl);
|
@ -33,7 +33,7 @@ wget -c -nv --random-wait -P $PWD/current/ https://my.atlassian.com/download/fee
|
||||
wget -c -nv --random-wait -P $PWD/current/ https://my.atlassian.com/download/feeds/current/jira-servicedesk.json
|
||||
|
||||
# SourceTree
|
||||
dotnet-script sourcetreeapp-archive.csx > $PWD/current/sourcetree.json
|
||||
dotnet script sourcetreeapp-archive.csx > $PWD/current/sourcetree.json
|
||||
|
||||
###################################################################################################
|
||||
# Archived links
|
||||
@ -64,7 +64,7 @@ wget -c -nv --random-wait -P $PWD/archived/ https://my.atlassian.com/download/fe
|
||||
wget -c -nv --random-wait -P $PWD/archived/ https://my.atlassian.com/download/feeds/archived/jira-servicedesk.json
|
||||
|
||||
# SourceTree
|
||||
dotnet-script sourcetreeapp-archive.csx > $PWD/archived/sourcetree.json
|
||||
dotnet script sourcetreeapp-archive.csx > $PWD/archived/sourcetree.json
|
||||
|
||||
###################################################################################################
|
||||
# EAP links
|
||||
|
Loading…
x
Reference in New Issue
Block a user