Skip to content

Commit

Permalink
Merge #582: Update Index configuration
Browse files Browse the repository at this point in the history
59a87c7 fix: [#581] update references to udpated index settings (Jose Celano)
661d6f7 fix: [#581] update Index config files (Jose Celano)

Pull request description:

  The Torrust Index config file has been updated, and some API endpoints exposing the configuration have also changed. We must apply those changes here.

  - [x] Update config files
  - [x] torrust/torrust-index-types-lib#20 (Update types lib)
  - [x] Update code referencing changes in the API response

  ### Old version

  ```toml
  [logging]
  log_level = "info"

  [tracker]
  mode = "public"
  ```

  ### New version

  ```toml
  version = "2"

  [logging]
  threshold = "info"

  [tracker]
  private = false
  listed = false
  ```

ACKs for top commit:
  josecelano:
    ACK 59a87c7

Tree-SHA512: 4f07659cf7378b10c6838bef3c1a6ffce81177ca3e66c6dd48ff85256ec6030ed95a65f12809dba0ae254c0341d17ec606cd09912fb755bed38162f64700ae29
  • Loading branch information
josecelano committed Jul 3, 2024
2 parents a40e2c7 + 59a87c7 commit 332a654
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
6 changes: 3 additions & 3 deletions components/torrent/TorrentActionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<div class="flex flex-row gap-3">
<template v-if="showDownloadButtons()">
<button class="btn btn-primary grow" data-cy="torrent-action-download" @click="downloadTorrent(torrent.info_hash, torrent.name)">
download {{ isTrackerClose()? 'private' : '' }} torrent
download {{ isTrackerPrivate()? 'private' : '' }} torrent
</button>
<button class="w-12 p-0 btn btn-primary">
<a data-cy="torrent-action-magnet-link" class="flex items-center" :href="torrent.magnet_link">
Expand Down Expand Up @@ -147,7 +147,7 @@ import {
downloadTorrent,
useRestApi,
isUserLoggedIn,
isTrackerOpen, isTrackerClose, navigateTo
isTrackerPublic, navigateTo
} from "#imports";
import { canEditThisTorrent } from "~/composables/helpers";
Expand All @@ -170,7 +170,7 @@ function hasEditRights (): boolean {
}
function showDownloadButtons (): boolean {
return isUserLoggedIn() || isTrackerOpen();
return isUserLoggedIn() || isTrackerPublic();
}
function seedersPercentage () {
Expand Down
14 changes: 6 additions & 8 deletions composables/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { type TorrentResponse, TrackerMode, type PublicSettings } from "torrust-index-types-lib";
import { type TorrentResponse, type PublicSettings } from "torrust-index-types-lib";
import { useRestApi, useSettings, useUser } from "~/composables/states";

export function isTrackerOpen (): boolean {
const settings = useSettings();

return settings.value.tracker_mode === TrackerMode.Public ||
settings.value.tracker_mode === TrackerMode.Listed;
export function isTrackerPublic (): boolean {
return !isTrackerPrivate();
}

export function isTrackerClose (): boolean {
return !isTrackerOpen();
export function isTrackerPrivate (): boolean {
const settings = useSettings();
return settings.value.tracker_private === true;
}

export function isUserLoggedIn (): boolean {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint": "eslint --ext \".ts,.js,.vue\" . --max-warnings=0" ,
"lint": "eslint --ext \".ts,.js,.vue\" . --max-warnings=0",
"lintfix": "eslint --fix --ext \".ts,.js,.vue\" .",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
Expand Down Expand Up @@ -42,7 +42,7 @@
"marked": "^12.0.2",
"notiwind-ts": "^2.0.2",
"torrust-index-api-lib": "^1.0.0-alpha.7",
"torrust-index-types-lib": "^3.0.0-alpha.1",
"torrust-index-types-lib": "^3.0.0-alpha.6",
"uuid": "^9.0.1"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
version = "2"

[tracker]
api_url = "http://tracker:1212"
mode = "private"
private = true
url = "http://tracker:7070"

[database]
Expand Down
3 changes: 3 additions & 0 deletions share/default/config/index.public.e2e.container.sqlite3.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version = "2"

[tracker]
api_url = "http://tracker:1212"
private = false
url = "udp://tracker:6969"

[database]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version = "2"

[core]
private = false

[core.database]
path = "/var/lib/torrust/tracker/database/e2e_testing_sqlite3.db"

Expand Down

0 comments on commit 332a654

Please sign in to comment.