mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 00:11:04 +00:00 
			
		
		
		
	To keep blame info accurate and to avoid [changes like
this](https://github.com/go-gitea/gitea/pull/29977/files#diff-c3422631a14edbe1e508c4b22f0c718db318be08a6e889427802f9b6165d88d6R359),
it's good to always have a trailing comma, so let's enforce it in JS.
This rule is completely automatically fixable with `make lint-js-fix`
and that's what I did here.
(cherry picked from commit 3d751b6ec18e57698ce86b79866031d2c80c2071)
Conflicts:
	web_src/js/components/DashboardRepoList.vue
	trivial context conflict because of '3b7b899afa fix commit_status'
		
	
			
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			888 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			888 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import SwaggerUI from 'swagger-ui-dist/swagger-ui-es-bundle.js';
 | 
						|
import 'swagger-ui-dist/swagger-ui.css';
 | 
						|
 | 
						|
window.addEventListener('load', async () => {
 | 
						|
  const url = document.getElementById('swagger-ui').getAttribute('data-source');
 | 
						|
  const res = await fetch(url);
 | 
						|
  const spec = await res.json();
 | 
						|
 | 
						|
  // Make the page's protocol be at the top of the schemes list
 | 
						|
  const proto = window.location.protocol.slice(0, -1);
 | 
						|
  spec.schemes.sort((a, b) => {
 | 
						|
    if (a === proto) return -1;
 | 
						|
    if (b === proto) return 1;
 | 
						|
    return 0;
 | 
						|
  });
 | 
						|
 | 
						|
  const ui = SwaggerUI({
 | 
						|
    spec,
 | 
						|
    dom_id: '#swagger-ui',
 | 
						|
    deepLinking: true,
 | 
						|
    docExpansion: 'none',
 | 
						|
    defaultModelRendering: 'model', // don't show examples by default, because they may be incomplete
 | 
						|
    presets: [
 | 
						|
      SwaggerUI.presets.apis,
 | 
						|
    ],
 | 
						|
    plugins: [
 | 
						|
      SwaggerUI.plugins.DownloadUrl,
 | 
						|
    ],
 | 
						|
  });
 | 
						|
 | 
						|
  window.ui = ui;
 | 
						|
});
 |