-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
202 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,9 @@ WORKDIR /app | |
COPY . /app | ||
|
||
# 初始化数据库 | ||
RUN python manage.py migrate | ||
RUN echo "from apps.models import CustomUser; CustomUser.objects.create_superuser('[email protected]','llody', '1qaz2wsx')" | python manage.py shell | ||
RUN echo "from apps.models import Registries; registry = Registries(registries_name='DockerHub', registries_url='docker.io', registries_auth=False, registries_remarks='DockerHub'); registry.save()" | python manage.py shell | ||
# RUN python manage.py migrate | ||
# RUN echo "from apps.models import CustomUser; CustomUser.objects.create_superuser('[email protected]','llody', '1qaz2wsx')" | python manage.py shell | ||
# RUN echo "from apps.models import Registries; registry = Registries(registries_name='DockerHub', registries_url='docker.io', registries_auth=False, registries_remarks='DockerHub'); registry.save()" | python manage.py shell | ||
|
||
RUN chmod +x start.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% extends 'docker_base.html' %} | ||
{% block title %}关于{% endblock %} | ||
{% block item-9 %}layui-nav-itemed{% endblock %} | ||
{% load i18n %} | ||
{% block head_style %} | ||
<style> | ||
body { | ||
margin: 10px; | ||
} | ||
|
||
/* 标题样式 */ | ||
.layui-card-header { | ||
background-color: #f2f2f2; | ||
/* 修改标题背景颜色 */ | ||
color: #333; | ||
/* 修改标题文字颜色 */ | ||
font-size: 16px; | ||
/* 修改标题文字大小 */ | ||
border-bottom: 1px solid #e6e6e6; | ||
/* 在标题下方添加边框线 */ | ||
line-height: 36px; | ||
/* 调整行高 */ | ||
} | ||
/* 底部内边距样式*/ | ||
#fixed { | ||
padding-bottom: 40px; /* 底部填充,值应大于或等于提交按钮的高度加上一些额外空间 */ | ||
} | ||
</style> | ||
{% endblock %} | ||
{% block context %} | ||
<span class="layui-breadcrumb"> | ||
<a href="#">首页</a> | ||
<a><cite>关于</cite></a> | ||
</span> | ||
<hr> | ||
<div class="layui-card"> | ||
<div class="layui-card-body"> | ||
<div class="layui-bg-gray" style="padding: 16px;"> | ||
<div class="layui-row layui-col-space15"> | ||
<div class="layui-col-md12"> | ||
<div class="layui-card"> | ||
<div class="layui-card-header">版本</div> | ||
<div class="layui-card-body"> | ||
当前版本:<span style="color: #1e9fff;">{{ version }} </span><br> | ||
最新版本:{% if version == latest_version %} | ||
已经是最新版了 | ||
{% else %} | ||
<span style="color: #16b777;">{{ latest_version }}</span> <a href="https://github.com/llody55/udocker" target="_blank"><span style="color: #16b777;"> 查看版本差异 </span></a> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% endblock %} | ||
{% block custom_js %} | ||
JS | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,30 @@ | ||
import requests | ||
from django.core.cache import cache | ||
from udockers.settings import VERSION_STR | ||
|
||
def version(request): | ||
return {'version': VERSION_STR} | ||
return {'version': VERSION_STR} | ||
|
||
# 检查GitHub中版本 | ||
def get_latest_github_version(owner, repo): | ||
url = f'https://api.github.com/repos/{owner}/{repo}/tags' | ||
response = requests.get(url) | ||
if response.status_code == 200: | ||
tags = response.json() | ||
if tags: | ||
latest_tag = tags[0]['name'] | ||
# 去掉前缀 'v' | ||
if latest_tag.startswith('v'): | ||
latest_tag = latest_tag[1:] | ||
return latest_tag | ||
return None | ||
|
||
def latest_version(request): | ||
cache_key = 'latest_github_version' | ||
latest_version = cache.get(cache_key) | ||
if not latest_version: | ||
latest_version = get_latest_github_version('llody55', 'udocker') | ||
if latest_version: | ||
cache.set(cache_key, latest_version, 3600) | ||
show_notification = not request.session.get('update_notified', False) | ||
return {'latest_version': latest_version,'show_notification':show_notification} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters