Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/cn/har01d/alist_tvbox/dto/AccountDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public class AccountDto {
private boolean showMyAli;
private boolean master;
private boolean clean;
private boolean force;
}
15 changes: 10 additions & 5 deletions src/main/java/cn/har01d/alist_tvbox/service/AccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ public Account create(AccountDto dto) {
if (count == 0) {
showMyAli(account);
} else {
showMyAliWithAPI(account);
showMyAliWithAPI(account, dto.isForce());
}
return account;
}
Expand Down Expand Up @@ -850,7 +850,7 @@ public Account update(Integer id, AccountDto dto) {
}

if (aliChanged) {
showMyAliWithAPI(account);
showMyAliWithAPI(account, dto.isForce());
}

if (tokenChanged && account.isMaster()) {
Expand Down Expand Up @@ -921,9 +921,9 @@ public void showMyAli(Account account) {
}
}

public void showMyAliWithAPI(Account account) {
public void showMyAliWithAPI(Account account, boolean force) {
int status = aListLocalService.getAListStatus();
if (status == 1) {
if (!force && status == 1) {
throw new BadRequestException("AList服务启动中");
}

Expand All @@ -932,6 +932,11 @@ public void showMyAliWithAPI(Account account) {
if (status == 2) {
deleteStorage(storageId, token);
deleteStorage(storageId + 1, token);
} else {
String sql = "DELETE FROM x_storages WHERE id = " + storageId;
Utils.executeUpdate(sql);
sql = "DELETE FROM x_storages WHERE id = " + storageId + 1;
Utils.executeUpdate(sql);
}

try {
Expand Down Expand Up @@ -983,7 +988,7 @@ public void delete(Integer id) {
}
accountRepository.deleteById(id);
account.setShowMyAli(false);
showMyAliWithAPI(account);
showMyAliWithAPI(account, true);
}
}

Expand Down
10 changes: 10 additions & 0 deletions web-ui/src/views/AccountsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@
inactive-text="关闭"
/>
</el-form-item>
<el-form-item label="强制更新">
<el-switch
v-model="form.force"
inline-prompt
active-text="是"
inactive-text="否"
/>
</el-form-item>
<el-form-item label="上次签到时间" v-if="form.checkinTime">
<el-input :model-value="formatTime(form.checkinTime)" readonly/>
<span class="hint" v-if="form.checkinDays">{{ form.nickname }} 本月签到{{ form.checkinDays }}次</span>
Expand Down Expand Up @@ -269,6 +277,7 @@ const form = ref({
accessTokenOpen: '',
autoCheckin: true,
showMyAli: false,
force: false,
master: false,
refreshTokenTime: '',
openTokenTime: '',
Expand Down Expand Up @@ -326,6 +335,7 @@ const handleAdd = () => {
accessTokenOpen: '',
autoCheckin: true,
showMyAli: false,
force: false,
master: false,
refreshTokenTime: '',
openTokenTime: '',
Expand Down