Initial commit
Some checks failed
定时更新GitHub源插件 / 自动更新GitHub插件 (push) Has been cancelled

This commit is contained in:
chorblack
2026-03-07 11:19:25 +08:00
commit e75f275ef4
4484 changed files with 645480 additions and 0 deletions

83
AppStore/views/js.php Normal file
View File

@@ -0,0 +1,83 @@
<?php ! defined('__TYPECHO_ROOT_DIR__') and exit();?>
<?php if ($typechoVersion <= 0.8): ?>
<script src="<?php echo $options->pluginUrl('AppStore/static/js/jquery.js'); ?>"></script>
<script>
var $jQuery = jQuery.noConflict(true);
</script>
<?php else: ?>
<script>
var $jQuery = $;
</script>
<?php endif; ?>
<script>
(function($) {
"use strict"
function init()
{
$('.as-card .as-version-selector').change(function() {
var $version = $(this).children(':selected');
var $card = $(this).parent().parent();
$card.children('.as-require').html($version.data('require'));
$card.children('.as-description').html($version.data('description'));
$card.children('.as-author').html($version.data('author'));
});
$('.as-card .as-install').click(function() {
var $this = $(this);
var $card = $this.parent().parent();
var $version = $card.children('.as-versions').children('.as-version-selector').children(':selected');
if ($card.data('existed')) {
if ($version.data('activated')) {
if (! confirm('<?php echo _t('该插件该版本已经激活使用了!\n确定继续安装吗'); ?>')) {
return false;
}
} else {
if (! confirm('<?php echo _t('该插件该版本已经存在了!\n确定继续安装吗'); ?>')) {
return false;
}
}
}
$.ajax({
url: '<?php echo str_replace('/market', '/install', Typecho_Request::getInstance()->makeUriByRequest()); ?>',
dataType: 'json',
data: {
version: $version.val(),
require: $version.data('require'),
plugin: $card.data('name')
},
beforeSend: function() {
$this.attr('disabled', true).text('安装中');
}
}).always(function() {
$this.attr('disabled', false);
}).fail(function() {
alert('安装失败');
if ($card.data('existed')) {
$this.text('重装');
} else {
$this.text('安装');
}
}).done(function(result) {
if (result.status) {
$card.data('existed', 1);
$version.data('activated', result.activated);
$this.next().children('i').addClass('as-existed active');
alert('安装成功');
window.location.reload();
} else {
alert(result.error);
}
});
});
}
init();
})($jQuery);
</script>

44
AppStore/views/list.php Normal file
View File

@@ -0,0 +1,44 @@
<div class="col-mb-12 typecho-list">
<h4 class="typecho-list-table-title">已安装的插件</h4>
<div class="typecho-table-wrap">
<?php if ($result): ?>
<table class="typecho-list-table">
<thead>
<?php include 'row-title.php'; ?>
</thead>
<tbody>
<?php foreach ($result->packages as $plugin):
if ($plugin->existed) {
include 'row.php';
}
endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="message" style="width:20em;text-align: center;margin:0 auto">
<h3 style="font-size: 2em">没有找到任何插件</h3>
</div>
<?php endif; ?>
</div>
<h4 class="typecho-list-table-title">未安装的插件</h4>
<div class="typecho-table-wrap">
<?php if ($result): ?>
<table class="typecho-list-table">
<thead>
<?php include 'row-title.php'; ?>
</thead>
<tbody>
<?php foreach ($result->packages as $plugin):
if (!$plugin->existed) {
include 'row.php';
}
endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="message" style="width:20em;text-align: center;margin:0 auto">
<h3 style="font-size: 2em">没有找到任何插件</h3>
</div>
<?php endif; ?>
</div>
</div>

55
AppStore/views/market.php Normal file
View File

@@ -0,0 +1,55 @@
<?php ! defined('__TYPECHO_ROOT_DIR__') and exit();
include TYPEHO_ADMIN_PATH.'common.php';
$menu->title = _t('应用商店');
include TYPEHO_ADMIN_PATH.'header.php';
include TYPEHO_ADMIN_PATH.'menu.php';
list($version, $buildVersion) = explode('/', Typecho_Common::VERSION);
$typechoVersion = floatval($version);
?>
<style>
.as-name,
.as-require,
.as-author,
.as-operations {
white-space: nowrap;
}
</style>
<?php if ($typechoVersion <= 0.8): ?>
<div class="main">
<div class="body container">
<div class="typecho-page-title">
<div class="column-24">
<h2><?php echo $menu->title; ?> <small><cite>The missing plugins' store for Typecho</cite></small></h2>
<div>
<a href="https://github.com/chekun/AppStore/issues" target="_blank"><?php echo _t('提建议/吐槽专用'); ?></a>
</div>
</div>
</div>
<div class="row typecho-page-main" role="main">
<?php include 'list.php'; ?>
</div>
</div>
</div>
<?php else: ?>
<div class="main">
<div class="body container">
<div class="typecho-page-title">
<h2>
<?php echo $menu->title; ?> <small><cite>The missing plugins' store for Typecho</cite></small>
<div style="float:right">
<a href="https://github.com/chekun/AppStore/issues" target="_blank"><?php echo _t('提建议/吐槽专用'); ?></a>
</div>
</h2>
</div>
<div class="row typecho-page-main" role="main">
<?php include 'list.php'; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php
include TYPEHO_ADMIN_PATH.'copyright.php';
include TYPEHO_ADMIN_PATH.'common-js.php';
include 'js.php';
include TYPEHO_ADMIN_PATH.'footer.php';
?>

View File

@@ -0,0 +1,8 @@
<tr>
<th><?php echo _t('名称'); ?></th>
<th><?php echo _t('描述'); ?></th>
<th><?php echo _t('版本'); ?></th>
<th><?php echo _t('版本要求'); ?></th>
<th><?php echo _t('作者'); ?></th>
<th><?php echo _t('操作'); ?></th>
</tr>

43
AppStore/views/row.php Normal file
View File

@@ -0,0 +1,43 @@
<?php if ($plugin->type === 'plugin'): ?>
<tr class="as-card" data-name="<?php echo $plugin->name; ?>" data-existed="<?php echo $plugin->existed ?>">
<td class="as-name"><?php echo $plugin->name; ?></td>
<td class="as-description"><?php echo $plugin->versions[0]->description; ?></td>
<td class="as-versions">
<select class="as-version-selector">
<?php foreach ($plugin->versions as $version): ?>
<option value="<?php echo $version->version; ?>" data-activated="<?php echo $version->activated; ?>" data-author="<?php echo $version->author; ?>" data-require="<?php echo $version->require; ?>" data-description="<?php echo $version->description; ?>"><?php echo $version->version; ?></option>
<?php endforeach; ?>
</select>
</td>
<td class="as-require" ><?php echo $plugin->versions[0]->require; ?></td>
<td class="as-author"><a href="<?php echo $plugin->versions[0]->link; ?>" target="_blank"><?php echo $plugin->versions[0]->author; ?></a></td>
<td class="as-operations">
<?php if ($this->installale): ?>
<?php if ($plugin->existed): ?>
<a class="as-install" href="javascript:;"><?php echo _t("重装"); ?></a>
<?php else: ?>
<a class="as-install" href="javascript:;"><?php echo _t("安装"); ?></a>
<?php endif; ?>
<?php else: ?>
<a onclick="return confirm('没有写入权限或者运行在云平台中\n点击确认后将进行下载请手动传到服务器上!');" href="<?php echo $this->server.'archive/'.$plugin->name.'/'.str_replace(' ', '%20', $version->version);?>"><?php echo _t('下载'); ?></a>
<?php endif; ?>
</td>
</tr>
<?php else: ?>
<tr class="as-card" data-name="<?php echo $plugin->name; ?>">
<td class="as-name">「主题」<?php echo $plugin->name; ?></td>
<td class="as-description"><?php echo $plugin->versions[0]->description; ?></td>
<td class="as-versions">
<select class="as-version-selector">
<?php foreach ($plugin->versions as $version): ?>
<option value="<?php echo $version->version; ?>" data-activated="<?php echo $version->activated; ?>" data-author="<?php echo $version->author; ?>" data-require="<?php echo $version->require; ?>" data-description="<?php echo $version->description; ?>"><?php echo $version->version; ?></option>
<?php endforeach; ?>
</select>
</td>
<td class="as-require" ><?php echo $plugin->versions[0]->require; ?></td>
<td class="as-author"><a href="<?php echo $plugin->versions[0]->link; ?>" target="_blank"><?php echo $plugin->versions[0]->author; ?></a></td>
<td class="as-operations">
<a onclick="return confirm('暂不支持主题下载,确定后会定向到官网下载!');" href="https://typecho.chekun.me/"><?php echo _t('下载'); ?></a>
</td>
</tr>
<?php endif; ?>