1. 调整认证码图片的生成机制,提高识别度;2. 调整Win版助手系统托盘图标,提升识别度。
							parent
							
								
									e96534b4d7
								
							
						
					
					
						commit
						5e22d70d19
					
				
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.5 KiB  | 
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -101,44 +101,14 @@
 | 
			
		|||
      color: rgba(0, 0, 0, 0.6);
 | 
			
		||||
    }
 | 
			
		||||
    .stats-value {
 | 
			
		||||
      display:inline;
 | 
			
		||||
      color: rgba(0, 0, 0, 0.6);
 | 
			
		||||
      cursor: pointer;
 | 
			
		||||
      font-size: 42px;
 | 
			
		||||
      font-weight: 300;
 | 
			
		||||
      white-space: nowrap;
 | 
			
		||||
      padding-left: 20px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //.loading {
 | 
			
		||||
    //  color: lighten(@page-bg, 60%);
 | 
			
		||||
    //  font-size: 18px;
 | 
			
		||||
    //}
 | 
			
		||||
 | 
			
		||||
    //@media all and (min-width: 768px) and (max-width: 1024px) {
 | 
			
		||||
    //  .stats-icon {
 | 
			
		||||
    //    left: 10px;
 | 
			
		||||
    //  }
 | 
			
		||||
    //
 | 
			
		||||
    //  .stats-content {
 | 
			
		||||
    //    padding-left: 36px;
 | 
			
		||||
    //  }
 | 
			
		||||
    //
 | 
			
		||||
    //  .stats-value {
 | 
			
		||||
    //    font-size: 36px;
 | 
			
		||||
    //  }
 | 
			
		||||
    //}
 | 
			
		||||
    //@media all and (min-width: 1025px) and (max-width: 1366px) {
 | 
			
		||||
    //  .stats-icon {
 | 
			
		||||
    //    left: 15px;
 | 
			
		||||
    //  }
 | 
			
		||||
    //
 | 
			
		||||
    //  .stats-content {
 | 
			
		||||
    //    padding-left: 48px;
 | 
			
		||||
    //  }
 | 
			
		||||
    //
 | 
			
		||||
    //  .stats-value {
 | 
			
		||||
    //    font-size: 46px;
 | 
			
		||||
    //  }
 | 
			
		||||
    //}
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &.stats-bar {
 | 
			
		||||
| 
						 | 
				
			
			@ -151,210 +121,12 @@
 | 
			
		|||
      //padding-left: 100px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //.stats-name {
 | 
			
		||||
    //  font-size: 14px;
 | 
			
		||||
    //  font-weight: 500;
 | 
			
		||||
    //  //color: #1f1f1f;
 | 
			
		||||
    //  color: rgba(0, 0, 0, 0.6);
 | 
			
		||||
    //}
 | 
			
		||||
    .stats-value {
 | 
			
		||||
      margin-top: 5px;
 | 
			
		||||
      height: 180px;
 | 
			
		||||
      //color: #000000;
 | 
			
		||||
      //color: rgba(0, 0, 0, 0.6);
 | 
			
		||||
      //font-size: 48px;
 | 
			
		||||
      //line-height: 52px;
 | 
			
		||||
      //font-weight: 300;
 | 
			
		||||
      //white-space: nowrap;
 | 
			
		||||
      //padding-left: 20px;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //&.widget-info {
 | 
			
		||||
  //  position: relative;
 | 
			
		||||
  //  padding-top: 8px;
 | 
			
		||||
  //  padding-bottom: 8px;
 | 
			
		||||
  //
 | 
			
		||||
  //  .stats-icon, .stats-name {
 | 
			
		||||
  //    float: left;
 | 
			
		||||
  //    line-height: 24px;
 | 
			
		||||
  //    color: #fff;
 | 
			
		||||
  //    color: rgba(255, 255, 255, .6);
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //  .stats-icon {
 | 
			
		||||
  //    font-size: 24px;
 | 
			
		||||
  //    margin-right: 5px;
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //  .stats-name {
 | 
			
		||||
  //    font-size: 14px;
 | 
			
		||||
  //    font-weight: bold;
 | 
			
		||||
  //  }
 | 
			
		||||
  //  .stats-value {
 | 
			
		||||
  //    float: right;
 | 
			
		||||
  //    font-size: 16px;
 | 
			
		||||
  //    font-weight: 300;
 | 
			
		||||
  //    margin-right: 10px;
 | 
			
		||||
  //  }
 | 
			
		||||
  //}
 | 
			
		||||
  //
 | 
			
		||||
  //&.widget-bar {
 | 
			
		||||
  //  position: relative;
 | 
			
		||||
  //  padding-top: 8px;
 | 
			
		||||
  //  padding-bottom: 8px;
 | 
			
		||||
  //
 | 
			
		||||
  //  .stats-name {
 | 
			
		||||
  //    font-size: 14px;
 | 
			
		||||
  //    font-weight: bold;
 | 
			
		||||
  //    color: #fff;
 | 
			
		||||
  //    color: rgba(255, 255, 255, .6);
 | 
			
		||||
  //  }
 | 
			
		||||
  //  .stats-value {
 | 
			
		||||
  //    //width: 390px;
 | 
			
		||||
  //    width: 100%;
 | 
			
		||||
  //    height: 128px;
 | 
			
		||||
  //  }
 | 
			
		||||
  //}
 | 
			
		||||
  //
 | 
			
		||||
  //&.widget-box, &.widget-block-list {
 | 
			
		||||
  //  position: relative;
 | 
			
		||||
  //  padding-top: 8px;
 | 
			
		||||
  //  padding-bottom: 8px;
 | 
			
		||||
  //
 | 
			
		||||
  //  .stats-name {
 | 
			
		||||
  //    font-size: 14px;
 | 
			
		||||
  //    font-weight: bold;
 | 
			
		||||
  //    color: #fff;
 | 
			
		||||
  //    color: rgba(255, 255, 255, .6);
 | 
			
		||||
  //
 | 
			
		||||
  //    span {
 | 
			
		||||
  //      font-size: 11px;
 | 
			
		||||
  //      font-weight: 300;
 | 
			
		||||
  //      color: #fff;
 | 
			
		||||
  //      color: rgba(255, 255, 255, .4);
 | 
			
		||||
  //    }
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //  .stats-value {
 | 
			
		||||
  //    width: 100%;
 | 
			
		||||
  //    height: 100%;
 | 
			
		||||
  //
 | 
			
		||||
  //    #box-tpm, #box-dfs {
 | 
			
		||||
  //      width: 100%;
 | 
			
		||||
  //      height: 100%;
 | 
			
		||||
  //    }
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //  //.dfs-icon-upload, #val-tpm-upload, .dfs-icon-download, #val-tpm-download {
 | 
			
		||||
  //  //  font-size: 36px;
 | 
			
		||||
  //  //}
 | 
			
		||||
  //
 | 
			
		||||
  //  .io-rate-box {
 | 
			
		||||
  //    height: 50%;
 | 
			
		||||
  //    width:100%;
 | 
			
		||||
  //    display: table;
 | 
			
		||||
  //    padding-left: 20px;
 | 
			
		||||
  //    font-size: 24px;
 | 
			
		||||
  //
 | 
			
		||||
  //    .io-rate-box-inner {
 | 
			
		||||
  //      display: table-cell;
 | 
			
		||||
  //      text-align: center;
 | 
			
		||||
  //      width:100%;
 | 
			
		||||
  //
 | 
			
		||||
  //      &.dfs-upload {
 | 
			
		||||
  //        vertical-align: bottom;
 | 
			
		||||
  //        padding-bottom: 20px;
 | 
			
		||||
  //        color: #1e8a13;
 | 
			
		||||
  //      }
 | 
			
		||||
  //
 | 
			
		||||
  //      &.dfs-download {
 | 
			
		||||
  //        vertical-align: top;
 | 
			
		||||
  //        //padding-top: 20px;
 | 
			
		||||
  //        color: #ff914d;
 | 
			
		||||
  //      }
 | 
			
		||||
  //    }
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //  @media all and (min-width: 768px) and (max-width: 1367px) {
 | 
			
		||||
  //    .io-rate-box {
 | 
			
		||||
  //      font-size: 24px;
 | 
			
		||||
  //    }
 | 
			
		||||
  //  }
 | 
			
		||||
  //  @media all and (min-width: 1367px) {
 | 
			
		||||
  //    .io-rate-box {
 | 
			
		||||
  //      font-size: 28px;
 | 
			
		||||
  //    }
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //}
 | 
			
		||||
  //
 | 
			
		||||
  //&.widget-block-list {
 | 
			
		||||
  //  .stats-value {
 | 
			
		||||
  //    padding-top: 5px;
 | 
			
		||||
  //    width: 100%;
 | 
			
		||||
  //    height: 800px;
 | 
			
		||||
  //    overflow: hidden;
 | 
			
		||||
  //  }
 | 
			
		||||
  //
 | 
			
		||||
  //  .block-info {
 | 
			
		||||
  //    font-size: 11px;
 | 
			
		||||
  //    border-top: 1px dotted rgba(255, 255, 255, .1);;
 | 
			
		||||
  //    clear: both;
 | 
			
		||||
  //
 | 
			
		||||
  //    & > ul {
 | 
			
		||||
  //      margin: 0;
 | 
			
		||||
  //      padding: 0;
 | 
			
		||||
  //      list-style: none;
 | 
			
		||||
  //
 | 
			
		||||
  //      & > li {
 | 
			
		||||
  //        float: left;
 | 
			
		||||
  //        position: relative;
 | 
			
		||||
  //        display: inline-block;
 | 
			
		||||
  //        line-height: 24px;
 | 
			
		||||
  //        margin-left: 10px;
 | 
			
		||||
  //        &:first-child {
 | 
			
		||||
  //          margin-left: 0;
 | 
			
		||||
  //        }
 | 
			
		||||
  //      }
 | 
			
		||||
  //    }
 | 
			
		||||
  //
 | 
			
		||||
  //    .rollback {
 | 
			
		||||
  //      color: #ee5752;
 | 
			
		||||
  //    }
 | 
			
		||||
  //
 | 
			
		||||
  //    .time, .hash {
 | 
			
		||||
  //      //font-family: @font-family-mono;
 | 
			
		||||
  //    }
 | 
			
		||||
  //    .time {
 | 
			
		||||
  //      //color: lighten(@page-bg, 50%);
 | 
			
		||||
  //      color: #7793b7;
 | 
			
		||||
  //      white-space: nowrap;
 | 
			
		||||
  //      //width: 142px;
 | 
			
		||||
  //      width: 106px;
 | 
			
		||||
  //    }
 | 
			
		||||
  //    .hash {
 | 
			
		||||
  //      color: #70b051;
 | 
			
		||||
  //      //width: 256px;
 | 
			
		||||
  //      //width: 236px;
 | 
			
		||||
  //      white-space: nowrap;
 | 
			
		||||
  //    }
 | 
			
		||||
  //    .trans {
 | 
			
		||||
  //      color: #449dbe;
 | 
			
		||||
  //      white-space: nowrap;
 | 
			
		||||
  //      width: 52px;
 | 
			
		||||
  //    }
 | 
			
		||||
  //    .data {
 | 
			
		||||
  //      color: #919191;
 | 
			
		||||
  //      white-space: nowrap;
 | 
			
		||||
  //      //display: block;
 | 
			
		||||
  //      width: 10px;
 | 
			
		||||
  //      //text-overflow: ellipsis;
 | 
			
		||||
  //      //overflow:hidden;
 | 
			
		||||
  //    }
 | 
			
		||||
  //  }
 | 
			
		||||
  //}
 | 
			
		||||
 | 
			
		||||
  &.stats-first {
 | 
			
		||||
    border-left: none;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,10 +16,75 @@ from wheezy.captcha.image import text
 | 
			
		|||
from wheezy.captcha.image import warp
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
_captcha_chars = 'AaCDdEeFfHJjKkLMmNnPpQRTtVvWwXxYy34679'
 | 
			
		||||
# _captcha_chars = 'AaCDdEeFfHJjKkLMmNnPpQRTtVvWwXxYy34679'
 | 
			
		||||
_captcha_chars = 'AaCDdEeFfHJKkLMmNnPpRTtVvWwXYy2379'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _random_color_font():
 | 
			
		||||
    colors = ['#152cea', '#0b7700', '#5431d4', '#0e78ca']
 | 
			
		||||
    return random.choice(colors)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _random_color_line():
 | 
			
		||||
    colors = ['#ce3714', '#de35bc']
 | 
			
		||||
    return random.choice(colors)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def tp_captcha_generate_image(h):
 | 
			
		||||
    if h >= 32:
 | 
			
		||||
        captcha_image_t = captcha(
 | 
			
		||||
            width=136,
 | 
			
		||||
            height=36,
 | 
			
		||||
            drawings=[
 | 
			
		||||
                background(color='#eeeeee'),
 | 
			
		||||
                curve(color='#bbbbbb', width=6, number=12),
 | 
			
		||||
                curve(color=_random_color_line, width=2, number=30),
 | 
			
		||||
                curve(color='#cccccc', width=7, number=13),
 | 
			
		||||
                curve(color='#dddddd', width=8, number=14),
 | 
			
		||||
                text(fonts=[
 | 
			
		||||
                    os.path.join(tp_cfg().res_path, 'fonts', '001.ttf')
 | 
			
		||||
                ],
 | 
			
		||||
                    font_sizes=(h-5, h-2, h, h+2),
 | 
			
		||||
                    color=_random_color_font,
 | 
			
		||||
                    squeeze_factor=1.05,
 | 
			
		||||
                    drawings=[
 | 
			
		||||
                        warp(dx_factor=0.03, dy_factor=0.03),
 | 
			
		||||
                        rotate(angle=20),
 | 
			
		||||
                        offset()
 | 
			
		||||
                    ]),
 | 
			
		||||
                smooth(),
 | 
			
		||||
            ])
 | 
			
		||||
    else:
 | 
			
		||||
        captcha_image_t = captcha(
 | 
			
		||||
            width=int(h*3)+8,
 | 
			
		||||
            height=h,
 | 
			
		||||
            drawings=[
 | 
			
		||||
                background(color='#eeeeee'),
 | 
			
		||||
                noise(number=40, color='#dddddd', level=3),
 | 
			
		||||
                smooth(),
 | 
			
		||||
                text(fonts=[
 | 
			
		||||
                    os.path.join(tp_cfg().res_path, 'fonts', '001.ttf')
 | 
			
		||||
                ],
 | 
			
		||||
                    font_sizes=(h-3, h-2, h-1, h),
 | 
			
		||||
                    color=_random_color_font,
 | 
			
		||||
                    squeeze_factor=0.95,
 | 
			
		||||
                    drawings=[
 | 
			
		||||
                        warp(dx_factor=0.03, dy_factor=0.03),
 | 
			
		||||
                        rotate(angle=15),
 | 
			
		||||
                        offset()
 | 
			
		||||
                    ]),
 | 
			
		||||
                smooth(),
 | 
			
		||||
            ])
 | 
			
		||||
 | 
			
		||||
    chars_t = random.sample(_captcha_chars, 4)
 | 
			
		||||
    image = captcha_image_t(chars_t)
 | 
			
		||||
 | 
			
		||||
    out = io.BytesIO()
 | 
			
		||||
    image.save(out, "jpeg", quality=80)
 | 
			
		||||
    return ''.join(chars_t), out.getvalue()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def tp_captcha_generate_image_v1(h):
 | 
			
		||||
    if h >= 32:
 | 
			
		||||
        captcha_image_t = captcha(
 | 
			
		||||
            width=136,
 | 
			
		||||
| 
						 | 
				
			
			@ -85,4 +150,3 @@ def tp_captcha_generate_image(h):
 | 
			
		|||
    out = io.BytesIO()
 | 
			
		||||
    image.save(out, "jpeg", quality=100)
 | 
			
		||||
    return ''.join(chars_t), out.getvalue()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue