mod-list/index.html
2020-02-07 13:44:04 +00:00

265 lines
8.7 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Linuxserver Container Mods</title>
<meta name="description" content="List of mods for Linuxserver.io containers">
<meta name="author" content="linuxserver.io">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400&display=swap" rel="stylesheet">
<style>
body,html {
padding: 0;
margin: 0;
}
body {
background: #e8e8e8;
font-family: 'Lato', sans-serif;
color: #738694;
font-weight: 400;
font-size: 16px;
}
body * {
box-sizing: border-box;
}
code {
font-family: 'Lato', sans-serif;
font-size: 14px;
background: #e8e8e8;
padding: 2px 5px;
border-radius: 3px;
}
#app {
display: flex;
flex-direction: column;
align-items: center;
padding: 15px;
}
#page_content {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
margin-bottom: 50px;
}
h1 {
font-size: 30px;
letter-spacing: 3px;
text-transform: uppercase;
color: #738694;
margin: 60px 0 45px;
font-weight: 400;
}
h1 span {
color: #9bb0bf;
}
.section, .content {
width: 100%;
max-width: 600px;
display: flex;
align-items: center;
background: #efefef;
justify-content: space-between;
text-decoration: none;
margin: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.05);
}
.content {
padding: 30px;
word-break: break-word;
}
.content ul {
padding-left: 25px;
}
.content li {
margin: 15px 0;
line-height: 1.4;
}
.section h2 {
margin: 0;
flex: 1;
padding: 0 30px;
color: #738694;
font-weight: 400;
text-transform: uppercase;
font-size: 18px;
}
.section .modcount {
width: 80px;
height: 80px;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
flex-direction: column;
background: #3e81b9;
color: #fff;
}
.section .modcount span {
font-size: 12px;
color: #ffffffa8;
text-transform: uppercase;
}
.section .go {
width: 80px;
height: 80px;
background: #f5f5f5;
display: flex;
justify-content: center;
align-items: center;
}
.back-to-list, .add-mod {
position: fixed;
left: 0;
right: 0;
padding: 20px;
background: #7d9a94;
color: #fff;
bottom: 0;
text-decoration: none;
font-weight: 400;
text-align: center;
box-shadow: 0 -20px 10px #e8e8e8d4;
}
.add-mod {
background: #977c9e;
}
.title {
font-size: 25px;
padding: 20px;
text-align: center;
text-transform: uppercase;
background: #e4e4e4;
margin-bottom: 25px;
width: 100%;
max-width: 600px;
}
.add {
width: 100%;
max-width: 600px;
display: flex;
justify-content: center;
text-decoration: none;
margin: 10px;
border: 5px dashed #ccc;
font-size: 25px;
padding: 20px;
color: #ccc;
font-weight: 400;
text-transform: uppercase;
}
@media only screen and (min-width: 500px) {
h1 {
font-size: 50px;
letter-spacing: 5px;
}
.back-to-list, .add-mod {
padding: 15px;
top: 50%;
bottom: auto;
right: auto;
transform: rotate(270deg) translateZ(0);
transform-origin: 25px 25px;
box-shadow: none;
}
}
</style>
</head>
<body>
<div id="app">
<header>
<h1>Linux<span>Server</span>.io</h1>
</header>
<div id="page_content"></div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script>
var searchParams = new URLSearchParams(window.location.search)
var url = "https://linuxserver.github.io/docker-mods/mod-list.yml"
var modname = searchParams.get('mod')
//console.log(modname)
var Init = { method:'GET',mode:'cors'}
fetch(url,Init)
.then((resp) => resp.text())
.then((data) => {
renderpage(data, modname)
});
function renderpage(data, modname = null){
yaml = jsyaml.load(data)
let allowedmods = Object.keys(yaml.mods)
if(modname === null) {
return modList(yaml)
}
if(modname === 'create') {
return create()
}
let validmod = $.inArray( modname, allowedmods );
if(validmod === -1) {
return create()
}
return displayMod(modname, yaml.mods[modname].container_mods)
}
function modList(yaml) {
$('#page_content').empty()
$("#page_content").append('<a class="add-mod" href="./?mod=create">Add a mod</a>')
$.each(yaml.mods, function( index, value ) {
$( "#page_content" ).append('<a class="section" href="./?mod='+index+'"><div class="modcount">'+value.mod_count+'<span>Mods</span></div><h2>'+index+'</h2><div class="go"><svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" viewBox="0 0 24 24"><path style="fill:#cfd4d8;" d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"/></svg></div></a>')
});
}
function create() {
$('#page_content').empty()
$("#page_content").append(`<a class="back-to-list" href=".">Back to list</a>
<div class="title">Submitting a PR for a Mod to be added to the official LinuxServer.io repo</div>
<div class="content">
<ul>
<li>Ask the team to create a new branch named <code>&lt;baseimagename&gt;-&lt;modname&gt;</code> in this repo. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the [template branch](https://github.com/linuxserver/docker-mods/tree/template).</li>
<li>Fork the repo, checkout the template branch.</li>
<li>Edit the <code>Dockerfile</code> for the mod. <code>Dockerfile.complex</code> is only an example and included for reference; it should be deleted when done.</li>
<li>Inspect the <code>root</code> folder contents. Edit, add and remove as necessary.</li>
<li>Edit this readme with pertinent info, delete these instructions.</li>
<li>Finally edit the <code>travis.yml</code>. Customize the build branch, and the vars for <code>BASEIMAGE</code> and <code>MODNAME</code>.</li>
<li>Submit PR against the branch created by the team.</li>
<li>Make sure that the commits in the PR are squashed.</li>
<li>Also make sure that the commit and PR titles are in the format of <code>&lt;imagename&gt;: &lt;modname&gt; &lt;very brief description like "initial release" or "update"&gt;</code>. Detailed description and further info should be provided in the body (ie. <code>code-server: python2 add python-pip</code>).</li>
</ul></div>`)
}
function displayMod(modname, mods) {
$('#page_content').empty()
$("#page_content").append('<a class="back-to-list" href=".">Back to list</a><div class="title">'+modname+'</div>')
$.each(mods, function( index, value ) {
var name = Object.keys(value)
var url = Object.values(value)
$( "#page_content" ).append(`<a class="section" href="`+url+`">
<div class="modcount"><svg width="40" height="40" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M512 0C229.12 0 0 229.12 0 512c0 226.56 146.56 417.92 350.08 485.76 25.6 4.48 35.2-10.88 35.2-24.32 0-12.16-.64-52.48-.64-95.36-128.64 23.68-161.92-31.36-172.16-60.16-5.76-14.72-30.72-60.16-52.48-72.32-17.92-9.6-43.52-33.28-.64-33.92 40.32-.64 69.12 37.12 78.72 52.48 46.08 77.44 119.68 55.68 149.12 42.24 4.48-33.28 17.92-55.68 32.64-68.48-113.92-12.8-232.96-56.96-232.96-252.8 0-55.68 19.84-101.76 52.48-137.6-5.12-12.8-23.04-65.28 5.12-135.68 0 0 42.88-13.44 140.8 52.48 40.96-11.52 84.48-17.28 128-17.28 43.52 0 87.04 5.76 128 17.28 97.92-66.56 140.8-52.48 140.8-52.48 28.16 70.4 10.24 122.88 5.12 135.68 32.64 35.84 52.48 81.28 52.48 137.6 0 196.48-119.68 240-233.6 252.8 18.56 16 34.56 46.72 34.56 94.72 0 68.48-.64 123.52-.64 140.8 0 13.44 9.6 29.44 35.2 24.32C877.44 929.92 1024 737.92 1024 512 1024 229.12 794.88 0 512 0z" fill="#dee4e8"/>
</svg></div>
<h2>`+name+`</h2>
<div class="go"><svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" viewBox="0 0 24 24"><path style="fill:#cfd4d8;" d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"/></svg></div>
</a>`);
})
$("#page_content").append('<a href="./?mod=create" class="add">Add a mod</a>')
}
</script>
</body>
</html>