Skip to content

Commit

Permalink
rollup security vulnerability and "give us a star"
Browse files Browse the repository at this point in the history
  • Loading branch information
aeltorio committed Oct 11, 2024
1 parent bdddd6b commit bab6b76
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
[package]
name = "sctgdesk-api-server"
version = "1.1.99-44"
version = "1.1.99-45"
edition = "2021"
build = "build.rs"
# [workspace]
# members = [
# "libs/utils",
# "libs/state",
# "libs/oauth2"
# ]

[dependencies]
log = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions webconsole/package-lock.json

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

46 changes: 23 additions & 23 deletions webconsole/package.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"name": "sctgdesk-api-server-webconsole",
"private": false,
"version": "1.1.99-44",
"version": "1.1.99-45",
"type": "module",
"scripts": {
"dev": "vite",
"preview": "vite preview",
"create-cert": "openssl req -x509 -newkey rsa:4096 -keyout localhost.key -out localhost.pem -sha256 -nodes -days 365",
"devserver": "npx nodemon -V -w ./src -e js,vue,ts,css,html --exec 'npm run build && node devserver.js'",
"create-cert": "openssl req -x509 -newkey rsa:4096 -keyout localhost.key -out localhost.pem -sha256 -nodes -days 365",
"preview": "vite preview",
"dev": "vite",
"build": "vite build && gulp licenses"
},
"dependencies": {
"vue": "^3.5.11",
"@headlessui/vue": "^1.7.23",
"vue-router": "^4.4.5",
"jdenticon": "^3.3.0",
"flowbite": "^2.5.2",
"pinia": "^2.2.4",
"chart.js": "^4.4.4",
"@pqina/flip": "^1.8.3",
"vue": "^3.5.11",
"@heroicons/vue": "^2.1.5",
"axios": "^1.7.7",
"vue-router": "^4.4.5",
"pinia": "^2.2.4",
"@pqina/flip": "^1.8.3",
"clipboard": "^2.0.11"
"@headlessui/vue": "^1.7.23",
"clipboard": "^2.0.11",
"flowbite": "^2.5.2"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"@vitejs/plugin-vue": "^5.1.4",
"sass": "^1.79.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
"gulp": "^5.0.0",
"tailwindcss": "^3.4.13",
"gulp-if": "^3.0.0",
"@fullhuman/postcss-purgecss": "^6.0.0",
"ts-node": "^10.9.2",
"@types/glob": "^8.1.0",
"sass": "^1.79.5",
"@tailwindcss/forms": "^0.5.9",
"gulp": "^5.0.0",
"postcss": "^8.4.47",
"postcss-purgefonts": "^1.0.2",
"vite": "^5.4.8",
"tailwindcss": "^3.4.13",
"gulp-append-prepend": "^1.0.9",
"@tailwindcss/forms": "^0.5.9",
"autoprefixer": "^10.4.20",
"glob": "11.0.0",
"postcss-purgefonts": "^1.0.2",
"@tailwindcss/typography": "^0.5.15",
"nodemon": "^3.1.7",
"postcss": "^8.4.47",
"vite-plugin-static-copy": "^2.0.0",
"express": "^5.0.0",
"vite-plugin-static-copy": "^2.0.0"
"nodemon": "^3.1.7",
"@types/glob": "^8.1.0",
"@fullhuman/postcss-purgecss": "^6.0.0"
}
}
143 changes: 143 additions & 0 deletions webconsole/src/components/GithubButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!--
=========================================================
* © 2024 Ronan LE MEILLAT for SCTG Development
=========================================================
This website use:
- Vite, Vue3, FontAwesome 6, TailwindCss 3
- And many others
-->
<template>
<div v-if="users.length > 0" class="flex items-center">
<div>{{ props.pretext }}&nbsp;</div>
<a :href="`https://github.com/${props.owner}/${props.repo}`"
class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-1 px-2 rounded-l inline-flex items-center">
<svg class="fill-current w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
<path
d="M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z" />
</svg>
<span>Stars</span>
</a>
<a :href="`https://github.com/${props.owner}/${props.repo}`"
class="bg-transparent hover:bg-gray-400 text-gray-800 font-semibold hover:text-white py-[0.18rem] px-2 border border-gray-300 hover:border-transparent rounded-r">
{{ users.length }}
</a>
<div>&nbsp;{{ props.posttext }}&nbsp;</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
/**
* Interface representing a GitHub user.
*
* Properties are marked as optional to accommodate for incomplete data from the GitHub API.
*/
export interface GitHubUser {
login?: string;
id?: number;
node_id?: string;
avatar_url?: string;
gravatar_id?: string;
url?: string;
html_url?: string;
followers_url?: string;
following_url?: string;
gists_url?: string;
starred_url?: string;
subscriptions_url?: string;
organizations_url?: string;
repos_url?: string;
events_url?: string;
received_events_url?: string;
type?: string;
site_admin?: boolean;
}
/**
* Type alias for an array of GitHub users.
*/
export type GitHubUsers = GitHubUser[];
export interface StargazersResponse {
users: GitHubUsers;
isLastPage: boolean;
}
const props = withDefaults(defineProps<{
/**
* The repository owner (defaults to 'sctg-development').
*/
owner?: string;
/**
* The repository name (defaults to 'sctgdesk-server').
*/
repo?: string;
/**
* The text to display before the stargazers count (defaults to 'Give us a star').
*/
pretext?: string;
/**
* The text to display after the stargazers count (defaults to 'on GitHub').
*/
posttext?: string;
}>(),
{
owner: 'sctg-development',
repo: 'sctgdesk-server',
pretext: 'Give us a star',
posttext: 'on GitHub'
})
const users = ref<GitHubUsers>([]);
/**
* Fetch a page of stargazers
* @param owner The owner of the repository
* @param repo The repository name
* @param page The page number to fetch
* @returns The stargazers response
*/
async function getStargazersPage(owner: string, repo: string, page: number): Promise<StargazersResponse> {
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}/stargazers?per_page=100&page=${page}`, {
headers: {
'Accept': 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28'
}
});
const githubUsers: GitHubUsers = await response.json();
const isNotLastPage = response.headers.get('Link')?.toLowerCase().includes('rel="next"') ?? true; // if there is no 'next' link, then it is the last page
return { users: githubUsers, isLastPage: !isNotLastPage } as StargazersResponse;
}
/**
* Fetch all stargazers for the repository
* @param owner The owner of the repository
* @param repo The repository name
* @returns All stargazers
*/
async function fetchAllStargazers(owner: string, repo: string): Promise<GitHubUsers> {
const allUsers: GitHubUsers = [];
let page = 1;
let isLastPage = false;
// Continuously fetch pages until we've reached the last page.
while (!isLastPage) {
// Fetch the current page of stargazers.
const { users: pageUsers, isLastPage: pageIsLastPage } = await getStargazersPage(owner, repo, page);
// Add the stargazers from this page to the total array.
allUsers.push(...pageUsers);
// Update the last page tracker.
isLastPage = pageIsLastPage;
// Move on to the next page.
page++;
}
return allUsers;
}
onMounted(() => {
fetchAllStargazers(props.owner, props.repo).then((allUsers) => {
users.value = allUsers;
});
});
</script>
6 changes: 5 additions & 1 deletion webconsole/src/footers/mainfooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ This website use:
id="footer"
class="lg:fixed mt-4 p-4 bg-white sm:p-6 dark:bg-ambblue-800 font-neutra-demi inline-block w-full bottom-0 right-0"
>
<div class="flex flex-row items-center justify-center mx-auto">
<div class="flex flex-col items-center justify-center mx-auto">
<div class="text-sm text-gray-600 dark:text-gray-400">
© 2024 Ronan LE MEILLAT for SCTG Development - sctgdesk-api-server v{{ serverVersion }} - latest client version: v{{ clientVersion }}
</div>
<div class="text-xs">
<GithubButton owner="sctg-development" repo="sctgdesk-server"/>
</div>
</div>
</footer>
</template>
<script setup lang="ts">
import GithubButton from '@/components/GithubButton.vue';
import { useVersionsStore } from '@/stores/versionsStore';
import { ref } from 'vue';
const serverVersion = ref(useVersionsStore().serverVersion);
Expand Down

0 comments on commit bab6b76

Please sign in to comment.