minor improvements on how we display changelog.
This commit is contained in:
@@ -218,8 +218,7 @@
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input" id="api_url" type="url" v-model="api_url" required
|
||||
placeholder="API URL... http://localhost:8081"
|
||||
@keyup="api_status = false; api_response = ''">
|
||||
placeholder="API URL... http://localhost:8081" @keyup="api_status = false; api_response = ''">
|
||||
<p class="help">
|
||||
Use <a href="javascript:void(0)" @click="setOrigin">current page URL</a>.
|
||||
</p>
|
||||
@@ -239,8 +238,7 @@
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input class="input" id="api_path" type="text" v-model="api_path" required
|
||||
placeholder="API Path... /v1/api"
|
||||
@keyup="api_status = false; api_response = ''">
|
||||
placeholder="API Path... /v1/api" @keyup="api_status = false; api_response = ''">
|
||||
<p class="help">
|
||||
Use <a href="javascript:void(0)" @click="api_path = '/v1/api'">Set default API Path</a>.
|
||||
</p>
|
||||
@@ -283,11 +281,11 @@
|
||||
</div>
|
||||
|
||||
<div class="column is-12 mt-2">
|
||||
<Message title="Information" message_class="has-background-info-90 has-text-dark"
|
||||
icon="fas fa-info-circle">
|
||||
<Message title="Information" message_class="has-background-info-90 has-text-dark" icon="fas fa-info-circle">
|
||||
<p>
|
||||
It's possible to automatically setup the API connection for this client and <strong
|
||||
class="has-text-danger">ALL VISITORS</strong> by setting the following environment variable <code>WS_API_AUTO=true</code>
|
||||
class="has-text-danger">ALL VISITORS</strong> by setting the following environment variable
|
||||
<code>WS_API_AUTO=true</code>
|
||||
in <code>/config/.env</code> file. Understand that this option <strong class="has-text-danger">PUBLICLY
|
||||
EXPOSES YOUR API TOKEN</strong> to <u>ALL VISITORS</u>. Anyone who is able to reach this page will be
|
||||
granted access to your <code>WatchState API</code> which exposes your other media backends data including
|
||||
@@ -309,8 +307,8 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<TaskRunnerStatus v-if="showTaskRunner || false === taskRunner?.status"
|
||||
:status="taskRunner" @taskrunner_update="e => taskRunner = e"/>
|
||||
<TaskRunnerStatus v-if="showTaskRunner || false === taskRunner?.status" :status="taskRunner"
|
||||
@taskrunner_update="e => taskRunner = e" />
|
||||
<NuxtPage v-if="!showConnection && hasAPISettings" />
|
||||
<no-api v-if="!hasAPISettings" />
|
||||
</div>
|
||||
@@ -330,7 +328,7 @@
|
||||
-
|
||||
<NuxtLink @click="loadFile = '/NEWS.md'" v-text="'News'" />
|
||||
-
|
||||
<NuxtLink to="/changelog" v-text="'ChangeLog'"/>
|
||||
<NuxtLink :to="changelog_url" v-text="'ChangeLog'" />
|
||||
</div>
|
||||
<div class="column is-6 is-4-mobile has-text-right">
|
||||
{{ api_version }} - <a href="https://github.com/arabcoders/watchstate" target="_blank">WatchState</a>
|
||||
@@ -373,6 +371,9 @@ const api_token = ref(toRaw(real_api_token.value))
|
||||
const api_status = ref(false)
|
||||
const api_response = ref('Status: Unknown')
|
||||
const api_version = ref()
|
||||
const changelog_url = ref('/changelog')
|
||||
|
||||
watch(() => api_version.value, () => changelog_url.value = `/changelog?version=${api_version.value}`)
|
||||
|
||||
const showMenu = ref(false)
|
||||
const exposeToken = ref(false)
|
||||
|
||||
@@ -42,12 +42,12 @@ import moment from 'moment'
|
||||
|
||||
useHead({ title: 'Change log' })
|
||||
|
||||
const REPO_URL = "https://arabcoders.github.io/watchstate/CHANGELOG-{branch}.json";
|
||||
const REPO_URL = "https://arabcoders.github.io/watchstate/CHANGELOG-{branch}.json?version={version}";
|
||||
const logs = ref([]);
|
||||
const api_version = ref('master');
|
||||
const api_version = ref('dev');
|
||||
|
||||
const branch = computed(() => {
|
||||
const branch = String(api_version.value).split('-')[0] ?? 'master';
|
||||
const branch = String(api_version.value).split('-')[0] ?? 'dev';
|
||||
return ['master', 'dev'].includes(branch) ? branch : 'dev';
|
||||
});
|
||||
|
||||
@@ -62,7 +62,7 @@ const loadContent = async () => {
|
||||
}
|
||||
|
||||
try {
|
||||
const changes = await fetch(r(REPO_URL, {branch: branch.value}));
|
||||
const changes = await fetch(r(REPO_URL, { branch: branch.value, version: api_version.value }));
|
||||
logs.value = await changes.json();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -72,4 +72,3 @@ const loadContent = async () => {
|
||||
|
||||
onMounted(() => loadContent());
|
||||
</script>
|
||||
|
||||
|
||||
@@ -788,17 +788,35 @@ if (!function_exists('getAppVersion')) {
|
||||
if ('$(version_via_ci)' === $version) {
|
||||
$gitDir = ROOT_PATH . DIRECTORY_SEPARATOR . '.git' . DIRECTORY_SEPARATOR;
|
||||
|
||||
if (is_dir($gitDir)) {
|
||||
$cmdVersion = [
|
||||
'git --git-dir=%1$s describe --exact-match --tags',
|
||||
'git --git-dir=%1$s rev-parse --short HEAD',
|
||||
];
|
||||
foreach ($cmdVersion as $cmd) {
|
||||
$proc = Process::fromShellCommandline(sprintf($cmd, escapeshellarg($gitDir)));
|
||||
$proc->run();
|
||||
if ($proc->isSuccessful()) {
|
||||
return trim(explode(PHP_EOL, $proc->getOutput())[0]);
|
||||
}
|
||||
if (is_dir($gitDir) && is_executable('git')) {
|
||||
try {
|
||||
// Get the current branch name.
|
||||
$cmdBranch = 'git --git-dir=%1$s rev-parse --abbrev-ref HEAD';
|
||||
$procBranch = Process::fromShellCommandline(sprintf($cmdBranch, escapeshellarg($gitDir)));
|
||||
$procBranch->run();
|
||||
$branch = $procBranch->isSuccessful() ? trim($procBranch->getOutput()) : 'unknown';
|
||||
|
||||
// Get the short commit hash.
|
||||
$cmdCommit = 'git --git-dir=%1$s rev-parse --short HEAD';
|
||||
$procCommit = Process::fromShellCommandline(sprintf($cmdCommit, escapeshellarg($gitDir)));
|
||||
$procCommit->run();
|
||||
$commit = $procCommit->isSuccessful() ? trim($procCommit->getOutput()) : 'unknown';
|
||||
|
||||
// Get the commit date (from HEAD) in YYYYMMDD format.
|
||||
// This uses "git show" with a custom date format.
|
||||
$cmdDate = 'git --git-dir=%1$s show -s --format=%cd --date=format:%Y%m%d HEAD';
|
||||
$procDate = Process::fromShellCommandline(sprintf($cmdDate, escapeshellarg($gitDir)));
|
||||
$procDate->run();
|
||||
$commitDate = $procDate->isSuccessful() ? trim($procDate->getOutput()) : date('Ymd');
|
||||
|
||||
// Return the version in the format: branch-date-sha
|
||||
return r('{branch}-{date}-{commit}', [
|
||||
'branch' => $branch,
|
||||
'date' => $commitDate,
|
||||
'commit' => $commit,
|
||||
]);
|
||||
} catch (Throwable) {
|
||||
return $version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1707,13 +1725,11 @@ if (!function_exists('isTaskWorkerRunning')) {
|
||||
}
|
||||
|
||||
switch (PHP_OS) {
|
||||
case 'Linux':
|
||||
{
|
||||
case 'Linux': {
|
||||
$status = file_exists(r('/proc/{pid}/status', ['pid' => $pid]));
|
||||
}
|
||||
break;
|
||||
case 'WINNT':
|
||||
{
|
||||
case 'WINNT': {
|
||||
// -- Windows does not have a /proc directory so we need different way to get the status.
|
||||
@exec("tasklist /FI \"PID eq {$pid}\" 2>NUL", $output);
|
||||
// -- windows doesn't return 0 if the process is not found. we need to parse the output.
|
||||
|
||||
Reference in New Issue
Block a user