Handle repos /w branch

This commit is contained in:
Twentysix 2020-09-27 00:54:17 +02:00
parent 67bb5f7c4c
commit 2b9c56febc

View File

@ -23,10 +23,12 @@ $cogs = array();
foreach($json as $source => $sourceData){
foreach($sourceData['rx_cogs'] as $cogId => $cog){
$cog['id'] = $cogId;
$cog['source'] = $source;
list($url, $branch) = explode('@', $source, 2);
$cog['source'] = $url;
$cog['source_name'] = $sourceData['name'];
$cog['rx_category'] = $sourceData['rx_category'];
$cog['rx_branch'] = $sourceData['rx_branch'];
if(!empty($cog['max_bot_version'])){
array_unshift($cog['requirements'], 'Bot<=' . $cog['min_bot_version']);
@ -129,7 +131,7 @@ $cog_chunks = array_chunk($cogs, $per_page);
<t><svg class="icon" viewBox="0 0 16 19">
<path fill-rule="evenodd" d="M0 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm13 .25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zM2.25 8a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 3 8.75v-.5A.25.25 0 0 0 2.75 8h-.5zM4 8.25A.25.25 0 0 1 4.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 4 8.75v-.5zM6.25 8a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 7 8.75v-.5A.25.25 0 0 0 6.75 8h-.5zM8 8.25A.25.25 0 0 1 8.25 8h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 8 8.75v-.5zM13.25 8a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-.5zm0 2a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-.5zm-3-2a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-1.5zm.75 2.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zM11.25 6a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-.5zM9 6.25A.25.25 0 0 1 9.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 9 6.75v-.5zM7.25 6a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h.5A.25.25 0 0 0 8 6.75v-.5A.25.25 0 0 0 7.75 6h-.5zM5 6.25A.25.25 0 0 1 5.25 6h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5A.25.25 0 0 1 5 6.75v-.5zM2.25 6a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 4 6.75v-.5A.25.25 0 0 0 3.75 6h-1.5zM2 10.25a.25.25 0 0 1 .25-.25h.5a.25.25 0 0 1 .25.25v.5a.25.25 0 0 1-.25.25h-.5a.25.25 0 0 1-.25-.25v-.5zM4.25 10a.25.25 0 0 0-.25.25v.5c0 .138.112.25.25.25h5.5a.25.25 0 0 0 .25-.25v-.5a.25.25 0 0 0-.25-.25h-5.5z"></path>
</svg><b>Installation commands</b><l>repo add <?php print(strtolower($cog['source_name'])); ?> <?php print($cog['source']);?></l><l>cog install <?php print(strtolower($cog['source_name'])); ?> <?php print($cog['id']); ?></l></t>
</svg><b>Installation commands</b><l>repo add <?php print(strtolower($cog['source_name'])); ?> <?php print($cog['source']);?> <?php print($cog['rx_branch']);?></l><l>cog install <?php print(strtolower($cog['source_name'])); ?> <?php print($cog['id']); ?></l></t>
<f><?php sort($cog['tags']);foreach($cog['tags'] as $tag){?><tag href="?filter=<?php print($tag); ?>"><?php print($tag); ?></tag><?php }?><src href="<?php print($cog['source']);?>">View Repository</src></f>
</div>
<?php }} ?>