Compare commits

..

1 Commits

Author SHA1 Message Date
5b55646789 修改: debian/changelog
修改:     debian/control
	修改:     src/main.cpp
	修改:     src/widget.cpp
	新文件:   tool/btinst
	修改:     translations/spark-store_zh_CN.ts
2022-04-03 17:44:39 +08:00
19 changed files with 74 additions and 336 deletions

33
debian/changelog vendored
View File

@@ -1,32 +1,5 @@
spark-store (3.0.3-12) stable; urgency=medium
spark-store (3.0.3-11~bt) stable; urgency=medium
* BT test 01
* Rollback to use DApplication::loadDXcbPlugin() to make titlebar behave normally in ubuntu
* Now can run on Debian 11
* Now can run on Ubuntu 22.04
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
spark-store (3.0.3-11) stable; urgency=medium
* Now support autoupdate
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
spark-store (3.0.3-10) stable; urgency=medium
* Now also compile dstore patch
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800
spark-store (3.0.3-9) stable; urgency=medium
* Support dpkg-buildpackage
-- shenmo <shenmo@spark-app.store> Mon, 17 Jan 2022 00:00:00 +0800

15
debian/control vendored
View File

@@ -11,9 +11,9 @@ Build-Depends:
libqt5widgets5,
libqt5network5,
libqt5concurrent5,
libdtkcore-dev(>=5.2),
libdtkgui-dev(>=5.2),
libdtkwidget-dev(>=5.2),
libdtkcore-dev,
libdtkgui-dev,
libdtkwidget-dev,
qttools5-private-dev,
libnotify-dev,
qtwebengine5-dev
@@ -29,11 +29,10 @@ Depends:${shlibs:Depends}, ${misc:Depends},
libqt5widgets5,
libqt5network5,
libqt5concurrent5,
libdtkcore5(>=5.2),
libdtkgui5(>=5.2),
libdtkwidget5(>=5.2),
libdtkcore5,
libdtkgui5,
libdtkwidget5,
libnotify4,
curl,
dde-qt5integration
aria2
Description: Spark Store
A community powered app store, based on DTK.

View File

@@ -1 +0,0 @@
1.0

View File

@@ -12,23 +12,13 @@ case "$1" in
ln -s -f /opt/durapps/spark-store/bin/ssinstall /usr/local/bin/ssinstall
ln -s -f /opt/durapps/spark-store/bin/spark-dstore-patch /usr/local/bin/spark-dstore-patch
# Download and install key
wget -O /tmp/spark-store-install/spark-store.asc https://d.store.deepinos.org.cn/dcs-repo.gpg-key.asc
gpg --dearmor /tmp/spark-store-install/spark-store.asc
cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg
# Run apt update to avoid users being fucked up by the non-exist dependency problem
apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
# Create symbo links to start upgrade detect
ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop /etc/xdg/autostart/spark-update-notifier.desktop
# Start upgrade detect service
systemctl enable spark-update-notifier
service spark-update-notifier start
apt update
# Update certain caches
update-icon-caches /usr/share/icons/hicolor || true

0
debian/spark-store.postrm vendored Executable file → Normal file
View File

View File

@@ -1,27 +0,0 @@
#!/bin/bash
#检测网络链接畅通
function network-check()
{
#超时时间
local timeout=1
#目标网站
local target=www.baidu.com
#获取响应状态码
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
if [ "x$ret_code" = "x200" ]; then
echo "Network Checked successful ! Continue..."
echo "网络通畅,继续安装"
else
#网络不畅通
echo "Network failed ! Cancel the installation"
echo "网络不畅,终止安装"
exit -1
fi
}
network-check

View File

@@ -7,28 +7,9 @@ rm /usr/local/bin/spark-dstore-patch
rm /usr/local/bin/ussinstall
rm /usr/local/bin/ussremove
# Remove residual symbol links to stop upgrade detect if exist
if [ -f /etc/xdg/autostart/spark-update-notifier.desktop ];then
rm /etc/xdg/autostart/spark-update-notifier.desktop
fi
# Shutdown services
service spark-update-notifier stop
# Stop update detect service
systemctl disable spark-update-notifier
# Clean the service place file
if [ -d "/tmp/spark-store-updatenum/" ] ; then
rm -rf /tmp/spark-store-updatenum/s
fi
# Remove gpg key file
if [ -f "/etc/apt/trusted.gpg.d/spark-store.gpg" ] ; then
rm /etc/apt/trusted.gpg.d/spark-store.gpg
fi
apt-key del '9D9A A859 F750 24B1 A1EC E16E 0E41 D354 A29A 440C'

View File

@@ -1,14 +0,0 @@
[Unit]
Description=Spark Store update notifier
After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify-placer.sh
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target

View File

@@ -30,10 +30,6 @@ sourceslist.path = /etc/apt/sources.list.d
desktop.files += pkg/usr/share/applications/spark-store.desktop
desktop.path = /usr/share/applications
service.files += pkg/usr/lib/systemd/system/spark-update-notifier.service
service.path = /usr/lib/systemd/system/
icon.files += pkg/usr/share/icons/hicolor/scalable/apps/spark-store.svg
icon.path = /usr/share/icons/hicolor/scalable/apps
@@ -47,5 +43,4 @@ INSTALLS += \
icon \
sourceslist \
preferences \
tmp \
service
tmp

View File

@@ -1,8 +1,7 @@
#include <DApplication>
#include <DApplicationSettings>
#include <DWidgetUtil> // Dtk::Widget::moveToCenter(&w); 要调用它,就得引用 DWidgetUtil
#include <QVector>
#include <DAboutDialog>
#include <QScreen>
#include "widget.h"
@@ -10,47 +9,19 @@
DWIDGET_USE_NAMESPACE
int main(int argc, char *argv[])
{
DApplication::loadDXcbPlugin(); // 已废弃但是对于非deepin桌面可以正常使用标题栏
DApplication::loadDXcbPlugin(); // 让 bar 处在标题栏
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
// 程序内强制添加"-platformtheme deepin"参数喂给Qt让Qt正确使用Deepin主题修复各种奇怪样式问题
QVector<char*> fakeArgs(argc + 2);
fakeArgs[0] = argv[0];
fakeArgs[1] = "-platformtheme";
fakeArgs[2] = "deepin";
for(int i = 1; i < argc; i++) fakeArgs[i + 2] = argv[i];
int fakeArgc = argc + 2; // 为啥DApplication的argc要用引用啊
DApplication a(fakeArgc, fakeArgs.data());
DApplication a(argc, argv);
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.loadTranslator(); // 载入翻译
/* Customized DAboutDialog (Can't work on other distro like Ubuntu...)
*
* DAboutDialog dialog;
* a.setAboutDialog(&dialog);
* dialog.setLicense(QObject::tr("We publish this program under GPL V3"));
* dialog.setVersion(DApplication::buildVersion("Version 2.0.2.5"));
* dialog.setProductIcon(QIcon::fromTheme("spark-store")); // 设置Logo
* dialog.setProductName(QLabel::tr("Spark Store"));
* dialog.setDescription(
* QObject::tr(
* "<span style=' font-size:10pt;font-weight:60;'>An appstore powered by deepin community</span><br/>"
* "<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
* "<span style=' font-size:12pt;'>Spark developers</span>"
* )
* );
* dialog.setProductName(QLabel::tr("Spark Store"));
* dialog.setCompanyLogo(QPixmap(":/Logo-Spark.png"));
* dialog.setWebsiteName(QObject::tr("The Spark Project"));
* dialog.setWebsiteLink("https://gitee.com/deepin-community-store");
*/
a.setProductName(QLabel::tr("Spark Store"));
a.setProductIcon(QIcon::fromTheme("spark-store")); //设置Logo
a.setOrganizationName("spark-union");
a.setOrganizationDomain("https://www.deepinos.org/");
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
a.setApplicationVersion(DApplication::buildVersion("3.0.3-12"));
a.setApplicationVersion(DApplication::buildVersion("3.0.3-11~bt"));
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
a.setApplicationDescription(
QObject::tr(

View File

@@ -18,7 +18,7 @@
#include <QSettings>
#include <QGraphicsOpacityEffect>
#include <QtConcurrent> // 并发
#include <QDebug>
#include <DApplication>
#include <DGuiApplicationHelper>
#include <DDialog>
@@ -192,18 +192,14 @@ void Widget::initUI()
// 添加菜单项
QAction *actionSubmission = new QAction(tr("Submit App"), this);
QAction *setting = new QAction(tr("Settings"));
QAction *upgrade = new QAction(tr("App Upgrade"));
QMenu *menu = new QMenu;
menu->addAction(setting);
menu->addAction(upgrade);
menu->addAction(actionSubmission);
titlebar->setMenu(menu);
connect(actionSubmission, &QAction::triggered, this, [=]{QDesktopServices::openUrl(QUrl("https://upload.deepinos.org/"));});
connect(setting, &QAction::triggered, this, &Widget::opensetting);
connect(upgrade, &QAction::triggered, this, [=]{QProcess::startDetached("x-terminal-emulator -e /opt/durapps/spark-store/bin/update-upgrade/ss-update-controler.sh");});
// 载入自定义字体
int loadedFontID = QFontDatabase::addApplicationFont(":/fonts/fonts/hksnzt.ttf");
@@ -610,19 +606,39 @@ void Widget::updatefoot()
void Widget::on_pushButton_download_clicked()
{
chooseLeftMenu(13);
// chooseLeftMenu(13);
allDownload += 1;
// allDownload += 1;
QFileInfo info(url.path());
QString fileName(info.fileName()); // 获取文件名
download_list[allDownload - 1].pkgName = pkgName;
if(fileName.isEmpty())
{
sendNotification(tr("Failed to get the name to the file to be downloaded."));
return;
}
// download_list[allDownload - 1].pkgName = pkgName;
QString downloadurl(url.path());
downloadurl.remove(0,2);
//日了获取serverurl那么远。。。直接写死了反正在测试
downloadurl.prepend("https://d.store.deepinos.org.cn");
qInfo()<<"下载链接拼接之后是"<<downloadurl<<"注意这里的serverUrl是写死的正式上线不要用"<<endl;
QString btUrl = downloadurl + ".torrent";
qInfo()<<"合成的bt链接是"<<btUrl<<endl;
qInfo()<<"虽然很奇怪这个链接为什么要这样处理但是确实能获取到的filename是"<<fileName<<endl;
QtConcurrent::run([=]()
{
ui->pushButton_download->setEnabled(false);
QProcess btinst;
btinst.start("x-terminal-emulator", QStringList() << "-e" << "/opt/durapps/spark-store/bin/btinst" << btUrl << fileName);
btinst.waitForFinished();
ui->pushButton_download->setEnabled(true);
});
/*
download_list[allDownload - 1].setParent(ui->listWidget);
QListWidgetItem *item = new QListWidgetItem(ui->listWidget);
item->setSizeHint(download_list[allDownload - 1].size());
@@ -636,29 +652,24 @@ void Widget::on_pushButton_download_clicked()
icon.load("/tmp/spark-store/icon.png", "PNG");
system("cp /tmp/spark-store/icon.png /tmp/spark-store/icon_" + QString::number(allDownload - 1).toUtf8() + ".png");
download_list[allDownload - 1].seticon(icon);
*/
/*
if(!isBusy)
{
/*
file = new QFile(fileName);
if(!file->open(QIODevice::WriteOnly))
{
delete file;
file = nullptr;
return;
}
*/
nowDownload += 1;
startRequest(urList.at(nowDownload - 1), fileName); // 进行链接请求
}
*/
if(ui->pushButton_download->text() == tr("Reinstall"))
{
download_list[allDownload - 1].reinstall = true;
}
}
void Widget::startRequest(QUrl url, QString fileName)
{
ui->listWidget->show();
@@ -873,6 +884,8 @@ void Widget::sltAppinfoTags(QStringList *tagList)
}
}
// 在这里添加选择新的json项目比如bt专用链接
void Widget::sltAppinfoDetails(QString *name, QString *details, QString *info,
QString *website, QString *packageName, QUrl *fileUrl,
bool isInstalled, bool isUpdated)

21
tool/btinst Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# 第一个参数固定是bittorrent下载链接或者magnet
# 第二个参数就是文件名
export DISPLAY=:0
export XAUTHORITY=/home/shenmo/.Xauthority
if [ -x /tmp/spark-store/$2 ];then
rm /tmp/spark-store/$2
echo "检测到之前下载了软件包,未避免不能覆盖,先删除"
fi
mkdir -p /tmp/spark-store
cd /tmp/spark-store
echo "开始下载软件包"
aria2c "$1"
echo "安装"
pkexec ssinstall "/tmp/spark-store/$2"
echo 安装结束,按回车关闭窗口
read
exit 0

View File

@@ -1,5 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify.sh
Name=spark-update-notifier

View File

@@ -1,4 +0,0 @@
#!/bin/bash
set -e
sudo apt upgrade -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"

View File

@@ -1,63 +0,0 @@
#!/bin/bash
set -e
echo "因为目前没有有时间的Qt程序员志愿者所以现在加功能只有让shenmo写脚本了..."
echo
echo "此功能被添加的原因是为了防止影响系统更新星火源默认的优先级是400低于默认的500。这导致了与系统仓库相同包名的软件包无法正常更新到比系统仓库更高的版本。例如hugo系统仓库中的低版本会被优先安装而且默认不会更新到星火的更新的版本"
echo "此脚本可以检测星火源中是否有比当前系统更高版本的软件包,由您决定是否安装"
echo "此脚本使用apt update/apt list --upgrade/apt upgrade来更新软件源、列出更新列表和操作更新"
echo
echo "该脚本不对其使用效果有任何明示或暗示的担保,在使用前请您确保您清楚地知道您在干什么。您应当清楚,星火商店的软件包并不是适配所有发行版的;尽管绝大多数的软件更新是无害的,您仍然应该仔细检查显示出来的更新内容,以确保不会对您的依赖环境造成破坏,尤其是那些看起来和系统依赖相关的软件包。在查看过更新列表之后,确认更新之前,您仍有一次取消更新的机会。"
echo "本脚本的开发者不对使用该脚本可能造成的后果负责"
echo
echo
echo
echo "请按回车继续..."
#"只有回车可以用啊!""啊?"“你说的任意都行啊”“唔。。。戳到我的盲区了”
read
reset
endloop=0
while [ $endloop -eq 0 ] ;do
echo "欢迎使用星火更新工具 脚本版 "
echo "请在以下操作中选择一个进行~"
echo "输入1 开启或关闭星火更新检测工具(如果开启则会在系统启动后自动检测更新。如有更新则会弹出通知)"
echo "输入2 查看可更新软件包列表并决定是否更新"
echo "输入3 退出脚本"
read option
case $option in
1)
echo "执行以下操作需要授权..."
if [ -f /etc/xdg/autostart/spark-update-notifier.desktop ];then
echo "检测到已经启动了自动更新检测,关闭中"
sudo systemctl disable spark-update-notifier
sudo rm /etc/xdg/autostart/spark-update-notifier.desktop
else
echo "未检测到自动更新检测,启动中"
sudo systemctl enable spark-update-notifier
sudo service spark-update-notifier start
# ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop $XDG_CONFIG_HOME/autostart
#
sudo ln -s /opt/durapps/spark-store/bin/update-upgrade/autostart/spark-update-notifier.desktop /etc/xdg/autostart
/opt/durapps/spark-store/bin/update-upgrade/ss-update-notify.sh now
fi
;;
2)
echo "执行以下操作需要授权..."
/opt/durapps/spark-store/bin/update-upgrade/ss-upgrade-list.sh
/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh
;;
3)
echo "按回车退出"
exit 0
;;
*)
echo "无法识别的输入!请重新输入"
reset
esac
done

View File

@@ -1,57 +0,0 @@
#!/bin/bash
set -e
rm -rf /tmp/spark-store-updatenum/number
LANG=en.US
#!/bin/bash
#检测网络链接畅通
function network()
{
#超时时间
local timeout=1
#目标网站
local target=www.baidu.com
#获取响应状态码
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
if [ "x$ret_code" = "x200" ]; then
#网络畅通
return 0
else
#网络不畅通
return 1
fi
return 0
}
network
if [ $? -eq 1 ];then
echo "Network fail. Stop to avoid bother dpkg"
exit -1
fi
#The code above is modified from https://blog.csdn.net/yaxuan88521/article/details/120516298
updatetext=`sudo apt update -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"`
mkdir -p /tmp/spark-store-updatenum/
isupdate=`echo ${updatetext: -5}`
if [ "$isupdate" = "date." ];then
sudo echo "0" > /tmp/spark-store-updatenum/number
exit 0
fi
update_app_number=`echo ${updatetext%package*} #从右向左截取第一个 src 后的字符串`
update_app_number=`echo ${update_app_number: -1}`
sudo echo "$update_app_number" > /tmp/spark-store-updatenum/number

View File

@@ -1,28 +0,0 @@
#!/bin/bash
set -e
isexistnumber=0
if [ "$1" = "now" ];then
if [ -f /tmp/spark-store-updatenum/number ];then
update_app_number=`cat /tmp/spark-store-updatenum/number`
echo "$update_app_number"
if [ "$update_app_number" = "0" ];then
exit 0
fi
notify-send -i spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
fi
exit 0
fi
until [ $isexistnumber -eq 1 ];do
if [ -f /tmp/spark-store-updatenum/number ];then
sleep 10
update_app_number=`cat /tmp/spark-store-updatenum/number`
echo "$update_app_number"
if [ "$update_app_number" = "0" ];then
exit 0
fi
notify-send -i spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
isexistnumber=1
fi
sleep 10
done

View File

@@ -1,6 +0,0 @@
#!/bin/bash
set -e
echo "可更新的应用有:"
sudo apt list --upgradable -o Dir::Etc::sourcelist="sources.list.d/sparkstore.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"

View File

@@ -193,7 +193,7 @@
<location filename="../src/widget.cpp" line="902"/>
<location filename="../src/widget.cpp" line="1171"/>
<source>Install</source>
<translation></translation>
<translation>bt下载</translation>
</message>
<message>
<location filename="../src/widget.ui" line="313"/>