mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Add Latest Change Date to Frontend (#3231)
* Updated Logic for Versions * Update logic, add date
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							84314249b2
						
					
				
				
					commit
					4e36061ced
				
			
							
								
								
									
										5
									
								
								.github/workflows/crawl-versions.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/crawl-versions.yaml
									
									
									
									
										vendored
									
									
								
							@@ -63,9 +63,10 @@ jobs:
 | 
			
		||||
            jq -r '.projects[] | "\(.id) \(.name)"' "$projects_file" | while read -r id name; do
 | 
			
		||||
              version=$(curl -s -H "X-Key: $token" "https://api.newreleases.io/v1/projects/$id/latest-release")
 | 
			
		||||
              version_data=$(echo "$version" | jq -r '.version // empty')
 | 
			
		||||
              date=$(echo "$version" | jq -r '.date // empty')
 | 
			
		||||
              if [ -n "$version_data" ]; then
 | 
			
		||||
                jq --arg name "$name" --arg version "$version_data" \
 | 
			
		||||
                  '. += [{"name": $name, "version": $version}]' "$output_file" > "$output_file.tmp" && mv "$output_file.tmp" "$output_file"
 | 
			
		||||
                jq --arg name "$name" --arg version "$version_data" --arg date "$date" \
 | 
			
		||||
                  '. += [{"name": $name, "version": $version, "date": $date}]' "$output_file" > "$output_file.tmp" && mv "$output_file.tmp" "$output_file"
 | 
			
		||||
              fi
 | 
			
		||||
            done
 | 
			
		||||
            ((page++))
 | 
			
		||||
 
 | 
			
		||||
@@ -17,9 +17,8 @@ const getVersions = async () => {
 | 
			
		||||
  const versions: AppVersion[] = JSON.parse(fileContent);
 | 
			
		||||
 | 
			
		||||
  const modifiedVersions = versions.map(version => {
 | 
			
		||||
    const nameParts = version.name.split('/');
 | 
			
		||||
    let newName = nameParts[nameParts.length - 1];
 | 
			
		||||
    newName = newName.toLowerCase().replace(/[^a-z0-9]/g, '');
 | 
			
		||||
    let newName = version.name;
 | 
			
		||||
    newName = newName.toLowerCase().replace(/[^a-z0-9/]/g, '');
 | 
			
		||||
    return { ...version, name: newName };
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -95,7 +95,26 @@ function ScriptItem({
 | 
			
		||||
                    <div>{versions.length === 0 ? (<p>Loading versions...</p>) :
 | 
			
		||||
                      (<>
 | 
			
		||||
                        <p className="text-l text-foreground">Version:</p>
 | 
			
		||||
                        <p className="text-l text-muted-foreground">{versions.find((v) => v.name === item.slug.replace(/[^a-z0-9]/g, ''))?.version || "No Version Information found"}</p>
 | 
			
		||||
                        <p className="text-l text-muted-foreground">{versions.find((v) =>
 | 
			
		||||
                          v.name === item.slug.replace(/[^a-z0-9]/g, '') ||
 | 
			
		||||
                          v.name.includes(item.slug.replace(/[^a-z0-9]/g, '')) ||
 | 
			
		||||
                          v.name.replace(/[^a-z0-9]/g, '') === item.slug.replace(/[^a-z0-9]/g, '')
 | 
			
		||||
 | 
			
		||||
                        )?.version || "No Version information found"
 | 
			
		||||
                        }</p>
 | 
			
		||||
                        <p className="text-l text-foreground">Latest changes:</p>
 | 
			
		||||
                        <p className="text-l text-muted-foreground">
 | 
			
		||||
                          {(() => {
 | 
			
		||||
                            const matchedVersion = versions.find((v) =>
 | 
			
		||||
                              v.name === item.slug.replace(/[^a-z0-9]/g, '') ||
 | 
			
		||||
                              v.name.includes(item.slug.replace(/[^a-z0-9]/g, '')) ||
 | 
			
		||||
                              v.name.replace(/[^a-z0-9]/g, '') === item.slug.replace(/[^a-z0-9]/g, '')
 | 
			
		||||
                            );
 | 
			
		||||
                            return matchedVersion?.date ?
 | 
			
		||||
                              extractDate(matchedVersion.date as unknown as string) :
 | 
			
		||||
                              "No date information found"
 | 
			
		||||
                          })()}
 | 
			
		||||
                        </p>
 | 
			
		||||
                      </>)
 | 
			
		||||
                    }
 | 
			
		||||
                    </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -60,4 +60,5 @@ export interface OperatingSystem {
 | 
			
		||||
export interface AppVersion {
 | 
			
		||||
  name: string;
 | 
			
		||||
  version: string;
 | 
			
		||||
  date: Date;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user