OpportunityLiu / E-Viewer

An UWP Client for https://e-hentai.org.
GNU General Public License v3.0
725 stars 29 forks source link

里站明明可以不用代理就能访问,为啥用eviewer不行? #120

Closed lukemin closed 4 years ago

lukemin commented 5 years ago

里站明明可以不用代理就能访问,为啥用eviewer不行?

OpportunityLiu commented 5 years ago

那你怎么登录呢?

lukemin commented 5 years ago

就挂代理登录一次就可以了啊,之后就可以一直看里站了,参考ehviwer https://github.com/seven332/EhViewer

OpportunityLiu commented 5 years ago

我就是看了他的各种奇奇怪怪的issues才决定每次启动从表站里站把所有cookies全部刷新一遍的。。。

确实有很多不必要的pv,等我周末调查下吧

lukemin commented 5 years ago

具体技术问题我不会,但是我知道我的ehviewer的账号已经登录了大半年了,没发现啥问题。

kakka-z commented 5 years ago

用cookie登里站需要igneous,然而登录界面并没有igneous的输入框

OpportunityLiu commented 5 years ago

@Neiltseng96 那个可以自动生成的吧?我的程序内部也只复制那两个cookie到里站

kakka-z commented 5 years ago

@OpportunityLiu 我的账号可以网页登陆ex,可软件内切换成ex的站点就提示没有权限?什么原因?

OpportunityLiu commented 5 years ago

图片 igneous 应该是自动发的,貌似跟第一次获取该cookie时候的IP有关系

OpportunityLiu commented 5 years ago

https://nota.moe/2018/access-exhentai-with-igneous/

lukemin commented 5 years ago

// ==UserScript== // @name ExH login // @namespace https://blog.maple3142.net/ // @version 0.1 // @description Login to exhentai without modifying cookie by your self. // @author maple3142 // @connect e-hentai.org // @require https://code.jquery.com/jquery-3.2.1.slim.min.js // @match https://exhentai.org/ // @grant GM_xmlhttpRequest // ==/UserScript==

;(function($) { 'use strict'

const $ct = $('<div>')
    .css('position', 'absolute')
    .css('height', '100%')
    .css('width', '100%')
    .css('background-color', 'white')
const $lgb = $('<div>')
    .css('position', 'absolute')
    .css('left', '50%')
    .css('top', '50%')
    .css('transform', 'translateX(-50%) translateY(-50%)')
    .css('display', 'flex')
    .css('align-items', 'center')
    .css('width', '30%')
const $ac = $('<input>')
const $acl = $('<label>')
    .text('ac: ')
    .css('flex', 1)
    .append($ac)
const $pw = $('<input>')
const $pwl = $('<label>')
    .text('pw: ')
    .css('flex', 1)
    .append($pw)
    .attr('type', 'password')
const $lg = $('<button>').text('Login')
$lgb.append($acl)
    .append($pwl)
    .append($lg)
$ct.append($lgb)

$lg.on('click', e => doLogin($ac.val(), $pw.val()))

function parseHeaders(h) {
    return Object.assign(
        ...h
            .split('\n')
            .map(x => x.split(/:\s+/))
            .map(([k, v]) => ({ [k]: v }))
    )
}
function doLogin(UserName, PassWord) {
    GM_xmlhttpRequest({
        url: 'https://forums.e-hentai.org/index.php?act=Login&CODE=01',
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: `UserName=${UserName}&PassWord=${PassWord}&ipb_login_submit=Login!&b=d&bt=1-1&CookieDate=1`,
        onload: xhr => {
            const res = xhr.responseText
            const h = parseHeaders(xhr.responseHeaders)
            if (res && res.includes('You are now logged in as')) {
                document.cookie = 'yay=louder; Max-Age=0; path=/; domain=.exhentai.org'
                for (const tok of h['set-cookie'].split(',')) {
                    document.cookie = tok.replace(/e-hentai/, 'exhentai')
                }
                location.href = location.href
            }
        },
        onerror: console.error
    })
}

if ($('img[src="https://exhentai.org/"]').length) {
    $(document.body).append($ct)
    //if(ac&&pw)doLogin(ac,pw)
}
document.cookie = document.cookie.replace('yay=louder', '')

})(jQuery.noConflict()) 油猴脚本

OpportunityLiu commented 4 years ago

新版应该修复这个问题了。 我在登录后block掉表站现在可以正常工作

用cookie登录的话,三个框填满则登录的时候也不需要访问表站