Merge branch 'master' into nymkappa/bugfix/asn-mapping
@ -510,7 +510,12 @@ class BitcoinRoutes {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  private getDifficultyChange(req: Request, res: Response) {
 | 
					  private getDifficultyChange(req: Request, res: Response) {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      res.json(difficultyAdjustment.getDifficultyAdjustment());
 | 
					      const da = difficultyAdjustment.getDifficultyAdjustment();
 | 
				
			||||||
 | 
					      if (da) {
 | 
				
			||||||
 | 
					        res.json(da);
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        res.status(503).send(`Service Temporarily Unavailable`);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
      res.status(500).send(e instanceof Error ? e.message : e);
 | 
					      res.status(500).send(e instanceof Error ? e.message : e);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -81,14 +81,15 @@ export function calcDifficultyAdjustment(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DifficultyAdjustmentApi {
 | 
					class DifficultyAdjustmentApi {
 | 
				
			||||||
  constructor() { }
 | 
					  public getDifficultyAdjustment(): IDifficultyAdjustment | null {
 | 
				
			||||||
 | 
					 | 
				
			||||||
  public getDifficultyAdjustment(): IDifficultyAdjustment {
 | 
					 | 
				
			||||||
    const DATime = blocks.getLastDifficultyAdjustmentTime();
 | 
					    const DATime = blocks.getLastDifficultyAdjustmentTime();
 | 
				
			||||||
    const previousRetarget = blocks.getPreviousDifficultyRetarget();
 | 
					    const previousRetarget = blocks.getPreviousDifficultyRetarget();
 | 
				
			||||||
    const blockHeight = blocks.getCurrentBlockHeight();
 | 
					    const blockHeight = blocks.getCurrentBlockHeight();
 | 
				
			||||||
    const blocksCache = blocks.getBlocks();
 | 
					    const blocksCache = blocks.getBlocks();
 | 
				
			||||||
    const latestBlock = blocksCache[blocksCache.length - 1];
 | 
					    const latestBlock = blocksCache[blocksCache.length - 1];
 | 
				
			||||||
 | 
					    if (!latestBlock) {
 | 
				
			||||||
 | 
					      return null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    const nowSeconds = Math.floor(new Date().getTime() / 1000);
 | 
					    const nowSeconds = Math.floor(new Date().getTime() / 1000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return calcDifficultyAdjustment(
 | 
					    return calcDifficultyAdjustment(
 | 
				
			||||||
 | 
				
			|||||||
@ -130,10 +130,6 @@ export class NodeChannels implements OnChanges {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onChartInit(ec: ECharts): void {
 | 
					  onChartInit(ec: ECharts): void {
 | 
				
			||||||
    if (this.chartInstance !== undefined) {
 | 
					 | 
				
			||||||
      return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.chartInstance = ec;
 | 
					    this.chartInstance = ec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.chartInstance.on('click', (e) => {
 | 
					    this.chartInstance.on('click', (e) => {
 | 
				
			||||||
 | 
				
			|||||||
| 
		 Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 94 KiB  | 
| 
		 Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 96 KiB  | 
| 
		 Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 726 KiB  | 
| 
		 Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 1.8 MiB  | 
| 
		 Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 607 KiB  | 
@ -48,6 +48,9 @@ add_header Vary Cookie;
 | 
				
			|||||||
# for exact / requests, redirect based on $lang
 | 
					# for exact / requests, redirect based on $lang
 | 
				
			||||||
# cache redirect for 5 minutes
 | 
					# cache redirect for 5 minutes
 | 
				
			||||||
location = / {
 | 
					location = / {
 | 
				
			||||||
 | 
						if ($unfurlbot) {
 | 
				
			||||||
 | 
							proxy_pass $mempoolSpaceUnfurler;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if ($lang != '') {
 | 
						if ($lang != '') {
 | 
				
			||||||
		return 302 $scheme://$host/$lang/;
 | 
							return 302 $scheme://$host/$lang/;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||